Why set keepalive_timeout to a short period when Nginx is great at handling them?
Valentin V. Bartenev
vbart at nginx.com
Sun Jun 19 13:36:18 UTC 2016
On Sunday 19 June 2016 16:06:56 Aahan Krish wrote:
> Hi Valentin,
> *(I repeat the same question I put to B.R. as you raised the same
> So you are referring to the 4-tuple (source_IP, source_port,
> server_IP, server_port) socket limitation, correct? I just came to
> know about this and it's interesting. Please tell me if this
> understanding of mine is correct:
> So a server identifies a user's connection based on a combination
> of: user's internet connection's IP + port the user's client is
> connecting from (e.g. Chrome on 8118, IE on 8080, etc.) +
> server IP + server_port (80 for HTTP / 443 for HTTPS).
> And the limitation is that a maximum of ~ 65536 clients all on
> same port (say all are using Chrome and therefore connecting from
> 8118) can connect simultaneously to a web server that is connectedl
> to the internet via 1 public IP address and port 80 (let's say
> HTTP only), IFF the resources of the server permit.
> And that means I can double the no. of connections (2x 65536 per
> second) my server can handle, if it has enough resources in the
> first place (i.e. sufficient RAM, CPU, I/O capacity or whatever
> is relevant) by simply adding another public IP address to my
> server and making sure that the traffic is load-balanced between
> the two public IPs of the server.
> Am I correct?
No, first of all, there's no limitation of 65535 clients.
1. Clients usually use different IPs, so one element of 4-tuple already
Even if they are behind NAT, that only limits number of connections
from one public IP of that gateway, not all clients of your server.
2. Chrome, IE, etc. don't use the same port each time for outgoing
wbr, Valentin V. Bartenev
More information about the nginx