-->

Session affinity on load balancer

2020-07-23 09:28发布

问题:

We have a situation, where we are talking to a set of app servers(B) directly from another application(A). Since both are within the same SAN, we are making the httpClient Call directly connecting to application servers(from A to B) . For scaling purposes, we have put a load balancer in between(httpclient requests from A to B), but we want to make the subsequent requests goto same JVM on application(B). Hence we are looking if we can configure session affinity on load balancer, if you have experiences or insight on how this problem can be solved please let me know.

回答1:

The most common way is to use a cookie like JSESSIONID to guide the load balancer.

With Apache + mod_proxy_balancer for example, define it like this:

ProxyPassMatch /.* balancer://mycluster stickysession=JSESSIONID|jsessionid