Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can one tomcat instance (with an ajp connector) be accessed by two different loadbalancers (httpd+mod_jk)?


share|improve this question
the goal of having Loadbalancers is to share (balance) load on multiple application/service nodes and not having a single node being available through multiple lb's – m0ntassar Aug 13 '12 at 9:10

Possible but futile, in fact completely pointless. The load balancers won't know about each other, so they will make wrong decisions about the load on the Tomcat in question, so they won't load-balance at all. Instead they will overload the shared Tomcat.

share|improve this answer
The idea is to have a primary loadbalancer and a backup one. Both would be running at the same time; but only the primary would be serving request. If it fails, a virtual IP would float to the backup LB. – pjwr Aug 14 '12 at 8:55

I guess that you're going to build Tomcat servers with high availability, something like this:

+------------+  (VIP)  +------------+
|  Apache 1  |---------|  Apache 2  |
+------------+         +------------+
        |(mod_jk)            |(mod_jk)
    |                             |
+-----------+            +-----------+   
| Tomcat 1  |            | Tomcat 2  |
+-----------+            +-----------+

If so, I'm pretty sure you can because at a momment, you'e working with only one LB via virtual IP.

share|improve this answer
That's exactly what i'm planning to do. But I'd like to have both HTTPd running all the time, so that there is no down time when the Apache1 fails and the IP floats to Apache2. – pjwr Aug 14 '12 at 8:59
Do it and let us know if you have any problem. The downtime ~ 10 seconds if you use a cluster management such as Pacemaker. – quanta Aug 14 '12 at 9:03
As a matter of fact, I've prototyped this architecture. It's been running for two weeks in our preproduction environment. No pb so far but maybe i've been lucky... I'd like some official reference saying that it's ok to do it; but couldn't find on Tomcat's site. – pjwr Aug 14 '12 at 9:09

I have several customers using Equalizer hardware load balancers in front of Apache/Tomcat in exactly this configuration. Does your application have any persistence requirements (Client must always be directed to the same server)? If yes, configuring the LBs persistence properly is the only potential issue I can see. You should be on safe ground.

share|improve this answer

Your Answer


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

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