Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Nginx configuration isn't correct #5

Open
joanhey opened this issue Nov 10, 2022 · 1 comment
Open

The Nginx configuration isn't correct #5

joanhey opened this issue Nov 10, 2022 · 1 comment

Comments

@joanhey
Copy link

joanhey commented Nov 10, 2022

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.

@hj-collab
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants