Conditional balancing

I am developing a webmail service where the user’s inbox and all
related session variables will be loaded to one of many application
servers which will be behind the balancer (running nginx). So, I need
nginx to direct all requests of a particular user, to a particular
application server. How can it be done?
One way, I think, is to integrate zookeeper into nginx as module, this
way nginx will communicate with the application daemon and always know
which appserver is holding user’s session and data. But this is a lot
of work, is there any other solution to do this sort of conditional
balancing ?

Thanks in advance
Nulik

Hello!

On Sun, Aug 04, 2013 at 03:43:16PM -0500, Nulik Nol wrote:

I am developing a webmail service where the user’s inbox and all
related session variables will be loaded to one of many application
servers which will be behind the balancer (running nginx). So, I need
nginx to direct all requests of a particular user, to a particular
application server. How can it be done?
One way, I think, is to integrate zookeeper into nginx as module, this
way nginx will communicate with the application daemon and always know
which appserver is holding user’s session and data. But this is a lot
of work, is there any other solution to do this sort of conditional
balancing ?

Trivial solution would be to use a cookie to specify backend
needed, and set the cookie during login.


Maxim D.
http://nginx.org/en/donation.html

essence of the other tow ansers:

http://dgtool.blogspot.de/2013/02/nginx-as-sticky-balancer-for-ha-using.html

you might want to google “nginx sticky sessions”

Posted at Nginx Forum:

Serverside cookies for session management tho itl be more of a static
Pre-determined mapping… Aka
Stickysessions


Payam C.
Network Engineer / Security Specialist