Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am using apache server as a front end load balancer with tomcat6 servers. I am using lbmethod configuration for making all the requests from one client going to same tomcat always.

<VirtualHost *:1000>
ServerAdmin webmaster@dummy-host.example.co
#DocumentRoot /www/docs/dummy-host.example.com
ServerName dummy-host.example.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common

ProxyPass /balancer-manager  !
ProxyPass / balancer://mycluster/ lbmethod=byrequests nofailover=On
ProxyPassReverse / balancer://mycluster/

<Proxy balancer://mycluster>;
BalancerMember ajp://localhost:8101/ route=NodeA1000 retry=10
BalancerMember ajp://localhost:8102/ route=NodeB1000 retry=10
BalancerMember ajp://localhost:8103/ route=NodeC1000 retry=10
BalancerMember ajp://localhost:8104/ route=NodeD1000 retry=10
BalancerMember ajp://localhost:8105/ route=NodeE1000 retry=10

I have 5 tomcats in the back-end. But instead of all requests from the same client going to same tomcat, the requests are load-balanced. Am I missing anything here?

share|improve this question

migrated from stackoverflow.com Jun 8 '11 at 7:13

This question came from our site for professional and enthusiast programmers.

1 Answer 1

I agree this belongs on serverfault.com however, this might be helpful.

What you're getting is indeed standard behaviour. However, you're probably struggling with sessions. Read up on session clustering here: http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html

This makes sure sessions are shared amongst your tomcat instances.

Be sure to add distributable="true" to your context.xml files in the application you're deploying like so:

<Context path="/" debug="5" reloadable="true" crossContext="true" distributable="true">
share|improve this answer
Thanks. I think this approach will share the sessions to all the nodes. But i would like to have the same node to receive all the requests for one client –  shk Jun 7 '11 at 18:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.