Skip to content


Loadbalancing Tomcat with Apache

I found myself in a situation where the load on one of our Tomcat instances was growing too high. I had other servers to share the load, but none could carry the load by themselves. I had being using Apache’s mod_proxy and I knew this was the time to check out mod_proxy_balancer.

I found this great resource, which gave me all the relevant information I needed: http://sihantech.wordpress.com/tag/using-mod_proxy-and-mod_proxy_balancer-in-apache/. Here’s my final setup inside an SSL VirtualHost:

ProxyPass /myApp/ balancer://JvmsInternal/ stickysession=JSESSIONID|jsessionid
<Proxy balancer://JvmsInternal>
BalancerMember ajp://192.0.0.101:8009/myApp/ loadfactor=1 route=jvm1 ttl=5 timeout=300
BalancerMember ajp://192.0.0.103:8009/myApp/ loadfactor=1 route=jvm2 ttl=5 timeout=300
</Proxy>
<Location /balancer-manager>
  SetHandler balancer-manager
  Order deny,allow
  Allow from 192.0.0
</Location>
Although some guides might omit the use of the jvmRoute parameter in Tomcat’s Engine tag in server.xml, sessions did not work without it. So be sure to put the same value for the jvmRoute parameter as for the route parameter on the mod_proxy_balancer.
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">

Posted in Apache.

Tagged with , .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.