I have a simple web server configuration with Apache webserver and Tomcat. For instance we have 2 servers. I plan to scale up. Of course we will need a load balancing solution very soon. Should I be fronting Tomcat servers with Apache for load balancing or use something else?

Is there a reason I should use some external software like HaProxy for load balancing instead of the, say mod_proxy_http, for apache server? When you search for load balancing in Linux env. you find a lot of stuff for Haproxy but not for Apache server, why!?

thank you!


HAProxy uses a single process event based model whereas with something like Apache I believe you have thread based (mpm_worked) or process based (prefork). Assuming I am correct in that mod_proxy will still be based off threads or processes for each connection (I could be totally wrong about this one), that is going to take a lot more system resources when you get to higher load levels.

Also, from my personal experience something that is built to do something particular often excels at doing that one thing than more of a swiss-army knife solution. So for example with HAProxy you have various options about how keep-alive connections are handled between the clients and the load balancer and between the load balancer and the servers. I am not sure if something like mod_proxy will offer this sort of flexibility.

  • Thank you. I was just thinking of the same thing in your last phrase. It's just tempting to use Apache since we already have Tomcat. – code-gijoe Mar 28 '11 at 17:04
  • 1
    All of the StackExchange sites (including StackOverflow and ServerFault) are behind a single HAProxy instance. Also use HAProxy for rate limiting and other stuff -- hardly any load on the load balancers. – Kyle Brandt Mar 28 '11 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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