Half a year ago I noticed the default http sever implementation in go has not so very good performance in certain cases (which I didn't investigate yet :) ) compared to nginx. But this can be fixed by implementing your own specialized http server on top of well-defined http.Reqest and http.Response objects. Of course, in this case your own http server won't support all http bits, but it will beat nginx :) Below are performance numbers for my own specialized http caching proxy written in go (
go-cdn-booster) vs nginx in the role of caching proxy. Performance is measured with
go-cdn-booster-bench:
Nginx configs related to the test:
access_log off;
proxy_cache_path /var/www/cache levels=1:2 keys_zone=my-cache:100k max_size=100m inactive=600m;
proxy_temp_path /var/www/cache/tmp;
proxy_cache my-cache;
proxy_cache_valid 200 60m;
go-cdn-booster configs:
./go-cdn-booster -upstreamHost=www.google.com
Performance numbers for nginx from the second test run. The first test run is inapplicable, since the nginx fetches the given image filesCount=500 times from
www.google.com . During the second run nginx obtains the image contents from cache:
filesCount=500
goMaxProcs=4
requestsCount=100000
requestsPerConnectionCount=100
workersCount=16
2014/06/23 15:11:35 Test started
2014/06/23 15:11:37 Done
2014/06/23 15:11:37 100000 requests from 16 workers in 1.566374866s
2014/06/23 15:11:37 242400 Kbytes read, 63842 qps, 154752 Kbps
Performance numbers for go-cdn-booster from the second run:
filesCount=500
goMaxProcs=4
requestsCount=100000
requestsPerConnectionCount=100
workersCount=16
2014/06/23 15:16:36 Test started
2014/06/23 15:16:37 Done
2014/06/23 15:16:37 100000 requests from 16 workers in 1.088171327s
2014/06/23 15:16:37 242400 Kbytes read, 91897 qps, 222759 Kbps
As you can see, specialized http servers written in go may easily beat nginx in performance comparisons.