You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Carlos García <ca...@digibis.com> on 2018/06/30 08:12:19 UTC

Sticky sessions not working at get_most_suitable_worker

Hello.



I' m working on a LB configuration with  Apache/2.4.18 (Ubuntu) mod_jk/1.2.41 and not getting wanted results.


My workers config is:


worker.list=balanceFFG, jk-status
# tomcat-pro-03 por COLT
worker.FFG1.host=tomcat-pro-03
worker.FFG1.port=8009
worker.FFG1.type=ajp13
worker.FFG1.sticky_session=true

# tomcat-pro-06 por COLT
worker.FFG2.host=tomcat-pro-06
worker.FFG2.port=8010
worker.FFG2.type=ajp13
worker.FFG2.sticky_session=true

worker.balanceFFG.type=lb
worker.balanceFFG.balance_workers=FFG1, FFG2
worker.jk-status.type=status

VirtualHost config is:

  Header edit Set-Cookie "^(.*; Path=)/ffgonzalezarch_pro/?(.*)" $1/$2
  RewriteEngine on
  RewriteRule ^(.*)$ /ffgonzalezarch_pro$1 [PT,L]
  RewriteRule ^(.*)$ /ffgonzalezarch_pro/$1 [CO]

  JkMount /ffgonzalezarch_pro/* balanceFFG


jvmRoute set in Engine section in Tomcat server.xml

And finally, this is the result in mod_jk debug log:


[Sat Jun 30 06:52:29.565 2018] [6628:139806621300480] [debug] service::jk_lb_worker.c (1270): service sticky_session=1 id='7E9778933D54A11F3D91B9AF81653C53.tomcat-pro-06'
[Sat Jun 30 06:52:29.565 2018] [6628:139806621300480] [debug] get_most_suitable_worker::jk_lb_worker.c (1078): searching worker for partial sessionid 7E9778933D54A11F3D91B9AF81653C53.tomcat-pro-06
 [Sat Jun 30 06:52:29.565 2018] [6628:139806621300480] [debug] get_most_suitable_worker::jk_lb_worker.c (1086): searching worker for session route tomcat-pro-06
[Sat Jun 30 06:52:29.565 2018] [6628:139806621300480] [debug] get_most_suitable_worker::jk_lb_worker.c (1136): found best worker FFG1 (FFG1) using method 'Request'

So, a session from FFG2(omcat-pro-06) ends in FFG1(tomcat-pro-03). Why!! Sessionid is telling you FFG2(omcat-pro-06)!!

Thanks for help!


Re: Sticky sessions not working at get_most_suitable_worker

Posted by Carlos García <ca...@digibis.com>.
Thanks Chirs, you are right. I've changed jvmRoute to worker's name, not worker's hostname, and it's working fine.


Thanks, again.


Carlos

________________________________
De: Christopher Schultz <ch...@christopherschultz.net>
Enviado: sábado, 30 de junio de 2018 22:04:21
Para: Tomcat Users List; Carlos García
Asunto: Re: Sticky sessions not working at get_most_suitable_worker

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Carlos,

On 6/30/18 4:12 AM, Carlos García wrote:
> I' m working on a LB configuration with Apache/2.4.18 (Ubuntu)
> mod_jk/1.2.41 and not getting wanted results.
>
>
> My workers config is:
>
>
> worker.list=balanceFFG, jk-status # tomcat-pro-03 por COLT
> worker.FFG1.host=tomcat-pro-03 worker.FFG1.port=8009
> worker.FFG1.type=ajp13 worker.FFG1.sticky_session=true
>
> # tomcat-pro-06 por COLT worker.FFG2.host=tomcat-pro-06
> worker.FFG2.port=8010 worker.FFG2.type=ajp13
> worker.FFG2.sticky_session=true
>
> worker.balanceFFG.type=lb worker.balanceFFG.balance_workers=FFG1,
> FFG2 worker.jk-status.type=status

Thank you for posting your configuration.

You need to set the sticky_session attribute on the *balancer* and not
on the individual workers, although the default value for
"sticky_session" is in fact "true", so this should not matter.

If you look at your mod_jk log file, does it say that sticky_session
isn't valid for a normal AJP13 worker? (It really should if it doesn't.)

> VirtualHost config is:
>
> Header edit Set-Cookie "^(.*; Path=)/ffgonzalezarch_pro/?(.*)"
> $1/$2

What is *this* for?  ^^^^

> RewriteEngine on RewriteRule ^(.*)$ /ffgonzalezarch_pro$1 [PT,L]
> RewriteRule ^(.*)$ /ffgonzalezarch_pro/$1 [CO]
>
> JkMount /ffgonzalezarch_pro/* balanceFFG
>
>
> jvmRoute set in Engine section in Tomcat server.xml

What did you set it/them to?

> And finally, this is the result in mod_jk debug log:
>
>
> [Sat Jun 30 06:52:29.565 2018] [6628:139806621300480] [debug]
> service::jk_lb_worker.c (1270): service sticky_session=1
> id='7E9778933D54A11F3D91B9AF81653C53.tomcat-pro-06' [Sat Jun 30
> 06:52:29.565 2018] [6628:139806621300480] [debug]
> get_most_suitable_worker::jk_lb_worker.c (1078): searching worker
> for partial sessionid
> 7E9778933D54A11F3D91B9AF81653C53.tomcat-pro-06 [Sat Jun 30
> 06:52:29.565 2018] [6628:139806621300480] [debug]
> get_most_suitable_worker::jk_lb_worker.c (1086): searching worker
> for session route tomcat-pro-06 [Sat Jun 30 06:52:29.565 2018]
> [6628:139806621300480] [debug]
> get_most_suitable_worker::jk_lb_worker.c (1136): found best worker
> FFG1 (FFG1) using method 'Request'
>
> So, a session from FFG2(omcat-pro-06) ends in FFG1(tomcat-pro-03).
> Why!! Sessionid is telling you FFG2(omcat-pro-06)!!

It looks like you have set jvmRoute to "tomcat-pro-06" and
"tomcat-pro-03" but the worker's route names default to the worker
names (FFG1, FFG2). So, you either need this in workers.properties:

worker.FFG1.route=tomcat-pro-03
and
worker.FFG2.route=tomcat-pro-06

or you need this in conf/server.xml

<Engine name="Catalina" defaultHost="localhost" jvmRoute="FFG1">
and
<Engine name="Catalina" defaultHost="localhost" jvmRoute="FFG2">

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAls34kQACgkQHPApP6U8
pFhJRw/+JWWNWq4Vp+dMGo6YmeTcYJfRdaUiIjw3vCZxl8fDh9UBGufvQO44I1QO
RuH0X155zb0csN3THWyA15pWicFLt3XNdjZIzy9X3J2K7E366wD7GJtmP/bm+ua8
LaEkwx/Iu2jADWn/FRl6k58m+xXk9LUWWpLw0YJGE2Go/PXFM9ZAsBLHi9sdPQlW
xAotxkqopP4lx5CGtUARRP66cygsQQltUKbLyUhwnP4gKJgN27hw+mRuSf86H+Kh
2aXJSdDHkulgdFOBauZzVzUgctAcDi0vkxzjLmHApgCTUzQ5KHu8ChqZstOR4jaO
h3g0QJzuvcGmtlZfCJte6U2YhoCgDVgIaN106BnJ1UlFICqmvi8leERTG5Da1Blx
HbTi1sVxytYhm/troPNgTAnnYGRDQqtPxuFq33jZHHvHGZvSGbZYxPtb8bqTL+x6
x1vB5jhqC5mmA5on/UG+B6Xzb12BbaluJ8TLkd/HW4MiiLnX04/nkCsw2WaZAqee
TJLg7cIBMeNM3H7EPlghuN9FnGeTnZgD5xRmJZOCGXvtp3DPT0JbE5I56nj0oowQ
SD9qzoMDE+krdwz5B+0ZtXql/GixEsxW3S/szUQO6e2Z4YdrliHlaWnWTh9d6ezg
rDxkPWrYCBOOe3XO6nSqKsgehCdZgv5yqdG3AZeRIE9eSZ+aXRs=
=IF98
-----END PGP SIGNATURE-----

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


Re: Sticky sessions not working at get_most_suitable_worker

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Carlos,

On 6/30/18 4:12 AM, Carlos García wrote:
> I' m working on a LB configuration with Apache/2.4.18 (Ubuntu) 
> mod_jk/1.2.41 and not getting wanted results.
> 
> 
> My workers config is:
> 
> 
> worker.list=balanceFFG, jk-status # tomcat-pro-03 por COLT 
> worker.FFG1.host=tomcat-pro-03 worker.FFG1.port=8009 
> worker.FFG1.type=ajp13 worker.FFG1.sticky_session=true
> 
> # tomcat-pro-06 por COLT worker.FFG2.host=tomcat-pro-06 
> worker.FFG2.port=8010 worker.FFG2.type=ajp13 
> worker.FFG2.sticky_session=true
> 
> worker.balanceFFG.type=lb worker.balanceFFG.balance_workers=FFG1,
> FFG2 worker.jk-status.type=status

Thank you for posting your configuration.

You need to set the sticky_session attribute on the *balancer* and not
on the individual workers, although the default value for
"sticky_session" is in fact "true", so this should not matter.

If you look at your mod_jk log file, does it say that sticky_session
isn't valid for a normal AJP13 worker? (It really should if it doesn't.)

> VirtualHost config is:
> 
> Header edit Set-Cookie "^(.*; Path=)/ffgonzalezarch_pro/?(.*)"
> $1/$2

What is *this* for?  ^^^^

> RewriteEngine on RewriteRule ^(.*)$ /ffgonzalezarch_pro$1 [PT,L] 
> RewriteRule ^(.*)$ /ffgonzalezarch_pro/$1 [CO]
> 
> JkMount /ffgonzalezarch_pro/* balanceFFG
> 
> 
> jvmRoute set in Engine section in Tomcat server.xml

What did you set it/them to?

> And finally, this is the result in mod_jk debug log:
> 
> 
> [Sat Jun 30 06:52:29.565 2018] [6628:139806621300480] [debug]
> service::jk_lb_worker.c (1270): service sticky_session=1
> id='7E9778933D54A11F3D91B9AF81653C53.tomcat-pro-06' [Sat Jun 30
> 06:52:29.565 2018] [6628:139806621300480] [debug]
> get_most_suitable_worker::jk_lb_worker.c (1078): searching worker
> for partial sessionid
> 7E9778933D54A11F3D91B9AF81653C53.tomcat-pro-06 [Sat Jun 30
> 06:52:29.565 2018] [6628:139806621300480] [debug]
> get_most_suitable_worker::jk_lb_worker.c (1086): searching worker
> for session route tomcat-pro-06 [Sat Jun 30 06:52:29.565 2018]
> [6628:139806621300480] [debug]
> get_most_suitable_worker::jk_lb_worker.c (1136): found best worker
> FFG1 (FFG1) using method 'Request'
> 
> So, a session from FFG2(omcat-pro-06) ends in FFG1(tomcat-pro-03).
> Why!! Sessionid is telling you FFG2(omcat-pro-06)!!

It looks like you have set jvmRoute to "tomcat-pro-06" and
"tomcat-pro-03" but the worker's route names default to the worker
names (FFG1, FFG2). So, you either need this in workers.properties:

worker.FFG1.route=tomcat-pro-03
and
worker.FFG2.route=tomcat-pro-06

or you need this in conf/server.xml

<Engine name="Catalina" defaultHost="localhost" jvmRoute="FFG1">
and
<Engine name="Catalina" defaultHost="localhost" jvmRoute="FFG2">

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAls34kQACgkQHPApP6U8
pFhJRw/+JWWNWq4Vp+dMGo6YmeTcYJfRdaUiIjw3vCZxl8fDh9UBGufvQO44I1QO
RuH0X155zb0csN3THWyA15pWicFLt3XNdjZIzy9X3J2K7E366wD7GJtmP/bm+ua8
LaEkwx/Iu2jADWn/FRl6k58m+xXk9LUWWpLw0YJGE2Go/PXFM9ZAsBLHi9sdPQlW
xAotxkqopP4lx5CGtUARRP66cygsQQltUKbLyUhwnP4gKJgN27hw+mRuSf86H+Kh
2aXJSdDHkulgdFOBauZzVzUgctAcDi0vkxzjLmHApgCTUzQ5KHu8ChqZstOR4jaO
h3g0QJzuvcGmtlZfCJte6U2YhoCgDVgIaN106BnJ1UlFICqmvi8leERTG5Da1Blx
HbTi1sVxytYhm/troPNgTAnnYGRDQqtPxuFq33jZHHvHGZvSGbZYxPtb8bqTL+x6
x1vB5jhqC5mmA5on/UG+B6Xzb12BbaluJ8TLkd/HW4MiiLnX04/nkCsw2WaZAqee
TJLg7cIBMeNM3H7EPlghuN9FnGeTnZgD5xRmJZOCGXvtp3DPT0JbE5I56nj0oowQ
SD9qzoMDE+krdwz5B+0ZtXql/GixEsxW3S/szUQO6e2Z4YdrliHlaWnWTh9d6ezg
rDxkPWrYCBOOe3XO6nSqKsgehCdZgv5yqdG3AZeRIE9eSZ+aXRs=
=IF98
-----END PGP SIGNATURE-----

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