-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin,

On 3/22/12 1:18 PM, Martin Registe, Jr. wrote:
> How many *tomcat instances* do you have running ? And can you
> explain, in general terms, what you are trying to do ?
> 
> @Andre
> 
> I am trying to run two reduant tomcat instances that are each 
> running two reduant hosts on the same phyiscal server. I have 
> detailed it below.

Let me see if I've got this straight. You've got:

* A hw load-balancer out front
* 5 physical servers each running:
   - 1 Apache httpd
   - 2 Tomcats

This allows you to have physical-server redundancy (x5) and also the
ability to take one TC instance down on each server for maintenance
while leaving the other one running. Right?

I would argue that you should just take a whole server out of the lb
pool when you want to service it and not bother at all with httpd. If
your hw lb can't properly do stick-sessions, well then you'll still
have to have httpd involved but maybe you can eliminate one of the TC
instances per server by removing the one going down for maintenance
from the mod_jk worker pool.

Anyhow: your picture looks like this to me (hope the formatting
translates well):

    /- x.y.145.61 : httpd + 2x Tomcat
lb < - x.y.154.62 : httpd + 2x Tomcat
     ...
    \- x.y.154.65 : httpd + 2x Tomcat

First question: do all httpd instances know about all Tomcat
instances? Or, does httpd only know about the two instances that are
co-located with it on the same physical server?

If httpd knows about all Tomcat instances (x10), then you'll need
every httpd to have a workers.properties file with 10 workers defined
and all of them pooled. They all need distinct jvmRoutes.

If https only knows about its local 2 Tomcat instances, then you'll
only need 2 workers, etc. I have no idea how this could possibly work
with sticky sessions unless the hw lb knows how to dispatch to the
right http/2xTomcat physical server, in which case you are wasting
your time with all these extra processes.

> Then in the server.xml file OnTC1 for jvmRoute=jvm1 OnTC2 for
> jvmRoute=jvm2 And I have host entries for both in each server.xml 
> <Host name="10.17.75.145" appBase="webapps" unpackWARs="true"
> autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> 
> There are prameter and other stuff </Host>
> 
> <Host name="10.17.75.61" appBase="webapps" unpackWARs="true"
> autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> 
> There are parameters and other stuff </Host>

What about <Engine>? It would be nice to confirm that your jvmRoute(s)
is(are) set correctly.

> We have two redunant tomcat instances running on the same box.  So
> as long as there is not a problem on the physical server one of
> the tomcat instances will always be taking traffic.  There is a hw 
> loadbalancer that sits in front of all of this and there are 5
> other servers setup the same way the hw loadbalancer just directs
> traffic to the particular physical server where apache takes over.
> Each apache only works with its local (2)  tomcat instances.

That should have been the first thing you said.

If httpd only knows about its local 2 Tomcat instances, how do sticky
sessions work?

> In the workers.properties if I change .61 to 
> worker.jvm3.type=ajp13 worker.jvm3.host=10.17.75.61 
> worker.jvm3.port=8019 worker.jvm3.lbfactor=10
> 
> worker.jvm4.type=ajp13 worker.jvm4.host=10.17.75.61 
> worker.jvm4.port=8019 worker.jvm4.lbfactor=10
> 
> and add them to the lb setting worker.part.type=lb 
> worker.part.balance_workers=jvm1,jvm2,jvm3,jvm4 
> worker.part.sticky_session=1
> 
> will traffic get to right host?

That depends. The host should always be "localhost", since your httpd
instances only talk to the co-located Tomcats, right?

> Even though there is no jvmRoute for jvm3 and jvm4.

If httpd gets a request with a session id including a jvmroute, it
will attempt to locate the right worker and send the request to it. IF
you don't have a jvmRoute configured, then it won't work at all.

> I am trying to find a way, or prove that apache won't take a .61 
> request and send it to one of the .145 hosts or visa versa.

httpd will only send requests to Tomcat instances defined in
workers.properties. So, if you have 2 workers which are load-balanced,
you'll only be able to send traffic to those two workers.

You said this initially:

> My boss thinks that this is causing sessions to jump between the
> two ip addresses on the same jvm.

First, it shouldn't matter which IP address gets used since the
requests all go to the same place. Second, there's no reason to have a
hostname other than "localhost" when you are communicating between
httpd and Tomcat on the same physical server. Why bother with IP
addresses? Third, I would be more worried in your environment about
requests being served by a random httpd/2xTomcat team by your hw lb.

I'm totally confused, here.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9rhd4ACgkQ9CaO5/Lv0PBPgQCfTreX+vpBaKj03rN8ojsTWtOZ
m38Ani+KQRXxHGDesRHiuzSSqlYSzTtV
=5bSl
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to