nginx+uwsgi+python2.7 come up with a bottleneck that can not pass 20000x40000 benchmarking
i'm coming up with a bottleneck that my server can't pass a 20000x40000 benchmark test no matter what adjustments i made. the server have 128G Ram and with an Xeon 6 core cpu, centos5.6-64bit, in a good shape.开发者_开发技巧
i try combinations including:
nginx + uwsgi + python2.7
nginx + apache + mod_wsgi + python2.7
apache + mod_wsgi + python2.7
none of them could make through the apache benchmarking:
ab -c 20000 -n 40000 (without -k)
and coincidentally, almost all tests failed around 32000 requests
detail about nginx and uwsgi:
nginx:
worker_processes 24
use epoll
worker_connections 65535
uwsgi:
listen 2048
master true
workers 24
uwsgi -x /etc/uwsgi_conf.xml --async 256 --file /var/www/example.py &
anybody have any idea about it? thanks in advance to any possible solutions and suggestions
Allowing such amount of concurrent connections on a single system requires a huge list of kernel tuning and probably you will never be able to manage such load in production.
First of all you have to increase the number of ephemeral port, the socket backlog queue, the number of allowed file descriptor per process and so on...
In addition to this (that should be already enough to stop such unrealistic test) you should increase the number of async core in uWSGI to 20k. Nothing wrong with taht (each core consume less than a page of memory), but you will end with at least 40k opened socket in your system.
This is for nginx+uwsgi.
With Apache you will end with 20k processes or threads, which is even worse than the 40k opened sockets.
精彩评论