11 messages in ru.sysoev.nginxTuning workers and connections
FromSent OnAttachments
Avleen VigJul 1, 2009 6:22 pm 
Gabriel RamugliaJul 1, 2009 7:39 pm 
Dave CheneyJul 1, 2009 10:42 pm 
Maxim DouninJul 2, 2009 2:55 am 
Avleen VigJul 2, 2009 6:57 am 
Avleen VigJul 2, 2009 7:00 am 
Michael ShadleJul 2, 2009 10:56 am 
Maxim DouninJul 2, 2009 11:19 am 
Michael ShadleJul 2, 2009 11:34 am 
Maxim DouninJul 2, 2009 12:04 pm 
Momchil IvanovJul 3, 2009 1:57 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Tuning workers and connectionsActions...
From:Avleen Vig (avl@gmail.com)
Date:Jul 1, 2009 6:22:43 pm
List:ru.sysoev.nginx

Hi folks, I have some questions about tuning nginx for best performance, on a site which handle ~1000 requests per second.

In our config, we have:

worker_processes 16; worker_rlimit_nofile 32768; events { worker_connections 8192; }

This is on a server with 8 CPU cores and 8Gb RAM. My understanding is that this should allow nginx to establish up to 32k network connections, because that is the limit of worker_rlimit_nofile. We serve very few files off the disk, maybe a dozen CSS and JS files. Everything else is handed to backends using proxy_pass. So with one fd for the browser, and one fd to the upstream, we should be able to handle 16k concurrent connections.

However what we're seeing, is that around 5k connections we get a performance hit. Connections slow down, take longer to establish, etc. The load on the box is almost zero, nginx is clearly working very fast and efficiently, but I'm not sure why it slows down. Any thoughts?

Also, I'm thinking about enabling the multi_accept option, but I couldn't find much documentation on how this works. It sounds like a high-performance tweak which we should be using if we get this many requests per second. Could it be that not using multi_accept is the problem? Nginx otherwise has to handle the incoming connection requests in serial and this is a bottleneck?

Thanks :)