upstream keepalive: call for testing
mdounin at mdounin.ru
Tue Aug 2 15:26:01 UTC 2011
On Tue, Aug 02, 2011 at 05:08:11PM +0200, Thomas Love wrote:
> On 29 July 2011 17:36, Maxim Dounin <mdounin at mdounin.ru> wrote:
> > With "keepalive 32;" you keep busy all of your 32 php processes
> > even if there are no active requests, and there are no processes
> > left to process listen queue.
> > On the other hand, nginx will still try to establish new
> > connection if there are no idle one sitting in connections cache
> > during request processing. Therefore some requests will enter
> > php's listen queue and have no chance to leave it. Eventually
> > listen queue will overflow.
> > Please also note that "keepalive 10;" means each nginx worker will
> > keep up to 10 connections. If you are running multiple workers
> > you may need to use lower number.
> Thanks for this. It's been running fine with keepalive 10 on four workers --
> is that because there is connection overlap? Am I risking a possibility of
> exhausting the 32 processes eventually?
With each worker keeping 10 connections 4 workers will be able to
keep 40, which is more than you have processes. I suggest it
works fine just because nginx is underloaded and most requests are
processed by one or two workers.
I would recommend setting something like "keepalive 5;" in your case.
More information about the nginx-devel