You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by GIORGI Olivier <Ol...@3ds.com> on 2012/04/26 16:37:29 UTC

Load balancing & session affinity (QUERY)

Hello to all,

I am using Apache 2.2.21 & Tomcat 6.0.29

1) Schema: Load balancer (Apache.2.2.21) -> 1st appli (Tomcat 6.0.29)
-> 2nd appli. (Tomcat 6.0.29)

2) Using the following configuration, my load balancing is stateless instead of statefull (having a look at the logs).
-------------------------------------------------------------------------------------------------------------------------------------------------------------
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{UNIQUE_ID}e\" \"%{BALANCER_WORKER_ROUTE}e\"" logjyc
CustomLog logs/jyc_log logjyc
</IfModule>
ProxyPass /MCSRootURI balancer://MCSCluster stickysession=JSESSIONID nofailover=Off
<Proxy balancer://MCSCluster >
BalancerMember http://workstation1:MCSPort1/MCSRootURI route=host1
BalancerMember http://MCSServer2:MCSPort2/MCSRootURI route=host2
</Proxy>
ProxyPassReverse /MCSRootURI http://MCSServer1:MCSPort1/MCSRootURI
ProxyPassReverse /MCSRootURI http://MCSServer2:MCSPort2/MCSRootURI
-------------------------------------------------------------------------------------------------------------------------------------------------------------

3) Query
=> What have i missed on Apache or Tomcat side to get JSESSIONID taken into account then have a statefull load balancing ?

4) Bypass: using the following configuration my load balancing is this time statefull (having a look at the logs).
-------------------------------------------------------------------------------------------------------------------------------------------------------------
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{UNIQUE_ID}e\" \"%{BALANCER_WORKER_ROUTE}e\"" logjyc
CustomLog logs/jyc_log logjyc
</IfModule>
SetEnvIf ^Cookie$ "MYCOOKIE=([^ ;]*)" VARCOOKIE=$1
Header add Set-Cookie "MYCOOKIE=%{UNIQUE_ID}e.%{BALANCER_WORKER_ROUTE}e; path=/" env=!VARCOOKIE
ProxyPass /MCSRootURI balancer://MCSCluster stickysession=MYCOOKIE nofailover=Off
<Proxy balancer://MCSCluster >
BalancerMember http://MCSServer1:MCSPort1/MCSRootURI route=host1
BalancerMember http://MCSServer2:MCSPort2/MCSRootURI route=host2
</Proxy>
ProxyPassReverse /MCSRootURI http://MCSServer1:MCSPort1/MCSRootURI
ProxyPassReverse /MCSRootURI http://MCSServer2:MCSPort2/MCSRootURI
-------------------------------------------------------------------------------------------------------------------------------------------------------------

Thanks in advance for your help.
Best regards Olivier.


This email and any attachments are intended solely for the use of the individual or entity to whom it is addressed and may be confidential and/or privileged.

If you are not one of the named recipients or have received this email in error,

(i) you should not read, disclose, or copy it,

(ii) please notify sender of your receipt by reply email and delete this email and all attachments,

(iii) Dassault Systemes does not accept or assume any liability or responsibility for any use of or reliance on this email.

For other languages, go to http://www.3ds.com/terms/email-disclaimer

RE: Load balancing & session affinity (QUERY)

Posted by GIORGI Olivier <Ol...@3ds.com>.
Hello Derek,

Thank you for your fruitfull answer.

It works.

Best regards Olivier.

-----Original Message-----
From: Derek Beauregard [mailto:dbeauregard@vmware.com]
Sent: Thursday, April 26, 2012 5:59 PM
To: Tomcat Users List
Subject: Re: Load balancing & session affinity (QUERY)

Have you defined the jvmRoute on your Engine element in tomcat's
server.xml?

E.g., <Engine name="catalina" jvmRoute="host1"Š>

The value for jvmRoute should match the route defined in your apache
balancer config.

-Derek

Derek Beauregard



On 4/26/12 9:37 AM, "GIORGI Olivier" <Ol...@3ds.com> wrote:

