วันพฤหัสบดีที่ 17 มกราคม พ.ศ. 2556

Tunning nginx worker process



From stackoverflow here : http://stackoverflow.com/questions/7325211/tuning-nginx-worker-process-to-obtain-100k-hits-per-min
worker_processes  4;  # 2*number of cpus
events {
    worker_connections  19000;  #it's the key to high performance - have a lot of coinnections available
}
worker_rlimit_nofile    20000;  #each connection needs a filehandle (or 2 if you are proxying)
keepalive_timeout  5;  #that' another key - close live connections as early as possible or disable them completely
#total amount of users you can serve in 1 second = worker_processes*worker_connections/keepalive_timeout

More info about nginx directive: http://blog.martinfjordvald.com/2011/04/optimizing-nginx-for-high-traffic-loads/