Home > Uncategorized > Load Balancing and Failover for Tomcat using the Apache HTTP Server

Load Balancing and Failover for Tomcat using the Apache HTTP Server

October 6th, 2009

Here just some collected thougths and links about load balancing and failover for tomcat instances. I’ll only look at options using an apache http server as frontend. I’m sure other proxy/load-balancers like nginx or haproxy are performing better as proxys, but they don’t provide the same level of intergration with tomcat (also based on this blogpost).

So, whats there:

  • mod_jk
  • mod_jk2 (just for completeness, its said that nobody works on mod_jk2 anymore )
  • combination of mod_proxy, mod_proxy_ajp (or mod_proxy ajp) and mod_proxy_balancer
  • the newcomers, also with mod_proxy:
    • mod_cluster
    • mod_heartmonitor

What to use, and how:

  1. The basic setup using mod_jk as described here for example. This already provides failover and simple load balancing.
  2. Another approach, using mod_proxy, mod_proxy_ajp and mod_proxy_balancer is described in this blogpost.

Ok, stop here, what are the differences, this blogpost tries to explain. To conclude, both seem to do a good job, choice is mostly a matter of taste and preferences.

Interesting about using mod_proxy balancer seems the possibility to choose beetween more advanced load balancing algorithms, like the combination of mod_heartmonitor and mod_lbmethod_heartbeat coming up with apache 2.3. An example of configuration for building your “dynamic cluster” with it can be found here.

mod_cluster is already released and seems to offer basic support for usage with tomcat, but the advanced features seem to be only usable with jboss (link).

Comments are closed.