tylerjl/benchmarking-proxies

The Nginx configuration isn't correct

Opened this issue · 1 comments

Like you said, make a correct bench is a difficult art.

Nginx default

As the older web server, still maintain http1.0
proxy_pass by default use http1.0

As you pointed to https://www.nginx.com/blog/tuning-nginx/, it's explained.
image

So in the default version, it is creating a new connection for each request.
It's for this, than we have errors. It's very cpu and time consuming create for each request a new TCP connection.
Still so, it's faster than Caddy.

Config need to be:

location / {
            proxy_pass http://127.0.0.1:8081;
            proxy_http_version 1.1;
            proxy_set_header Connection "";
        }

Nginx optimized

Here you are caching the response of the proxied server. I think that Caddy is not caching the responses.
The cache is used for slow apps.
But we want to test the reverse proxy, not the cache.

And the cache is stored in the file system, that is slower than the net.
If you check the Nginx results with 10.000 concurrent users, it's slower the optimized version than the default.

Can we optimise the config?
Of course, but without the cache.

I'll try to send PRs to optimize and fix miss configurations.

Conclusion

For me, the first results of this bench are completely useless.
And need to be notified with a big Appendix, till the next results.

@tylerjl I think you should update your article and mention about this point. Nginx defaults are very poor and Caddy have the best defaults ever seen for a web server. I found Nginx to be 20% faster on average than Caddy with lower memory consumption. I'll pick Caddy over Nginx for automatic tls handling though.