I've seen that setting up load-balancing with nginx is pretty easy and i'd like to give it a try. My only concern is about sessions: how can I take advantage of nginx to route all the subsequent calls from a client to the same server to achieve session stickiness?
Thanks
As alternative you can look at Nginx Sticky Module
When dealing with several backend servers, it's sometimes useful that one client (browser) is always served by the same backend server (for session persistence for example).
Using a persistence by IP (with the ip_hash upstream module) is maybe not a good idea because there could be situations where a lot of different browsers are coming with the same IP address (behind proxies)and the load balancing system won't be fair.
Using a cookie to track the upstream server makes each browser unique.
When the sticky module can't apply, it switchs back to the classic Round Robin Upstream or returns a "Bad Gateway" (depending on the no_fallback flag).
Sticky module can't apply when cookies are not supported by the browser
use ip_hash directive
ip_hash is the loadbalance rule of nginx for session. However,the nginx server must get the real IP. if you use squid as the front server, then, the nginx server would get the IP of squid. Next, the nginx must direct the real server. If there are other loadbalancing servers after the nginx server, the session would not be send on the same real server.