# Number of upstream definitions, and a suggestion

**URL:** <https://www.ruby-forum.com/t/number-of-upstream-definitions-and-a-suggestion/212435>\
**Category:** NGINX\
**Created:** [October 3, 2011, 12:12am UTC](https://www.ruby-forum.com/t/number-of-upstream-definitions-and-a-suggestion/212435 "2011-10-03T00:12:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [October 3, 2011, 12:12am UTC](https://www.ruby-forum.com/t/number-of-upstream-definitions-and-a-suggestion/212435/1 "2011-10-03T00:12:38Z")

</div>

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](http://app1); }  
location /app2 { proxy\_pass [http://app2](http://app2); }  
…

Could be replaced by a setup like this:

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

location /app1 { proxy\_pass [http://cluster1](http://cluster1):port1; }  
location /app2 { proxy\_pass [http://cluster1](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
