Hi,

 this is a maybe esoteric question, but I would like to understand the
behavior of "mod_jk" when using both "connection_pool_timeout" and
"connection_ping_interval".

My setup is Apache-2.4.10, mod_jk-1.2.41-dev(r1621292) and Tomcat 7.042
(could be newer, I know).

Tomcat "server.xml" has:

    <Connector port="9397" protocol="AJP/1.3"
        connectionTimeout="600000"
        maxThreads="300"
        minSpareThreads="10"
        redirectPort="8443" />

workers.properties has:

worker.cb2tpl.prepost_timeout=15000
worker.cb2tpl.connect_timeout=15000
worker.cb2tpl.ping_timeout=15000
worker.cb2tpl.ping_mode=A
worker.cb2tpl.connection_ping_interval=180
worker.cb2tpl.connection_pool_timeout=600

So, I was [naively] assuming that established idle backend connections
would be closed after 10+ minutes. To my surprise, nothing happened. I
opened 6 backend connections and they stayed for that for hours.

So I started looking at the code. First thing I found was the code in
"jk_ajp_common.c:3334-3341" will basically disable the connection retiring
if the number of active backend connections is less than
"connection_pool_minsize"
(13 in my case). Is this correct? Makes actually some sense, but came
unexpected.

So, as a n experiment I took out the break in line 3340 and redid the
experiment. Still nothing happened after considerable time.

Then I looked at the code handling the worker keep alive (3346-3378). So,
if I understand it right, this will trigger after a few maintenance cycles
when last_accessed gets larger than the connection ping interval. Now my
question is, will performing the connection ping test reset the connection
timeout on the tomcat side? If yes, this would explain the observed
behavior: the connector connectionTimeout will never trigger if it is
larger than (connection_ping_interval + maintain_time). Actually, I think
it will only *reliably* trigger if smaller than connection_ping_interval.
Experiments seem to confirm this.

So, basically three questions:

a) are my observations correct?
b) if yes, is this the desired behavior?
c1) if if yes, what is the recommendation on sane values
connection_pool_timeout and connection_ping_interval?
c2) if not, what is the desired behavior?

Cheers
Martin

-- 
------------------------------------------------------
Martin Knoblauch
email: k n o b i AT knobisoft DOT de
www: http://www.knobisoft.de

Reply via email to