How can nginx supports more than 64511 concurrent backend connections?

Hello nginx fans,

I’m using nginx (with ngx_redis2 module) as a redis client, and would
like to establish more than 64511 keep alive connections with a redis
instance. The local port range of Linux is limited to 64511, so I’d like
to set up multiple ip addresses for nginx machine, but I don’t know how
to tell nginx to bind local port on multiple ip addresses. Anyone has
the experience? Thanks in advance.

Posted at Nginx Forum:

On Tue, 2012-05-22 at 04:05 -0400, diogin wrote:

Hello nginx fans,

I’m using nginx (with ngx_redis2 module) as a redis client, and would
like to establish more than 64511 keep alive connections with a redis
instance. The local port range of Linux is limited to 64511, so I’d like
to set up multiple ip addresses for nginx machine, but I don’t know how
to tell nginx to bind local port on multiple ip addresses. Anyone has
the experience? Thanks in advance.

You could also give the redis instance multiple IP addresses and then
put those instances in an upstream block so Nginx will round-robin them.

The port limitation is 64K per address pair (local, remote), so you
can add IP’s on either side to get the same effect.

Cliff