You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jaroslav Fikker <fi...@atlas.cz> on 2012/09/21 15:30:21 UTC

[users@httpd] Apache httpd + Tomcat - session affinity

Hello everybody,

I encountered problem with session affinity in combination Apache httpd 2.2.21 and Tomcat 7.0.23.0. I have next directives in httpd.conf file:

<Proxy balancer://PRED_CL01>
    BalancerMember ajp://smtt01:8023 route=PRED_TT01
    BalancerMember ajp://smtt02:8023 route=PRED_TT02
</Proxy>

ProxyPass /pred/ balancer://PRED_CL01/pred/ lbmethod=bytraffic maxattempts=1 stickysession=jsessionid|JSESSIONID nofailover=off

And next directives in Tomcat server.xml file:

    <Engine name="PRED" defaultHost="localhost" jvmRoute="PRED_TT01">
…
    <Connector allowTrace="false"
               backlog="16"
               connectionTimeout="30000"
               enableLookups="false"
               keepAliveTimeout="30000"
               maxPostSize="10485760"
               maxSavePostSize="4096"
               maxThreads="64"
               port="8023"
               protocol="AJP/1.3"
               proxyName="testportal "
               proxyPort="443"
               redirectPort="443"
               tcpNoDelay="true"
               tomcatAuthentication="false"
               URIEncoding="UTF-8"
               useIPVHosts="false">
    </Connector>

A also configured this LogFormat for Apache httpd:
LogFormat "%t %a %u  %{jsessionid}C %{Set-Cookie}o %{BALANCER_SESSION_STICKY}e %{BALANCER_SESSION_ROUTE}e %{BALANCER_WORKER_ROUTE}e %{BALANCER_ROUTE_CHANGED}e %s %Tsec %r %Bbytes" access

I can see in Apache httpd log file for example these rows:

[21/Sep/2012:15:02:04 +0200] 10.217.116.41 -  AA716816AFEAF58F93B552B3503B9D14.PRED_TT02 JSESSIONID=7381C948FE38E0912A10B8FE8A3DF5EE.PRED_TT01; Path=/pred/; Secure; HttpOnly - - PRED_TT01 1 200 4sec GET /pred/ HTTP/1.1 13081bytes
[21/Sep/2012:15:02:08 +0200] 10.217.116.41 -  7381C948FE38E0912A10B8FE8A3DF5EE.PRED_TT01 - - - PRED_TT02 1 200 0sec GET /pred/styles/application.css HTTP/1.1 7574bytes

>From these you can see that variables BALANCER_SESSION_STICKY and BALANCER_SESSION_ROUTE are empty. Result is that user requests migrate between two Tomcat servers (PRED_TT01 and PRED_TT02).

Do you have anyone any idea where could be the cause of problem? Thank you very much in advance.

Jarda F.

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


Re: [users@httpd] Apache httpd + Tomcat - session affinity

Posted by Jaroslav Fikker <fi...@atlas.cz>.
Hello.

I found the solution - problem was in stickysession=jsessionid|JSESSIONID. When I switch value to stickysession=JSESSIONID|jsessionid the session affinity is OK.

