You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Frederik Nosi <fr...@postecom.it> on 2014/03/19 03:22:40 UTC
mod_jk - Failover behaviour and load
Hi all,
I have this situation, an hardware loadbalancer configured with sticky
session based
on souce IP, two httpd servers behind it doing HTTPS termination with
mod_jk doing
load balancing vs four tomcats, i'll try to do my best in ascii art,
hopping my mailer
does the right thing:
----------------- {internet}---------------------
|
v
[HW LB with source IP stickyness]
| |
| |
[httpd1] [httpd2]
[mod_jk] [mod_jk]
| |
======================================
| | | |
[TC1] [TC2] [TC3] [TC4]
Each apache httpd talks with every tomcat.
mod_jk is configured with load balancing by business, sticky sessions, only
one try for ajp worker (so if it's busy i dont add more stuff to the
poor worker)
and only 1 retry for all load balanced workers, in short, here's the
interesting
part of my conf:
worker.worker_lb.balance_workers = w1, w2, w3, w4
sticky session on, sticky session force = off ecc
[...]
Now, even with this settings, on peak times i have an amplification
effect, all
tomcats are busy, mod_jk reaches atimeout and retries again and again
... in a
death spiral for the poor cats.
This behaviour brings me two problems:
1) Even if apache httpd / mod_jk timeouts (read_timeout) from his side
this does
not stop the tomcat thread proccessing that request. It goes sometimes
on and on
but after all finishes the request.
This seems a resource waste, is there a way to let tomcat know that
mod_jk droped
the connection and stop proccessingthe dropped request? I tried to find
a way to
get this behaviour without success, so any suggestions are welcome.
2) I noticed that the default behaviour of load balanced workers and AJP
workers is
as follows:
a) ajp worker reaches retry_timeout, at this point retries again to
the same worker
once, thus amplifying load. This onewas easy to solve, just add a
"worker.w1.retries = 1"
and this does not happen anymore
b) Load balancer worker goes to the next ajp worker.. till the last
one, than does
another round of requests:
lb -> w1 -> timeout
[...]
lb-> w4 -> timeout
LB try 2
lb -> w1 -> timeout
[...]
request fails.
The second round to the workers IMHO is wasteful, but easy solved
with:
"worker.worker_lb.retries = 1"
So at this point for every request all the busy tomcats get only one
request. I tryed finding a way to tell
the LB worker to try just once, only another worker for request but i
didnt find an option for doing this.
Well, as i had an each to scratch i made a patch that adds an option to
a LB worker telling how much times
to retry before giving up, i'm glad to post it if somebody is
interested. Not sure it's perfect, but works
for me.
Now, my questions:
1) Am i doing something wrong?
2) Is there a way to make a tomcat thread stop proccessing when AJP
timeouts?
Thanks in advance,
Frederik
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: mod_jk - Failover behaviour and load + patch
Posted by Frederik Nosi <fr...@postecom.it>.
Hi Konstantin,
On 04/02/2014 12:01 PM, Konstantin Kolinko wrote:
> 2014-04-02 5:21 GMT+04:00 Frederik Nosi <fr...@postecom.it>:
>> On 04/02/2014 12:21 AM, Christopher Schultz wrote:
>>> On 3/26/14, 9:32 PM, Frederik Nosi wrote:
>>>> My scenario is Apache httpd + mod_jk + N Tomcat's in. The default
>>>> behaviour of load balanced workers in mod_jk in my testing is that
>>>> when a client requests a page (GET / POST / Whatever), the LB
>>>> worker tries the request to every ajp worker. This in contrast with
>>>> what i read here:
>>>>
>>>>
>>>> http://people.apache.org/~mturk/docs/article/ftwai.html
>>>> <http://people.apache.org/%7Emturk/docs/article/ftwai.html>
>>>>
>>>> Expecially this part:
>>>>
>>>>
>>>> When having multiple nodes in a cluster you can improve your
>>>> application availability by implementing failover. The failover
>>>> means that if the particular elected node can not fulfill the
>>>> request the another node will be selected automatically. In case of
>>>> three nodes you are actually doubling your application
>>>> availability. The application response time will be slower during
>>>> failover, but none of your users will be rejected. Inside the
>>>> mod_jk configuration there is a special configuration parameter
>>>> called worker.retries that has default value of 3, but that needs
>>>> to be adjusted to the actual number of nodes in the cluster.
>>>>
>>>> ... worker.list=lbworker worker.lbworker.type=lb # Adjust to the
>>>> number of workers worker.retries=4
>>>> worker.lbworker.balance_workers=node1,node2,node3,node4 If you add
>>>> more then three workers to the load balancer adjust the retries
>>>> parameter to reflect that number. It will ensure that even in the
>>>> worse case scenario the request gets served if there is a single
>>>> operable node.
>>>>
>>>> From that it seems that the "retries" parameter in a load balancer
>>>> worker context should mean the number of real (AJP) workers to
>>>> try. (what i need indeed) but in my testing, that LB worker
>>>> parameter is the number of times that all the AJP workers that are
>>>> part of the LB worker get a round retry. In eg, having a LB worker
>>>> with 4 AJP workers, setting LB Worker's retries = 2, the behaviour
>>>> i see is that the AJP workers get called this way:
>>>>
>>>> AJP1 -> timeout [...] AJP4 -> timeout
>>>>
>>>> ===> repeat again (retries == 2)
>>>>
>>>> AJP1 -> timeout [...] AJP4 -> timeout
>>>>
>>>> --> LB sends an error to the client.
>>>>
>>>>
>>>>
>>>> Now from the online documentation the meaning of that parameter in
>>>> a load balancer worker context is'nt that clear, but from the link
>>>> i provided seems it was exactly what i needed, not the number of
>>>> retries to all AJP workers, but the number of single AJP workers to
>>>> try..
>>>>
>>>> If that is not correct i can fill a bug report. If instead it's by
>>>> design, the attached patch adds a new parameter, "lb_retries", that
>>>> does what i need. Of course it's a bit rough, but works.
>>>>
>>>> Any comments? Am I getting stuff wrong?
>>> I'm bumping this because I can see Rainer has fixed a bunch of things
>>> in mod_jk over the last few days. Perhaps he's getting ready to do a
>>> release or something.
>>
>> Thanks Christopher, BTW on this issue I'm not even sure it's a documentation
>> bug, a bug in mod_jk or an unfullfilled expectation of mine :-)
>> Thing is, i had to use this cure.
>>
>> I'm sure my patch is a bit faulty, the HTTP status codes returned are > 500,
>> but i'm not sure they are in line with the protocol (503 / 504). but for now
>> it works for me though.
>>
> 1. If you really want to submit a patch, please attach it to an issue
> in Bugzilla, so that it is not forgotten.
Okay, i will,
>
> http://tomcat.apache.org/bugreport.html
>
> 2. You were lucky that you attachment has reached the list. Usually
> attachments are just removed by mailing list server.
Ok, sorry for that, i put that as attachment for avoiding word wrapping
problems with my
mail client.
>
> 3. I cannot comment on the essence, just two formal nits
> 1) The following line has a tab character instead of whitespaces:
> + jk_log(l, JK_LOG_DEBUG, "attempt %d, max attempts %d",
Ok, willl fix, thanks for pointing this.
>
> 2) An unneeded comment
> +/* fredi - default */
Yep, leftover from my testing
>
> 3) Documentation =?
> (xdocs/reference/workers.xml)
Ok, will do,
>
>> Noticed there were changes in mod_jk's git repo, i'm following it.
>>
> It is good that it works for you.
> The official repository is subversion one.
Yes, noticed that, but as i'm not always inline i tend to use git. But
svn is fine too
>
> (Patches against the git repository are OK. Maybe you want to submit
> those ".gitignore" files, as a separate issue?)
Okay, will separate that part in case it turns useful.
Anyway, i know the patch i sent was rough, but i prefered to send it
anyway to have
something concrete to explain what i wanted to do.
>
> Best regards,
> Konstantin Kolinko
Thanks Konstantin for your attention!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Frederik
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: mod_jk - Failover behaviour and load + patch
Posted by Konstantin Kolinko <kn...@gmail.com>.
2014-04-02 5:21 GMT+04:00 Frederik Nosi <fr...@postecom.it>:
> On 04/02/2014 12:21 AM, Christopher Schultz wrote:
>> On 3/26/14, 9:32 PM, Frederik Nosi wrote:
>>>
>>> My scenario is Apache httpd + mod_jk + N Tomcat's in. The default
>>> behaviour of load balanced workers in mod_jk in my testing is that
>>> when a client requests a page (GET / POST / Whatever), the LB
>>> worker tries the request to every ajp worker. This in contrast with
>>> what i read here:
>>>
>>>
>>> http://people.apache.org/~mturk/docs/article/ftwai.html
>>> <http://people.apache.org/%7Emturk/docs/article/ftwai.html>
>>>
>>> Expecially this part:
>>>
>>>
>>> When having multiple nodes in a cluster you can improve your
>>> application availability by implementing failover. The failover
>>> means that if the particular elected node can not fulfill the
>>> request the another node will be selected automatically. In case of
>>> three nodes you are actually doubling your application
>>> availability. The application response time will be slower during
>>> failover, but none of your users will be rejected. Inside the
>>> mod_jk configuration there is a special configuration parameter
>>> called worker.retries that has default value of 3, but that needs
>>> to be adjusted to the actual number of nodes in the cluster.
>>>
>>> ... worker.list=lbworker worker.lbworker.type=lb # Adjust to the
>>> number of workers worker.retries=4
>>> worker.lbworker.balance_workers=node1,node2,node3,node4 If you add
>>> more then three workers to the load balancer adjust the retries
>>> parameter to reflect that number. It will ensure that even in the
>>> worse case scenario the request gets served if there is a single
>>> operable node.
>>>
>>> From that it seems that the "retries" parameter in a load balancer
>>> worker context should mean the number of real (AJP) workers to
>>> try. (what i need indeed) but in my testing, that LB worker
>>> parameter is the number of times that all the AJP workers that are
>>> part of the LB worker get a round retry. In eg, having a LB worker
>>> with 4 AJP workers, setting LB Worker's retries = 2, the behaviour
>>> i see is that the AJP workers get called this way:
>>>
>>> AJP1 -> timeout [...] AJP4 -> timeout
>>>
>>> ===> repeat again (retries == 2)
>>>
>>> AJP1 -> timeout [...] AJP4 -> timeout
>>>
>>> --> LB sends an error to the client.
>>>
>>>
>>>
>>> Now from the online documentation the meaning of that parameter in
>>> a load balancer worker context is'nt that clear, but from the link
>>> i provided seems it was exactly what i needed, not the number of
>>> retries to all AJP workers, but the number of single AJP workers to
>>> try..
>>>
>>> If that is not correct i can fill a bug report. If instead it's by
>>> design, the attached patch adds a new parameter, "lb_retries", that
>>> does what i need. Of course it's a bit rough, but works.
>>>
>>> Any comments? Am I getting stuff wrong?
>>
>> I'm bumping this because I can see Rainer has fixed a bunch of things
>> in mod_jk over the last few days. Perhaps he's getting ready to do a
>> release or something.
>
>
> Thanks Christopher, BTW on this issue I'm not even sure it's a documentation
> bug, a bug in mod_jk or an unfullfilled expectation of mine :-)
> Thing is, i had to use this cure.
>
> I'm sure my patch is a bit faulty, the HTTP status codes returned are > 500,
> but i'm not sure they are in line with the protocol (503 / 504). but for now
> it works for me though.
>
1. If you really want to submit a patch, please attach it to an issue
in Bugzilla, so that it is not forgotten.
http://tomcat.apache.org/bugreport.html
2. You were lucky that you attachment has reached the list. Usually
attachments are just removed by mailing list server.
3. I cannot comment on the essence, just two formal nits
1) The following line has a tab character instead of whitespaces:
+ jk_log(l, JK_LOG_DEBUG, "attempt %d, max attempts %d",
2) An unneeded comment
+/* fredi - default */
3) Documentation =?
(xdocs/reference/workers.xml)
> Noticed there were changes in mod_jk's git repo, i'm following it.
>
It is good that it works for you.
The official repository is subversion one.
(Patches against the git repository are OK. Maybe you want to submit
those ".gitignore" files, as a separate issue?)
Best regards,
Konstantin Kolinko
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: mod_jk - Failover behaviour and load + patch
Posted by Frederik Nosi <fr...@postecom.it>.
Hi Christopher,
On 04/02/2014 12:21 AM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Frederik,
>
> On 3/26/14, 9:32 PM, Frederik Nosi wrote:
>> My scenario is Apache httpd + mod_jk + N Tomcat's in. The default
>> behaviour of load balanced workers in mod_jk in my testing is that
>> when a client requests a page (GET / POST / Whatever), the LB
>> worker tries the request to every ajp worker. This in contrast with
>> what i read here:
>>
>>
>> http://people.apache.org/~mturk/docs/article/ftwai.html
>> <http://people.apache.org/%7Emturk/docs/article/ftwai.html>
>>
>> Expecially this part:
>>
>>
>> When having multiple nodes in a cluster you can improve your
>> application availability by implementing failover. The failover
>> means that if the particular elected node can not fulfill the
>> request the another node will be selected automatically. In case of
>> three nodes you are actually doubling your application
>> availability. The application response time will be slower during
>> failover, but none of your users will be rejected. Inside the
>> mod_jk configuration there is a special configuration parameter
>> called worker.retries that has default value of 3, but that needs
>> to be adjusted to the actual number of nodes in the cluster.
>>
>> ... worker.list=lbworker worker.lbworker.type=lb # Adjust to the
>> number of workers worker.retries=4
>> worker.lbworker.balance_workers=node1,node2,node3,node4 If you add
>> more then three workers to the load balancer adjust the retries
>> parameter to reflect that number. It will ensure that even in the
>> worse case scenario the request gets served if there is a single
>> operable node.
>>
>> From that it seems that the "retries" parameter in a load balancer
>> worker context should mean the number of real (AJP) workers to
>> try. (what i need indeed) but in my testing, that LB worker
>> parameter is the number of times that all the AJP workers that are
>> part of the LB worker get a round retry. In eg, having a LB worker
>> with 4 AJP workers, setting LB Worker's retries = 2, the behaviour
>> i see is that the AJP workers get called this way:
>>
>> AJP1 -> timeout [...] AJP4 -> timeout
>>
>> ===> repeat again (retries == 2)
>>
>> AJP1 -> timeout [...] AJP4 -> timeout
>>
>> --> LB sends an error to the client.
>>
>>
>>
>> Now from the online documentation the meaning of that parameter in
>> a load balancer worker context is'nt that clear, but from the link
>> i provided seems it was exactly what i needed, not the number of
>> retries to all AJP workers, but the number of single AJP workers to
>> try..
>>
>> If that is not correct i can fill a bug report. If instead it's by
>> design, the attached patch adds a new parameter, "lb_retries", that
>> does what i need. Of course it's a bit rough, but works.
>>
>> Any comments? Am I getting stuff wrong?
> I'm bumping this because I can see Rainer has fixed a bunch of things
> in mod_jk over the last few days. Perhaps he's getting ready to do a
> release or something.
Thanks Christopher, BTW on this issue I'm not even sure it's a
documentation bug, a bug in mod_jk or an unfullfilled expectation of
mine :-)
Thing is, i had to use this cure.
I'm sure my patch is a bit faulty, the HTTP status codes returned are >
500, but i'm not sure they are in line with the protocol (503 / 504).
but for now it works for me though.
Noticed there were changes in mod_jk's git repo, i'm following it.
Thanks for your attention and have fun at ApacheCon!
- Fredi
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJTOzvQAAoJEBzwKT+lPKRY6uEQAISOkIa3VwSlhVEu/JPuhqDD
> SHN7/hui6l/0oj2chPRr1YWs0XO8yuP8afgzlfuJhWQ5fNeVshDliYijYusKZPSx
> 666iVZ4NqVF8zTYo7Y6LE7gJJS8LrZUnD/nEF3ngCWGp5V6KzbQkB2haQBeFFRX2
> bK2xcPFAC/hhT4QmkSkyCb8KaqyGtgIZDXToiQlA1oWRkleRip8yU+JwZEQXUz8v
> MNhRtG5hUiX5z6wJh7OVTRu421mwmfZav4SUNxvjN71UnvoiRST4H3qrQGeD6fHh
> 2bKq4ot+olZ7T0Wo4fd6NqRzn/7fwRfp9U6OIrwe5umjaWzYd99o/iTm31hcFJFz
> f6d1A0A5uqZaDT2+o8y01qSbdIWDYZFKRv7KZuX1/+6WXp6h7VHXhY9mA/R8RYf9
> NpSi0bk5FprrTNJoJx9+q/LBGlFrwFZqJpYfL93FMUlkOP47z2U1Z6ihf+HC4vb9
> zIS/NRBMgYWcKezbcc7E40XHYChE3SedO809AVAyaz7VASAQsfMDVrih0eu7f+w0
> R5FY/32Ks/o0B8Udi3numTAovEE72YjIuuvMZQp9CTGBwNMFQUUsiGAdILSBSULl
> XNgAJXDOEOyVPDMONaHXQPk4xgDH/iZAcNdgqhnV+lcmgnhwSKAV8hz9/wF/u/H8
> qs1OVu0vib9AXJ6ZFFEh
> =GEhg
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: mod_jk - Failover behaviour and load + patch
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Frederik,
On 3/26/14, 9:32 PM, Frederik Nosi wrote:
> My scenario is Apache httpd + mod_jk + N Tomcat's in. The default
> behaviour of load balanced workers in mod_jk in my testing is that
> when a client requests a page (GET / POST / Whatever), the LB
> worker tries the request to every ajp worker. This in contrast with
> what i read here:
>
>
> http://people.apache.org/~mturk/docs/article/ftwai.html
> <http://people.apache.org/%7Emturk/docs/article/ftwai.html>
>
> Expecially this part:
>
>
> When having multiple nodes in a cluster you can improve your
> application availability by implementing failover. The failover
> means that if the particular elected node can not fulfill the
> request the another node will be selected automatically. In case of
> three nodes you are actually doubling your application
> availability. The application response time will be slower during
> failover, but none of your users will be rejected. Inside the
> mod_jk configuration there is a special configuration parameter
> called worker.retries that has default value of 3, but that needs
> to be adjusted to the actual number of nodes in the cluster.
>
> ... worker.list=lbworker worker.lbworker.type=lb # Adjust to the
> number of workers worker.retries=4
> worker.lbworker.balance_workers=node1,node2,node3,node4 If you add
> more then three workers to the load balancer adjust the retries
> parameter to reflect that number. It will ensure that even in the
> worse case scenario the request gets served if there is a single
> operable node.
>
> From that it seems that the "retries" parameter in a load balancer
> worker context should mean the number of real (AJP) workers to
> try. (what i need indeed) but in my testing, that LB worker
> parameter is the number of times that all the AJP workers that are
> part of the LB worker get a round retry. In eg, having a LB worker
> with 4 AJP workers, setting LB Worker's retries = 2, the behaviour
> i see is that the AJP workers get called this way:
>
> AJP1 -> timeout [...] AJP4 -> timeout
>
> ===> repeat again (retries == 2)
>
> AJP1 -> timeout [...] AJP4 -> timeout
>
> --> LB sends an error to the client.
>
>
>
> Now from the online documentation the meaning of that parameter in
> a load balancer worker context is'nt that clear, but from the link
> i provided seems it was exactly what i needed, not the number of
> retries to all AJP workers, but the number of single AJP workers to
> try..
>
> If that is not correct i can fill a bug report. If instead it's by
> design, the attached patch adds a new parameter, "lb_retries", that
> does what i need. Of course it's a bit rough, but works.
>
> Any comments? Am I getting stuff wrong?
I'm bumping this because I can see Rainer has fixed a bunch of things
in mod_jk over the last few days. Perhaps he's getting ready to do a
release or something.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBCAAGBQJTOzvQAAoJEBzwKT+lPKRY6uEQAISOkIa3VwSlhVEu/JPuhqDD
SHN7/hui6l/0oj2chPRr1YWs0XO8yuP8afgzlfuJhWQ5fNeVshDliYijYusKZPSx
666iVZ4NqVF8zTYo7Y6LE7gJJS8LrZUnD/nEF3ngCWGp5V6KzbQkB2haQBeFFRX2
bK2xcPFAC/hhT4QmkSkyCb8KaqyGtgIZDXToiQlA1oWRkleRip8yU+JwZEQXUz8v
MNhRtG5hUiX5z6wJh7OVTRu421mwmfZav4SUNxvjN71UnvoiRST4H3qrQGeD6fHh
2bKq4ot+olZ7T0Wo4fd6NqRzn/7fwRfp9U6OIrwe5umjaWzYd99o/iTm31hcFJFz
f6d1A0A5uqZaDT2+o8y01qSbdIWDYZFKRv7KZuX1/+6WXp6h7VHXhY9mA/R8RYf9
NpSi0bk5FprrTNJoJx9+q/LBGlFrwFZqJpYfL93FMUlkOP47z2U1Z6ihf+HC4vb9
zIS/NRBMgYWcKezbcc7E40XHYChE3SedO809AVAyaz7VASAQsfMDVrih0eu7f+w0
R5FY/32Ks/o0B8Udi3numTAovEE72YjIuuvMZQp9CTGBwNMFQUUsiGAdILSBSULl
XNgAJXDOEOyVPDMONaHXQPk4xgDH/iZAcNdgqhnV+lcmgnhwSKAV8hz9/wF/u/H8
qs1OVu0vib9AXJ6ZFFEh
=GEhg
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: mod_jk - Failover behaviour and load + patch
Posted by Frederik Nosi <fr...@postecom.it>.
Hi all,
My scenario is Apache httpd + mod_jk + N Tomcat's in. The default
behaviour of load balanced workers in mod_jk in my testing is that when
a client requests a page (GET / POST / Whatever), the LB worker tries
the request to every ajp worker. This in contrast with what i read here:
http://people.apache.org/~mturk/docs/article/ftwai.html
<http://people.apache.org/%7Emturk/docs/article/ftwai.html>
Expecially this part:
When having multiple nodes in a cluster you can improve your application
availability by implementing failover. The failover means that if the
particular elected node can not fulfill the request the another node
will be selected automatically. In case of three nodes you are actually
doubling your application availability. The application response time
will be slower during failover, but none of your users will be rejected.
Inside the mod_jk configuration there is a special configuration
parameter called worker.retries that has default value of 3, but that
needs to be adjusted to the actual number of nodes in the cluster.
...
worker.list=lbworker
worker.lbworker.type=lb
# Adjust to the number of workers
worker.retries=4
worker.lbworker.balance_workers=node1,node2,node3,node4
If you add more then three workers to the load balancer adjust the
retries parameter to reflect that number. It will ensure that even in
the worse case scenario the request gets served if there is a single
operable node.
From that it seems that the "retries" parameter in a load balancer
worker context should mean the number of real (AJP) workers to try.
(what i need indeed) but in my testing, that LB worker parameter is the
number of times that all the AJP workers that are part of the LB worker
get a round retry. In eg, having a LB worker with 4 AJP workers, setting
LB Worker's retries = 2, the behaviour i see is that the AJP workers get
called this way:
AJP1 -> timeout
[...]
AJP4 -> timeout
===> repeat again (retries == 2)
AJP1 -> timeout
[...]
AJP4 -> timeout
--> LB sends an error to the client.
Now from the online documentation the meaning of that parameter in a
load balancer worker context is'nt that clear, but from the link i
provided seems it was exactly what i needed, not the number of retries
to all AJP workers, but the number of single AJP workers to try..
If that is not correct i can fill a bug report. If instead it's by
design, the attached patch adds a new parameter, "lb_retries", that does
what i need. Of course it's a bit rough, but works.
Any comments? Am I getting stuff wrong?
Thanks in advance,
Frederik
Re: mod_jk - Failover behaviour and load + patch
Posted by Frederik Nosi <fr...@postecom.it>.
Hi,
On 03/19/2014 05:26 PM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Frederik,
>
> On 3/19/14, 10:00 AM, Frederik Nosi wrote:
>> worker.list = worker_test,worker_status
>> worker.worker_status.type=status
>>
>> worker.worker_test.type = lb worker.worker_test.balance_workers =
>> test1,test2,test3,test4 worker.worker_test.sticky_session = true
>> worker.worker_test.sticky_session_force = false
>> worker.worker_test.method = business
> I think you mean "busyness". Could that be the trouble?
Oh, thanks for the catch, it was obviously a typo.
Corrected that and retested but the behaviour does not change though.
FWICS there's no option of load balanced workers for setting the total
number of retries. I'll try to explain it bette, i have a load balancer
with 4 ajp workers. I needed a way to tell the LB worker that in case of
failure to retry only one other worker and if the second fails, to fail
the request without retrying the other two workers. As i didnt found an
option doing this i made a patch that adds this functionality and it
works, though not sure it's perfect, i'm attaching it in case someone is
interested, it adds a new parameter, lb_retries, which does what i need.
Hope you find it useful, suggestions and corrections welcome obviously.
What i was asking was:
1) Is my solution correct? Or is there some other way to have the
behaviour i needed without patching?
The second question is more related to tomcat probably, but here it is:
2) When an ajp worker fails for reply_timeout the tomcat thread that is
busy working on the corresponding request does not stop but continues
proccessing. Is there a way to change this behaviour? It's problematic
in case of mod_jk failover to another ajp worker, requests get doubled.
Hope i was more clear as english is a bit rusty.
Thanks!
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJTKcUoAAoJEBzwKT+lPKRYHEUP/3xA1yWIEqC/NwqGebZc31oS
> uH+495ih7+e1gPyNdoLy4/G3wSwBl3AD/6+B7ou2YFEnHsNHQbJUQ+jJlmfVU6/w
> n9viCjmyoLTM1DjsGbNNbkdGqVwmlS9qHK4GTfkaT2b4US3QepxM0JnLHMWj8Ow6
> F4k3se0E0WzmH8U5VluaCy69q4QQK3IY82daZrj7XKsmXCewIys+E+Tc0xe1In9W
> smjz6KB5xBsfGuZBVqXNZJ+VvGXhQl7kOlbVkpNK/BQpRSd7ewqmuekG+Nq8G5wA
> L7hBqRTbACgRD9i8RNA7FnFaHbUyd/xZjOe6uwEj+zfRj36KljyQdpJmrxs2rskc
> GLX/an+HkKJjFsidEB2MLoocgSCw/5satejL7u1Ky0TMmA4/8CT7EneQ57LeZgp4
> QSza2rcBcE+LJIsnQX50K3hsz7yV9JkZB7K5AU+nJeXRk0RA2tC1o4x7m/U4u3U8
> xkBq0I3JcGFjt99xCynu1K5JF4dL3FuM3NwomOx3d8d0F92/SQOy9jrCYRFuzjcg
> XPS6GRzCQ6hi2HPvBaKWL0wql0cUJBuf4+bQF0/NgNx7OsKBhZv8VLOBKh0VSkZA
> XbFrxj6bqxgzM1HD8rGudK/EN/hAFBBkVsEKyApYT5NLR+q4ZvsXXfcMxzt3HN8s
> 5x8gmn6D6c1EILouhiq4
> =Zyt8
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Re: mod_jk - Failover behaviour and load
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Frederik,
On 3/19/14, 10:00 AM, Frederik Nosi wrote:
> worker.list = worker_test,worker_status
> worker.worker_status.type=status
>
> worker.worker_test.type = lb worker.worker_test.balance_workers =
> test1,test2,test3,test4 worker.worker_test.sticky_session = true
> worker.worker_test.sticky_session_force = false
> worker.worker_test.method = business
I think you mean "busyness". Could that be the trouble?
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBCAAGBQJTKcUoAAoJEBzwKT+lPKRYHEUP/3xA1yWIEqC/NwqGebZc31oS
uH+495ih7+e1gPyNdoLy4/G3wSwBl3AD/6+B7ou2YFEnHsNHQbJUQ+jJlmfVU6/w
n9viCjmyoLTM1DjsGbNNbkdGqVwmlS9qHK4GTfkaT2b4US3QepxM0JnLHMWj8Ow6
F4k3se0E0WzmH8U5VluaCy69q4QQK3IY82daZrj7XKsmXCewIys+E+Tc0xe1In9W
smjz6KB5xBsfGuZBVqXNZJ+VvGXhQl7kOlbVkpNK/BQpRSd7ewqmuekG+Nq8G5wA
L7hBqRTbACgRD9i8RNA7FnFaHbUyd/xZjOe6uwEj+zfRj36KljyQdpJmrxs2rskc
GLX/an+HkKJjFsidEB2MLoocgSCw/5satejL7u1Ky0TMmA4/8CT7EneQ57LeZgp4
QSza2rcBcE+LJIsnQX50K3hsz7yV9JkZB7K5AU+nJeXRk0RA2tC1o4x7m/U4u3U8
xkBq0I3JcGFjt99xCynu1K5JF4dL3FuM3NwomOx3d8d0F92/SQOy9jrCYRFuzjcg
XPS6GRzCQ6hi2HPvBaKWL0wql0cUJBuf4+bQF0/NgNx7OsKBhZv8VLOBKh0VSkZA
XbFrxj6bqxgzM1HD8rGudK/EN/hAFBBkVsEKyApYT5NLR+q4ZvsXXfcMxzt3HN8s
5x8gmn6D6c1EILouhiq4
=Zyt8
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: mod_jk - Failover behaviour and load
Posted by Frederik Nosi <fr...@postecom.it>.
Hi again,
sorry for the html email, top posting and for putting you in CC, got
used to this on other mailing lists.
Thanks,
Frederik
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: mod_jk - Failover behaviour and load
Posted by Frederik Nosi <fr...@postecom.it>.
Hi,
sure, the conf follows:
=============
worker.list = worker_test,worker_status
worker.worker_status.type=status
worker.worker_test.type = lb
worker.worker_test.balance_workers = test1,test2,test3,test4
worker.worker_test.sticky_session = true
worker.worker_test.sticky_session_force = false
worker.worker_test.method = business
worker.worker_test.retries = 1
worker.default_params.type = ajp13
worker.default_params.host = localhost
worker.default_params.port = 8080
worker.default_params.lbfactor = 1
worker.default_params.socket_timeout = 40
worker_default_params.socket_keepalive = true
worker.default_params.connection_pool_size = 300
worker.default_params.connection_pool_minsize = 25
worker.default_params.connection_pool_timeout = 60
worker.default_params.reply_timeout = 500
worker.default_params.retries = 1
worker.default_params.recovery_options = 19
worker.test1.reference = worker.default_params
worker.test1.host = 127.0.0.1
worker.test1.port = 8009
worker.test2.reference = worker.default_params
worker.test2.host = 127.0.0.2
worker.test2.port = 8009
worker.test3.reference = worker.default_params
worker.test3.host = 127.0.0.3
worker.test3.port = 8009
worker.test4.reference = worker.default_params
worker.test4.host = 127.0.0.4
worker.test4.port = 8009
==================
On 03/19/2014 02:40 PM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Frederik,
>
> On 3/18/14, 10:22 PM, Frederik Nosi wrote:
>> Each apache httpd talks with every tomcat.
>>
>> mod_jk is configured with load balancing by business, sticky
>> sessions, only one try for ajp worker (so if it's busy i dont add
>> more stuff to the poor worker) and only 1 retry for all load
>> balanced workers, in short, here's the interesting part of my
>> conf:
>>
>> worker.worker_lb.balance_workers = w1, w2, w3, w4 sticky session
>> on, sticky session force = off ecc
> Could you post the whole configuration without editing?
>
>> [...]
>>
>>
>>
>> Now, even with this settings, on peak times i have an
>> amplification effect, all tomcats are busy, mod_jk reaches atimeout
>> and retries again and again ... in a death spiral for the poor
>> cats.
>>
>> This behaviour brings me two problems:
>>
>> 1) Even if apache httpd / mod_jk timeouts (read_timeout) from his
>> side this does not stop the tomcat thread proccessing that request.
>> It goes sometimes on and on but after all finishes the request.
>> This seems a resource waste, is there a way to let tomcat know
>> that mod_jk droped the connection and stop proccessingthe dropped
>> request? I tried to find a way to get this behaviour without
>> success, so any suggestions are welcome.
>>
>>
>> 2) I noticed that the default behaviour of load balanced workers
>> and AJP workers is as follows:
>>
>> a) ajp worker reaches retry_timeout, at this point retries again
>> to the same worker once, thus amplifying load. This onewas easy to
>> solve, just add a "worker.w1.retries = 1" and this does not happen
>> anymore
>>
>> b) Load balancer worker goes to the next ajp worker.. till the
>> last one, than does another round of requests:
>>
>> lb -> w1 -> timeout [...] lb-> w4 -> timeout
>>
>> LB try 2 lb -> w1 -> timeout [...] request fails.
>>
>> The second round to the workers IMHO is wasteful, but easy solved
>> with: "worker.worker_lb.retries = 1"
>>
>> So at this point for every request all the busy tomcats get only
>> one request. I tryed finding a way to tell the LB worker to try
>> just once, only another worker for request but i didnt find an
>> option for doing this. Well, as i had an each to scratch i made a
>> patch that adds an option to a LB worker telling how much times to
>> retry before giving up, i'm glad to post it if somebody is
>> interested. Not sure it's perfect, but works for me.
>>
>>
>> Now, my questions:
>>
>> 1) Am i doing something wrong? 2) Is there a way to make a tomcat
>> thread stop proccessing when AJP timeouts?
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJTKZ5iAAoJEBzwKT+lPKRYeowQAJ1XufNZe0mc/DFwGHiIPYFK
> 4mqyVX00hjSwMQTSwxsTuFygiTMyTTgezsbg+EkoiDdMFtMKVRt3QZpXzCAWOthr
> DWYSGcnnEONDcjWv4WMaPZ8cCnT4NCh/0FmAjbCAcVv+RiJBeoOEuNuIDX4DkS71
> +4HmvUB9KwQGrSnAmtS17gA6Wauf4jW0QVe/yS642Kxv+1njFFp+n0Ezx8DnzJQr
> VyRaKC7ITQTiAMbgHoYUOq+7Nwy1wOfRiwkfvWY8WNdJ1xOZJsicu5wnU1i4RDkp
> rpUvhMvMJjvqO6waHO8HYcqoAhakOPBclTDpD24JuMlL5fJJVOMiFhD4iRp83tGr
> X+FxMHZBTMlVhsz7ve+gQniy9zAvsTMJi5JMSkMO04WHRuqzY6dd4Iw7vrSm+LIQ
> JfTUOS2Bv1NXv4MOwBCdwndQLftPDDmi1TVgFuoJH8BmeZPKqoLyGKbsOpIQkYFz
> aZHtSViccTcNXQwQLl0pk9UVbYzGiRT4LdLFqRGEtq1yRdU7X3H9wuKkbQmRVrFe
> Ou0xnx5/LF7RZ2cpeVnV5stZGTlTlnrlmkRX++78kplvoo7RRLP6J8A5Xmxk9zbN
> Z8d8JWkNkoy1lbQr9tPaSR5A77qjwBChl3L6Elq7Gc3B1JV8SNJs8Pxau0uSm3dI
> gSnf9kDocRm8ta6Ykgck
> =PCNV
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Re: mod_jk - Failover behaviour and load
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Frederik,
On 3/18/14, 10:22 PM, Frederik Nosi wrote:
> Each apache httpd talks with every tomcat.
>
> mod_jk is configured with load balancing by business, sticky
> sessions, only one try for ajp worker (so if it's busy i dont add
> more stuff to the poor worker) and only 1 retry for all load
> balanced workers, in short, here's the interesting part of my
> conf:
>
> worker.worker_lb.balance_workers = w1, w2, w3, w4 sticky session
> on, sticky session force = off ecc
Could you post the whole configuration without editing?
> [...]
>
>
>
> Now, even with this settings, on peak times i have an
> amplification effect, all tomcats are busy, mod_jk reaches atimeout
> and retries again and again ... in a death spiral for the poor
> cats.
>
> This behaviour brings me two problems:
>
> 1) Even if apache httpd / mod_jk timeouts (read_timeout) from his
> side this does not stop the tomcat thread proccessing that request.
> It goes sometimes on and on but after all finishes the request.
> This seems a resource waste, is there a way to let tomcat know
> that mod_jk droped the connection and stop proccessingthe dropped
> request? I tried to find a way to get this behaviour without
> success, so any suggestions are welcome.
>
>
> 2) I noticed that the default behaviour of load balanced workers
> and AJP workers is as follows:
>
> a) ajp worker reaches retry_timeout, at this point retries again
> to the same worker once, thus amplifying load. This onewas easy to
> solve, just add a "worker.w1.retries = 1" and this does not happen
> anymore
>
> b) Load balancer worker goes to the next ajp worker.. till the
> last one, than does another round of requests:
>
> lb -> w1 -> timeout [...] lb-> w4 -> timeout
>
> LB try 2 lb -> w1 -> timeout [...] request fails.
>
> The second round to the workers IMHO is wasteful, but easy solved
> with: "worker.worker_lb.retries = 1"
>
> So at this point for every request all the busy tomcats get only
> one request. I tryed finding a way to tell the LB worker to try
> just once, only another worker for request but i didnt find an
> option for doing this. Well, as i had an each to scratch i made a
> patch that adds an option to a LB worker telling how much times to
> retry before giving up, i'm glad to post it if somebody is
> interested. Not sure it's perfect, but works for me.
>
>
> Now, my questions:
>
> 1) Am i doing something wrong? 2) Is there a way to make a tomcat
> thread stop proccessing when AJP timeouts?
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBCAAGBQJTKZ5iAAoJEBzwKT+lPKRYeowQAJ1XufNZe0mc/DFwGHiIPYFK
4mqyVX00hjSwMQTSwxsTuFygiTMyTTgezsbg+EkoiDdMFtMKVRt3QZpXzCAWOthr
DWYSGcnnEONDcjWv4WMaPZ8cCnT4NCh/0FmAjbCAcVv+RiJBeoOEuNuIDX4DkS71
+4HmvUB9KwQGrSnAmtS17gA6Wauf4jW0QVe/yS642Kxv+1njFFp+n0Ezx8DnzJQr
VyRaKC7ITQTiAMbgHoYUOq+7Nwy1wOfRiwkfvWY8WNdJ1xOZJsicu5wnU1i4RDkp
rpUvhMvMJjvqO6waHO8HYcqoAhakOPBclTDpD24JuMlL5fJJVOMiFhD4iRp83tGr
X+FxMHZBTMlVhsz7ve+gQniy9zAvsTMJi5JMSkMO04WHRuqzY6dd4Iw7vrSm+LIQ
JfTUOS2Bv1NXv4MOwBCdwndQLftPDDmi1TVgFuoJH8BmeZPKqoLyGKbsOpIQkYFz
aZHtSViccTcNXQwQLl0pk9UVbYzGiRT4LdLFqRGEtq1yRdU7X3H9wuKkbQmRVrFe
Ou0xnx5/LF7RZ2cpeVnV5stZGTlTlnrlmkRX++78kplvoo7RRLP6J8A5Xmxk9zbN
Z8d8JWkNkoy1lbQr9tPaSR5A77qjwBChl3L6Elq7Gc3B1JV8SNJs8Pxau0uSm3dI
gSnf9kDocRm8ta6Ykgck
=PCNV
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org