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

I want to implement the load balancing in tomcat 6.0 so that we can create more than one instance of a tomcat and when any of the instance is down then other instance will run our application. so that our application will never be down even when the large number of concurrent request comes. But i have no idea to implement it. Please give your precious suggestions.

share|improve this question

migrated from stackoverflow.com Jun 6 '10 at 7:59

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

6 Answers 6

You can use mod_proxy or mod_jk to enable load balancing. See here for instructions.

share|improve this answer

There's a howto on their site - http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html I wish someone would explain Tomcat 6 config grrrrrrrrrrrrr

share|improve this answer

We use Piranha (it's more like package of various tools). It comes with RedHat Linux, but I think it should come with CentOS and Fedora, too. Of course, you can download a package anytime.

It is a load balancer combined with health checker, and with a GUI configuration interface.

Not sure if this can be used if your requests are stateful though.

share|improve this answer

It really depends. If you are going to have an Apache server doling out the request depending on the load, you'll want to use mod_jk or mod_proxy.

For mod_jk, here's the quick and dirty howto if you want to check if this will work:

http://tomcat.apache.org/connectors-doc/generic_howto/quick.html

Under your $apacheHome/workers.properties, for each tomcat server, add a worker entry with the name and AJP port, which described in each server's server.xml as a connector with usually port 8009.

Make sure you have the mod_jk library in your apache directory and modify your httpd.conf with the needed info from the link and you'll have load balancing after restarting. It doesn't matter which server starts up first.

There is also mod_proxy, but I'm not familiar with it. It does however look to be a nice alternative.

share|improve this answer

You have a choice between hardware (like Big F5) or software load balancers (Apache mod_proxy or mod_jk). For either case , you would need to choose the right set of configurations for performance, that are best suited for your setup.

share|improve this answer

If you use session for anything, you need to remember to either

  • a) use sticky load balancing, so that the first server a given user hits, they will keep hitting the same server

  • b) Enable session replication so each session is on all of the servers.

A is generally easier to do, but if a server crashes the user will be logged out of the application and have his workflow disrupted. B is a better solution, but won't scale out to as many servers.

share|improve this answer

Your Answer

 
discard

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