Tuning upstream keepalive parameter

Maxim Dounin mdounin at mdounin.ru
Thu Nov 5 13:19:09 UTC 2015


Hello!

On Thu, Nov 05, 2015 at 12:55:36AM -0500, CJ Ess wrote:

> So I'm looking for some advice on determining an appropriate number for the
> keepalive parameter within an upstream stanza.
> 
> They server processes ~3000 requests per second, and haproxy is the single
> upstream destination. Dividing by the request rate by the number of
> processors (workers) I'm thinking that maybe 256 is a good starting number
> for the max keepalives.
> 
> Is that realistic? Or should I be looking at a fraction of that number?

Number of requests per second processed is mostly irrelevant.  Two 
important numbers are:

- How many connections your upstream servers can handle.  It's a good 
  idea to don't exhaust all available connections with keepalive 
  ones.

- How many connections are used under normal load and/or during 
  load spikes.  That is, how many simultaneous requests are 
  executed on upstream servers.  It make sense to keep comparable 
  number of connections alive to handle load fluctuations.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list