简体   繁体   中英

Slightly sticky load-balancing with Apache and mod_proxy_balancer

We have a setup where we want sessions to be sticky most of the time, but where we want to be able to rebalance the traffic. For example, assume that only one back-end server is up. 100% of the users are routed to that server. When another server comes up we would like to rebalance the load 50%-50%. We are using Apache 2.4 with mod_proxy_balancer.

Sticky sessions are easy to setup using the JSESSIONID cookie, but they are too sticky - once a session has been assigned a route it keeps that route unless the route becomes invalid. It is also easy to configure round robin or other balancing schemes without stickiness and control the load for the different back-end servers dynamically, but if we change the load factor that has no effect for sessions configured as sticky except for new sessions and our users are typically logged in all day.

Is it possible to configure "slightly sticky" sessions with mod_proxy_balancer where a session is assigned the same route if nothing has changed, but where existing sessions can be rerouted as a result of a modified load factor or added server or using a command?

NGINX seems to support this with the ip-hash and hash balancing methods. Is there a solution for Apache?

You must configure tomcat instances with same route id as you did in BalancerMember.

Add a jvmRoute parameter in server.xml of Tomcat. This must be added in Engine name tag. Tomcat instance configured with 8080 port

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM