Why is my webserver in golang not handling concurrent requests?

Your program already handles the requests concurrently. You can test it with ab, a benchmark tool which is shipped with Apache 2:

ab -c 500 -n 500 http://localhost:1234/

On my system, the benchmark takes a total of 5043ms to serve all 500 concurrent requests. It’s just your browser which limits the number of connections per website.

Benchmarking Go programs isn’t that easy by the way, because you need to make sure that your benchmark tool isn’t the bottleneck and that it is also able to handle that many concurrent connections. Therefore, it’s a good idea to use a couple of dedicated computers to generate load.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)