Plana, Richard schrieb:
Hi,

Thanks. Yes, if I can't share the session information between the
various instances of Tomcat, I'd rather make a session sticky to a node
in the load-balance pool.

So I tried giving a jvmRoute to each Tomcat instance. I'm a little
confused with the mod_proxy_balancer configuration, though. What I've
done so far is the following:

<Proxy balancer://mycluster>
        BalancerMember ajp://appserver1:8009/myapp max=10 smax=6 ttl=30
ping=120 route=jvm1
        BalancerMember ajp://appserver2:8009/myapp max=10 smax=6 ttl=30
ping=120 route=jvm2
</Proxy>
ProxyPass /myapp balancer://mycluster/
ProxyTimeout 60

From the browser client side, I can see the ".jvm[12]" being appended to
the JSESSIONID cookie, but it would still switch from one Tomcat to the
other, albeit less frequently.

What am I doing wrong?

So far, so good. You also need to tell mod_proxy_balancer, what the name of the URL parameter resp. Cookie is, which carries the routing information. I forgot about that (in mod_jk it is automatically the right for Java App Servers, mod_proxy is more flexible and you need to set it).

So add "stickysession=JSESSIONID|jsessionid" at the end of the ProxyPass line. See also the mod_proxy docs page, look out for stcikysession.

HTH

Rainer

Richard Plana

-----Original Message-----
From: Rainer Jung [mailto:[EMAIL PROTECTED] Sent: Friday, July 04, 2008 11:13 AM
To: Tomcat Users List
Subject: Re: mod_ajp and Load-Balancing Issue

Plana, Richard schrieb:
Hi,
I've two tomcat servers being proxied and load-balanced by httpd using

mod_ajp (using balancer:). However, it seems when the proxy switches from one server to another, the user session gets lost. Could people recommend a way to correct my setup for doing load-balancing with this scenario? Oddly enough, it seemed to have functioned well when using mod_jk.

If you don't want to replicate all sessions between your tomcat nodes,
then use stickyness in the load balancer. This means, once a session has
started for a user on some node, all further requests of the user
belonging to this session will be routed to the same node.

Give each Tomcat in server.xml a unique jvmRoute and then set the route
parameter to the value of the corresponding jvmRoute of the load
balancer member in your mod_proxy_balancer configuration. Look for route
in the mod_proxy documentation page.

Caution: the Tomcat instances need to have different jvmRoute values.

The principles in mod_jk are the same. At least you need to set the
jvmRoute. In mod_jk stickyness is the default, and the name of the
worker I the default route. So you might have been lucky to set your
jvmRoute to the worker names and that was sufficient in the mod_jk case.

Regards,

Rainer

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to