number of upstream definitions, and a suggestion

Gary Wilson Jr. gary.wilson at gmail.com
Sun Oct 2 22:11:59 UTC 2011


I currently have maybe a couple hundred upstream definitions but am
likely to grow to thousands.  Are there any practical or theoretical
limits to the number of upstream definitions that can exist in one
nginx instance?  Anyone out there making use of this many upstream
definitions?


On a side note, I think it would be cool if upstream identifiers could
be combined with port numbers so that a single upstream definition
that defined servers could be combined with multiple proxy_pass
definitions that only differ by port.  For example, a configuration
like this:

upstream app1 {
   server server1:port1;
   server server2:port1;
   server server3:port1;
}

upstream app2 {
   server server1:port2;
   server server2:port2;
   server server3:port2;
}
...

location /app1 { proxy_pass http://app1; }
location /app2 { proxy_pass http://app2; }
...

Could be replaced by a setup like this:

upstream cluster1 {
   server server1;
   server server2;
   server server3;
}

location /app1 { proxy_pass http://cluster1:port1; }
location /app2 { proxy_pass http://cluster1:port2; }
...

The latter would require 1 upstream definition and N proxy_pass
definitions instead of N upstream definitions (where the list of
servers doesn't change, only the port numbers) and N proxy_pass
definitions.

Thoughts?

Gary



More information about the nginx mailing list