>Hello to all,
>
>I am using Apache 2.2.21 & Tomcat 6.0.29
>
>1) Schema: Load balancer (Apache.2.2.21) -> 1st appli (Tomcat 6.0.29)
>-> 2nd appli. (Tomcat 6.0.29)
>
>2) Using the following configuration, my load balancing is stateless
>instead of statefull (having a look at the logs).
>--------------------------------------------------------------------------
>--------------------------------------------------------------------------
>---------
>ProxyRequests Off
><Proxy *>
>Order deny,allow
>Allow from all
></Proxy>
><IfModule log_config_module>
>LogFormat "%h %l %u %t \"%r\" %>s %b \"%{UNIQUE_ID}e\"
>\"%{BALANCER_WORKER_ROUTE}e\"" logjyc
>CustomLog logs/jyc_log logjyc
></IfModule>
>ProxyPass /MCSRootURI balancer://MCSCluster stickysession=JSESSIONID
>nofailover=Off
><Proxy balancer://MCSCluster >
>BalancerMember http://workstation1:MCSPort1/MCSRootURI route=host1
>BalancerMember http://MCSServer2:MCSPort2/MCSRootURI route=host2
></Proxy>
>ProxyPassReverse /MCSRootURI http://MCSServer1:MCSPort1/MCSRootURI
>ProxyPassReverse /MCSRootURI http://MCSServer2:MCSPort2/MCSRootURI
>--------------------------------------------------------------------------
>--------------------------------------------------------------------------
>---------
>
>3) Query
>=> What have i missed on Apache or Tomcat side to get JSESSIONID taken
>into account then have a statefull load balancing ?
>
>4) Bypass: using the following configuration my load balancing is this
>time statefull (having a look at the logs).
>--------------------------------------------------------------------------
>--------------------------------------------------------------------------
>---------
>ProxyRequests Off
><Proxy *>
>Order deny,allow
>Allow from all
></Proxy>
><IfModule log_config_module>
>LogFormat "%h %l %u %t \"%r\" %>s %b \"%{UNIQUE_ID}e\"
>\"%{BALANCER_WORKER_ROUTE}e\"" logjyc
>CustomLog logs/jyc_log logjyc
></IfModule>
>SetEnvIf ^Cookie$ "MYCOOKIE=([^ ;]*)" VARCOOKIE=$1
>Header add Set-Cookie "MYCOOKIE=%{UNIQUE_ID}e.%{BALANCER_WORKER_ROUTE}e;
>path=/" env=!VARCOOKIE
>ProxyPass /MCSRootURI balancer://MCSCluster stickysession=MYCOOKIE
>nofailover=Off
><Proxy balancer://MCSCluster >
>BalancerMember http://MCSServer1:MCSPort1/MCSRootURI route=host1
>BalancerMember http://MCSServer2:MCSPort2/MCSRootURI route=host2
></Proxy>
>ProxyPassReverse /MCSRootURI http://MCSServer1:MCSPort1/MCSRootURI
>ProxyPassReverse /MCSRootURI http://MCSServer2:MCSPort2/MCSRootURI
>--------------------------------------------------------------------------
>--------------------------------------------------------------------------
>---------
>
>Thanks in advance for your help.
>Best regards Olivier.
>
>
>This email and any attachments are intended solely for the use of the
>individual or entity to whom it is addressed and may be confidential
>and/or privileged.
>
>If you are not one of the named recipients or have received this email in
>error,
>
>(i) you should not read, disclose, or copy it,
>
>(ii) please notify sender of your receipt by reply email and delete this
>email and all attachments,
>
>(iii) Dassault Systemes does not accept or assume any liability or
>responsibility for any use of or reliance on this email.
>
>For other languages, go to http://www.3ds.com/terms/email-disclaimer


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

This email and any attachments are intended solely for the use of the individual or entity to whom it is addressed and may be confidential and/or privileged.

If you are not one of the named recipients or have received this email in error,

(i) you should not read, disclose, or copy it,

(ii) please notify sender of your receipt by reply email and delete this email and all attachments,

(iii) Dassault Systemes does not accept or assume any liability or responsibility for any use of or reliance on this email.

For other languages, go to http://www.3ds.com/terms/email-disclaimer

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


Re: Load balancing & session affinity (QUERY)

