-
Notifications
You must be signed in to change notification settings - Fork 2k
aiohttp base nginx setup #9796
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
aiohttp base nginx setup #9796
Conversation
|
@Dreamsorcerer please review |
|
@joanhey @Dreamsorcerer Thanks for the review. I've applied the suggested fixes. |
|
Surprisingly, gunicorn outperforms nginx on my local machine.
nginx+aiohttpgunicorn
|
Something looks wrong there, it appears to be exactly double the performance. I wonder if there's something wrong with the load balancing? |
|
I'll try to double check the configuration, but any advice would be extremely useful to me. Locally I also tried to deploy using haproxy, results was better but still worse than gunicorn has. |
| keepalive_requests 10000000; | ||
|
|
||
| upstream aiohttp { | ||
| least_conn; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any difference in performance if we drop this and use the default round-robin? Guessing this isn't really needed given that requests should be around 1ms.
| done | ||
|
|
||
| cat >> /aiohttp/nginx.conf <<EOF | ||
| keepalive 32; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also wondering if this should be much higher? i.e. The aiohttp servers can handle many simultaneous connections.
With the above config, it might be that the workers are creating upto 65535 connections, of which 32 of them are allowed to be kept alive. So, we probably want this to be the same value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
65535 connections could also start slowing down the event loop, so also worth testing with lower numbers too, once these are aligned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried different options, someone helps but all of them insignificantly. So i decided to revert nginx as default proxy and keep it as separate docker file #9807
No description provided.