Jarda
______________________________________________________________
> Od: "Jaroslav Fikker" <fi...@atlas.cz>
> Komu: <us...@httpd.apache.org>, <us...@httpd.apache.org>
> Datum: 27.09.2012 09:26
> Předmět: Re: [users@httpd] Apache httpd + Tomcat - session affinity
>
>Hello Igor.
>
>Thank you very much for your tip. Unfortunately the behavior is the same with ProxyPassReverse statement. Do you have another recommendation?
>
>Jarda
>
>______________________________________________________________
>> Od: "Igor Cicimov" <ic...@gmail.com>
>> Komu: <us...@httpd.apache.org>
>> Datum: 24.09.2012 11:45
>> Předmět: Re: [users@httpd] Apache httpd + Tomcat - session affinity
>>
>>Missing ProxyPassReverse statement?
>>
>>Igor Cicimov
>>Sent from my Android tablet
>>On Sep 21, 2012 3:30 PM, "Jaroslav Fikker" <fi...@atlas.cz> wrote:
>>
>>> Hello everybody,
>>>
>>> I encountered problem with session affinity in combination Apache httpd
>>> 2.2.21 and Tomcat 7.0.23.0. I have next directives in httpd.conf file:
>>>
>>> <Proxy balancer://PRED_CL01>
>>>     BalancerMember ajp://smtt01:8023 route=PRED_TT01
>>>     BalancerMember ajp://smtt02:8023 route=PRED_TT02
>>> </Proxy>
>>>
>>> ProxyPass /pred/ balancer://PRED_CL01/pred/ lbmethod=bytraffic
>>> maxattempts=1 stickysession=jsessionid|JSESSIONID nofailover=off
>>>
>>> And next directives in Tomcat server.xml file:
>>>
>>>     <Engine name="PRED" defaultHost="localhost" jvmRoute="PRED_TT01">
>>> …
>>>     <Connector allowTrace="false"
>>>                backlog="16"
>>>                connectionTimeout="30000"
>>>                enableLookups="false"
>>>                keepAliveTimeout="30000"
>>>                maxPostSize="10485760"
>>>                maxSavePostSize="4096"
>>>                maxThreads="64"
>>>                port="8023"
>>>                protocol="AJP/1.3"
>>>                proxyName="testportal "
>>>                proxyPort="443"
>>>                redirectPort="443"
>>>                tcpNoDelay="true"
>>>                tomcatAuthentication="false"
>>>                URIEncoding="UTF-8"
>>>                useIPVHosts="false">
>>>     </Connector>
>>>
>>> A also configured this LogFormat for Apache httpd:
>>> LogFormat "%t %a %u  %{jsessionid}C %{Set-Cookie}o
>>> %{BALANCER_SESSION_STICKY}e %{BALANCER_SESSION_ROUTE}e
>>> %{BALANCER_WORKER_ROUTE}e %{BALANCER_ROUTE_CHANGED}e %s %Tsec %r %Bbytes"
>>> access
>>>
>>> I can see in Apache httpd log file for example these rows:
>>>
>>> [21/Sep/2012:15:02:04 +0200] 10.217.116.41 -
>>>  AA716816AFEAF58F93B552B3503B9D14.PRED_TT02
>>> JSESSIONID=7381C948FE38E0912A10B8FE8A3DF5EE.PRED_TT01; Path=/pred/; Secure;
>>> HttpOnly - - PRED_TT01 1 200 4sec GET /pred/ HTTP/1.1 13081bytes
>>> [21/Sep/2012:15:02:08 +0200] 10.217.116.41 -
>>>  7381C948FE38E0912A10B8FE8A3DF5EE.PRED_TT01 - - - PRED_TT02 1 200 0sec GET
>>> /pred/styles/application.css HTTP/1.1 7574bytes
>>>
>>> From these you can see that variables BALANCER_SESSION_STICKY and
>>> BALANCER_SESSION_ROUTE are empty. Result is that user requests migrate
>>> between two Tomcat servers (PRED_TT01 and PRED_TT02).
>>>
>>> Do you have anyone any idea where could be the cause of problem? Thank you
>>> very much in advance.
>>>
>>> Jarda F.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>
>>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>For additional commands, e-mail: users-help@httpd.apache.org
>
>

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


Re: [users@httpd] Apache httpd + Tomcat - session affinity

Posted by Jaroslav Fikker <fi...@atlas.cz>.
Hello Igor.

Thank you very much for your tip. Unfortunately the behavior is the same with ProxyPassReverse statement. Do you have another recommendation?

Jarda

______________________________________________________________
> Od: "Igor Cicimov" <ic...@gmail.com>
> Komu: <us...@httpd.apache.org>
> Datum: 24.09.2012 11:45
> Předmět: Re: [users@httpd] Apache httpd + Tomcat - session affinity
>
>Missing ProxyPassReverse statement?
>
>Igor Cicimov
>Sent from my Android tablet
>On Sep 21, 2012 3:30 PM, "Jaroslav Fikker" <fi...@atlas.cz> wrote:
>
>> Hello everybody,
>>
>> I encountered problem with session affinity in combination Apache httpd
>> 2.2.21 and Tomcat 7.0.23.0. I have next directives in httpd.conf file:
>>
>> <Proxy balancer://PRED_CL01>
>>     BalancerMember ajp://smtt01:8023 route=PRED_TT01
>>     BalancerMember ajp://smtt02:8023 route=PRED_TT02
>> </Proxy>
>>
>> ProxyPass /pred/ balancer://PRED_CL01/pred/ lbmethod=bytraffic
>> maxattempts=1 stickysession=jsessionid|JSESSIONID nofailover=off
>>
>> And next directives in Tomcat server.xml file:
>>
>>     <Engine name="PRED" defaultHost="localhost" jvmRoute="PRED_TT01">
>> …
>>     <Connector allowTrace="false"
>>                backlog="16"
>>                connectionTimeout="30000"
>>                enableLookups="false"
>>                keepAliveTimeout="30000"
>>                maxPostSize="10485760"
>>                maxSavePostSize="4096"
>>                maxThreads="64"
>>                port="8023"
>>                protocol="AJP/1.3"
>>                proxyName="testportal "
>>                proxyPort="443"
>>                redirectPort="443"
>>                tcpNoDelay="true"
>>                tomcatAuthentication="false"
>>                URIEncoding="UTF-8"
>>                useIPVHosts="false">
>>     </Connector>
>>
>> A also configured this LogFormat for Apache httpd:
>> LogFormat "%t %a %u  %{jsessionid}C %{Set-Cookie}o
>> %{BALANCER_SESSION_STICKY}e %{BALANCER_SESSION_ROUTE}e
>> %{BALANCER_WORKER_ROUTE}e %{BALANCER_ROUTE_CHANGED}e %s %Tsec %r %Bbytes"
>> access
>>
>> I can see in Apache httpd log file for example these rows:
>>
>> [21/Sep/2012:15:02:04 +0200] 10.217.116.41 -
>>  AA716816AFEAF58F93B552B3503B9D14.PRED_TT02
>> JSESSIONID=7381C948FE38E0912A10B8FE8A3DF5EE.PRED_TT01; Path=/pred/; Secure;
>> HttpOnly - - PRED_TT01 1 200 4sec GET /pred/ HTTP/1.1 13081bytes
>> [21/Sep/2012:15:02:08 +0200] 10.217.116.41 -
>>  7381C948FE38E0912A10B8FE8A3DF5EE.PRED_TT01 - - - PRED_TT02 1 200 0sec GET
>> /pred/styles/application.css HTTP/1.1 7574bytes
>>
>> From these you can see that variables BALANCER_SESSION_STICKY and
>> BALANCER_SESSION_ROUTE are empty. Result is that user requests migrate
>> between two Tomcat servers (PRED_TT01 and PRED_TT02).
>>
>> Do you have anyone any idea where could be the cause of problem? Thank you
>> very much in advance.
>>
>> Jarda F.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
>

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


