[PATCH]upstream server directive support variable

Maxim Dounin mdounin at mdounin.ru
Sun Jun 2 11:33:34 UTC 2013


On Sun, Jun 02, 2013 at 09:34:58AM +0800, flygoast wrote:

> Hi, guys
> In my business, I need dynamicly  to find the backend ip address 
> according to the request. However, I also want to use the 
> upstream to take advantage of load balance. So I add the 
> variable support in server directive. For sake of avoiding 
> blocking the whole worker due to resolving domain, at present, 
> only dotted decimal  IP address should be parsed in
> the variables. Anyone can help to check or improve it? Thanks. 

Load balancing requires a state for a group of servers to be kept 
between requests.  This somewhat contradicts an idea of 
dynamically finding a backend's ip address for each request - 
instead of balancing backends the code will balance backend 

Have you tried dynamically finding an upstream{} block name 
instead, and configuring appropriate upstream{} blocks?  This is 
available out of the box.

Maxim Dounin

More information about the nginx-devel mailing list