Friday, January 28, 2011

Apache, Tomcat and mod_jk for load balancing

Hi guys.

I've set-up a basic Apache (2.2.x) and Tomcat (6.0.x) set-up using mod_jk for load balancing using the worker.properties file. Preliminary testing seems to show that this works relatively well, and it was quite easy to set-up.

However; the fact that it was so easy to set-up has got me a little worried. We're dealing with 100 - 300 concurrent users using the same web application (deployed on 2 or 3 Tomcat instances). I have done a little Googling and looking around on here and there seems to be more than 1 way to accomplish this (one example on here used a balancer:// style URL, which I've never seen before in an Apache config). For example, one question I ask myself is how reliable the load detection on mod_jk really is (Busyness, Session, Request, etc).

In your experience, does this set-up prove to be reliable in real world scenarios? Any pointers on improvements, pit falls or interesting literature/articles?

I've worked with Apache before, but am in no way an expert.

Thanks in advance.

  • "balancer://" is used by apache mod_proxy_balancer and probably with mod_proxy_ajp who is another way to connect apache to tomcat ajp than mod_jk.

    I can't tell you a lot on the load detection reliability but I learned this from my experience :

    • Read carrefully the mod_jk directives manual
    • Check the timeout parameters, this is very important. Default infinite "reply_timeout" is very bad: if a tomcat is dead apache will keep threads busy and you can be flooded.
    • Read the mod_jk logs to look for errors
    • Let apache handle directly static content with JkUnMount directive to give tomcat only needed requests.
    • Use apache mod_cache if possible
    • Use the mod_jk watch page to check what is happening on your connectors.

    An article on mod_jk/proxy-ajp: http://thoughts.contegix.com/2009/02/02/mod-proxy-ajp-versus-mod-jk-round-1/

    From Toubib

0 comments:

Post a Comment