Jagadish Raj R wrote:
Thanks. I made connection Pool parameters as per documentation.

What the documentation says, basically, is that in the case of an Apache httpd prefork front-end, you should not use these parameters at all, and leave mod_jk to set them at their default value.


What I am looking for is that whether there is any chance we can close the 
Ajp13Processor threads in Tomcat Server if they are no longer needed, or after 
a particular time. Whenever I hit the URL on the browser a new thread is 
getting created and sooner or later it reaches the threshold. Eventually I'll 
have to restart the server.


I do not understand your problem. What do you mean by "the treshold" ?

In the Apache prefork model, when a request comes in, Apache will use one of its "children" to process that request. Children are created as necessary, and killed when no longer used for a while. If the child determines that the request is for Tomcat, it will run mod_jk to process the request. mod_jk will create a connection with Tomat (only if necessary, if there is none available in the pool already), to send the request to Tomcat. Once created, this connection may persist for a while. That is normal, and it is an optimisation of mod_jk, to avoid having to create and destroy connections all the time. (That's what is called the "connection pool", and mod_jk sizes this appropriately by itself, depending on your Apache and Tomcat configuration).

When a request reaches Tomcat, a Tomcat thread will be created (if needed) to process that request. When that request has been processed, and there are no more requests coming, this thread will terminate. If there are more requests coming, that thread may be "recycled" (instead of being terminated) to handle another request (not necessarily for the same browser, not necessarily for the same webapp). At that level, whether the request is coming through Apache and mod_jk, or not, does not make a difference.

Normally this mechanism at the Apache level, at the mod_jk level, and at the Tomcat level, works smoothly. It has been refined and tuned over many years for that.
There is no need to twiddle with the parameters to achieve this, it is the 
default behaviour.

That is, as long as your global configuration (Apache and Tomcat) is properly sized in function of the number of requests your server has to handle in any period of time, their duration etc. As a very rough approximation, and assuming that /most/ requests which reach Apache are in fact for Tomcat, your Apache MaxClients setting should be approximately the same as the Tomcat AJP Connector's "maxThreads" setting. And both should represent more or less the number of requests that you think will be "in process" at the same time. (And if your server cannot handle this number of processes and threads, get a bigger server)(or split Apache and Tomcat on two separate servers).

If no more requests are coming, and Tomcat threads do not terminate (become "idle" first, then disappear after a while) after handling their requests, then it means that something is holding on to them. Most probably, the application which the threads are running is not behaving like it should.







-----Original Message-----
From: André Warnier [mailto:a...@ice-sa.com] Sent: Tuesday, August 30, 2011 12:50 AM
To: Tomcat Users List
Subject: Re: Ajp13Processor threads are not getting closed.

Well then..

Jagadish Raj R wrote:
Hi Andre,

Here are the results.

Compiled in modules:
  core.c

this :
prefork.c

means that your front-end Apache httpd server is running in "prefork" mode.
And what do the parts in red say in the link I sent you before ?

  http_core.c
  mod_so.c


KeepAlive On
MaxKeepAliveRequests 100

And this :

KeepAliveTimeout 15

means that any time a browser makes a connectionm to the server, sends a few requests on that connection, and then does not send anything anymore, the server will keep "listening" anyway for up to 15 seconds after the last request, just in case the browser /would/ send another request on that connection. And during that same time, one connection from Apache httpd to Tomcat will be kept waiting, and one thread in Tomcat will be kept waiting, for the same reason. You would probably improve the responsiveness of your server in general, by reducing this to 3 for example.



Thanks & Regards, JAGADISH RAJ R
-----Original Message-----
From: André Warnier [mailto:a...@ice-sa.com] Sent: Thursday, August 25, 2011 4:48 PM
To: Tomcat Users List
Subject: Re: Ajp13Processor threads are not getting closed.

To the original poster Jagadish Raj :

Maybe let's restart from the beginning.

First, re-read this page of the online documentation for the mod_jk connector :
http://tomcat.apache.org/connectors-doc/reference/workers.html
Particularly, next to the connection_pool* parameters, the items in red.

Considering that, what is the MPM used on your Apache httpd server ?
(you can see this by running "/usr/sbin/apache2 -l" or "httpd -l"; list the 
result here).
(This is to find out if your httpd server is running in "prefork" mode or one of the multi-threading modes.)

Then, what are the httpd settings for "KeepAlive" ?
(KeepAlive and KeepAliveTimeout). This is usually in /etc/apache2/apache2.conf.


Edward Quick wrote:
mod_jk is not Tomcat so I'm not sure you need to worry about running an older 
version of tomcat as long as it's listening on the AJP connector.


-----Original Message-----
From: Jagadish Raj R [mailto:jagadish_ra...@symantec.com] Sent: 25 August 2011 10:08
To: Tomcat Users List
Subject: RE: Ajp13Processor threads are not getting closed.

Hi,

Apache not accepting JkWatchDogInterval parameter (think it's version problem). 
How is this problem fixed in higher Tomcat versions. Can I do the same in lower 
version of Tomcat.

(As of now, I don't have a choice of upgrading Tomcat as this requires upgrade 
of TIBCO Administrator which is built on top of Tomcat)


Thanks & Regards, JAGADISH RAJ R | Symantec EAI Support | M P H A S I S an HP company | Level 2, Tower 7, Magarpatta SEZ, Magarpatta city, Pune-411013| Mobile: +91 9011047954| Email: jagadish_ra...@symantec.com


-----Original Message-----
From: Edward Quick [mailto:edward.qu...@iggroup.com] Sent: Wednesday, August 24, 2011 3:20 PM
To: Tomcat Users List
Subject: RE: Ajp13Processor threads are not getting closed.

You could try adding JkWatchDogInterval 30. That did the trick for me.

-----Original Message-----
From: Jagadish Raj R [mailto:jagadish_ra...@symantec.com]
Sent: 24 August 2011 10:39
To: Tomcat Users List
Subject: Ajp13Processor threads are not getting closed.

Hi Tomcat Users,

I have a Tomcat server to which another apache webserver connects using AJP 1.3 
Connector. I have set up a maxProcessors="75" in connector settings. Whenever a 
user creates a connection an Ajp13Processor connection thread is created. My problem is 
this thread does not get terminated even after the user close the session. Please help me 
in finding some configuration changes that will allow me to close these sessions/threads 
after a certain timeout value.

I am pasting below the configurations I am using.

<!-- Define an AJP 1.3 Connector on port 8009 -->
        <Connector className="org.apache.ajp.tomcat4.Ajp13Connector" port="8089" minProcessors="5" 
maxProcessors="75" acceptCount="10" connectionTimeout="60000" debug="0"/>

Workers.properties file:-

worker.list=ajp13
worker.ajp13.port=xxxx
worker.ajp13.host=hostname
worker.ajp13.type=ajp13
worker.ajp13.connection_pool_size=75
worker.ajp13.connection_pool_minsize=15
worker.ajp13.connection_pool_timeout=60


Logs from thread dump of tomcat process:-

"Ajp13Processor[xxxx][7]" daemon prio=10 tid=0x0166c038 nid=0xe0 in 
Object.wait() [0xa64ff000..0xa64ffa28]
        at java.lang.Object.wait(Native Method)
        - waiting on <0xc6de9028> (a org.apache.ajp.tomcat4.Ajp13Processor)
        at java.lang.Object.wait(Object.java:474)
        at org.apache.ajp.tomcat4.Ajp13Processor.await(Ajp13Processor.java:316)
        - locked <0xc6de9028> (a org.apache.ajp.tomcat4.Ajp13Processor)
        at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:576)
        at java.lang.Thread.run(Thread.java:595)


Versions:-

Tomcat - 4.1.27
Mod JK -  mod_jk-apache-2.0.49-linux-i686.so




Thanks & Regards,
JAGADISH RAJ R | Symantec EAI Support | M P H A S I S an HP company | Level 2, Tower 
7, Magarpatta SEZ, Magarpatta city, Pune-411013| Mobile: +91 9011047954| Email: 
jagadish_ra...@symantec.com<mailto:jagadish_ra...@symantec.com>


The information contained in this email is strictly confidential and for the 
use of the addressee only, unless otherwise indicated. If you are not the 
intended recipient, please do not read, copy, use or disclose to others this 
message or any attachment. Please also notify the sender by replying to this 
email or by telephone (+44 (0)20 7896 0011) and then delete the email and any 
copies of it. Opinions, conclusions (etc) that do not relate to the official 
business of this company shall be understood as neither given nor endorsed by 
it. IG Group Holdings plc is a company registered in England and Wales under 
number 01190902. VAT registration number 761 2978 07. Registered Office: Cannon 
Bridge House, 25 Dowgate Hill, London EC4R 2YA. Authorised and regulated by the 
Financial Services Authority. FSA Register number 114059.

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


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


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



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


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




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


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




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

Reply via email to