Re: [users@httpd] Apache httpd + Tomcat - session affinity

Posted by Igor Cicimov <ic...@gmail.com>.
Missing ProxyPassReverse statement?

Igor Cicimov
Sent from my Android tablet
On Sep 21, 2012 3:30 PM, "Jaroslav Fikker" <fi...@atlas.cz> wrote:

> Hello everybody,
>
> I encountered problem with session affinity in combination Apache httpd
> 2.2.21 and Tomcat 7.0.23.0. I have next directives in httpd.conf file:
>
> <Proxy balancer://PRED_CL01>
>     BalancerMember ajp://smtt01:8023 route=PRED_TT01
>     BalancerMember ajp://smtt02:8023 route=PRED_TT02
> </Proxy>
>
> ProxyPass /pred/ balancer://PRED_CL01/pred/ lbmethod=bytraffic
> maxattempts=1 stickysession=jsessionid|JSESSIONID nofailover=off
>
> And next directives in Tomcat server.xml file:
>
>     <Engine name="PRED" defaultHost="localhost" jvmRoute="PRED_TT01">
> …
>     <Connector allowTrace="false"
>                backlog="16"
>                connectionTimeout="30000"
>                enableLookups="false"
>                keepAliveTimeout="30000"
>                maxPostSize="10485760"
>                maxSavePostSize="4096"
>                maxThreads="64"
>                port="8023"
>                protocol="AJP/1.3"
>                proxyName="testportal "
>                proxyPort="443"
>                redirectPort="443"
>                tcpNoDelay="true"
>                tomcatAuthentication="false"
>                URIEncoding="UTF-8"
>                useIPVHosts="false">
>     </Connector>
>
> A also configured this LogFormat for Apache httpd:
> LogFormat "%t %a %u  %{jsessionid}C %{Set-Cookie}o
> %{BALANCER_SESSION_STICKY}e %{BALANCER_SESSION_ROUTE}e
> %{BALANCER_WORKER_ROUTE}e %{BALANCER_ROUTE_CHANGED}e %s %Tsec %r %Bbytes"
> access
>
> I can see in Apache httpd log file for example these rows:
>
> [21/Sep/2012:15:02:04 +0200] 10.217.116.41 -
>  AA716816AFEAF58F93B552B3503B9D14.PRED_TT02
> JSESSIONID=7381C948FE38E0912A10B8FE8A3DF5EE.PRED_TT01; Path=/pred/; Secure;
> HttpOnly - - PRED_TT01 1 200 4sec GET /pred/ HTTP/1.1 13081bytes
> [21/Sep/2012:15:02:08 +0200] 10.217.116.41 -
>  7381C948FE38E0912A10B8FE8A3DF5EE.PRED_TT01 - - - PRED_TT02 1 200 0sec GET
> /pred/styles/application.css HTTP/1.1 7574bytes
>
> From these you can see that variables BALANCER_SESSION_STICKY and
> BALANCER_SESSION_ROUTE are empty. Result is that user requests migrate
> between two Tomcat servers (PRED_TT01 and PRED_TT02).
>
> Do you have anyone any idea where could be the cause of problem? Thank you
> very much in advance.
>
> Jarda F.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>