Posted by Derek Beauregard <db...@vmware.com>.
Have you defined the jvmRoute on your Engine element in tomcat's
server.xml?

E.g., <Engine name="catalina" jvmRoute="host1"Š>

The value for jvmRoute should match the route defined in your apache
balancer config.

-Derek

Derek Beauregard



On 4/26/12 9:37 AM, "GIORGI Olivier" <Ol...@3ds.com> wrote:

>Hello to all,
>
>I am using Apache 2.2.21 & Tomcat 6.0.29
>
>1) Schema: Load balancer (Apache.2.2.21) -> 1st appli (Tomcat 6.0.29)
>-> 2nd appli. (Tomcat 6.0.29)
>
>2) Using the following configuration, my load balancing is stateless
>instead of statefull (having a look at the logs).
>--------------------------------------------------------------------------
>--------------------------------------------------------------------------
>---------
>ProxyRequests Off
><Proxy *>
>Order deny,allow
>Allow from all
></Proxy>
><IfModule log_config_module>
>LogFormat "%h %l %u %t \"%r\" %>s %b \"%{UNIQUE_ID}e\"
>\"%{BALANCER_WORKER_ROUTE}e\"" logjyc
>CustomLog logs/jyc_log logjyc
></IfModule>
>ProxyPass /MCSRootURI balancer://MCSCluster stickysession=JSESSIONID
>nofailover=Off
><Proxy balancer://MCSCluster >
>BalancerMember http://workstation1:MCSPort1/MCSRootURI route=host1
>BalancerMember http://MCSServer2:MCSPort2/MCSRootURI route=host2
></Proxy>
>ProxyPassReverse /MCSRootURI http://MCSServer1:MCSPort1/MCSRootURI
>ProxyPassReverse /MCSRootURI http://MCSServer2:MCSPort2/MCSRootURI
>--------------------------------------------------------------------------
>--------------------------------------------------------------------------
>---------
>
>3) Query
>=> What have i missed on Apache or Tomcat side to get JSESSIONID taken
>into account then have a statefull load balancing ?
>
>4) Bypass: using the following configuration my load balancing is this
>time statefull (having a look at the logs).
>--------------------------------------------------------------------------
>--------------------------------------------------------------------------
>---------
>ProxyRequests Off
><Proxy *>
>Order deny,allow
>Allow from all
></Proxy>
><IfModule log_config_module>
>LogFormat "%h %l %u %t \"%r\" %>s %b \"%{UNIQUE_ID}e\"
>\"%{BALANCER_WORKER_ROUTE}e\"" logjyc
>CustomLog logs/jyc_log logjyc
></IfModule>
>SetEnvIf ^Cookie$ "MYCOOKIE=([^ ;]*)" VARCOOKIE=$1
>Header add Set-Cookie "MYCOOKIE=%{UNIQUE_ID}e.%{BALANCER_WORKER_ROUTE}e;
>path=/" env=!VARCOOKIE
>ProxyPass /MCSRootURI balancer://MCSCluster stickysession=MYCOOKIE
>nofailover=Off
><Proxy balancer://MCSCluster >
>BalancerMember http://MCSServer1:MCSPort1/MCSRootURI route=host1
>BalancerMember http://MCSServer2:MCSPort2/MCSRootURI route=host2
></Proxy>
>ProxyPassReverse /MCSRootURI http://MCSServer1:MCSPort1/MCSRootURI
>ProxyPassReverse /MCSRootURI http://MCSServer2:MCSPort2/MCSRootURI
>--------------------------------------------------------------------------
>--------------------------------------------------------------------------
>---------
>
>Thanks in advance for your help.
>Best regards Olivier.
>
>
>This email and any attachments are intended solely for the use of the
>individual or entity to whom it is addressed and may be confidential
>and/or privileged.
>
>If you are not one of the named recipients or have received this email in
>error,
>
>(i) you should not read, disclose, or copy it,
>
>(ii) please notify sender of your receipt by reply email and delete this
>email and all attachments,
>
>(iii) Dassault Systemes does not accept or assume any liability or
>responsibility for any use of or reliance on this email.
>
>For other languages, go to http://www.3ds.com/terms/email-disclaimer


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