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

Ravi,

On 5/22/13 3:46 PM, Vanga Palli, Ravindra Kumar wrote:
> I have a simple question, how to ensure JIoEndpoint logs to 
> catalina.log fine when threads are maxed out?
> 
> I have read the tomcat logging documentation for tomcat 
> 6.0.28/RHEL6.3.
> 
> Long question:
> 
> We are using tomcat 6.0.28, our goal is to figure out are we
> maxing out on number of threads and I am looking at
> JIoEndpiont.java source code and found the following code. So,
> looks like JIoEndpoint logs whenever all the worker threads are
> busy, if i receive conncurrent connections more than maxThreads in
> server.xml , i should see this logging message in catalina.out. So,
> how do i enable the logs for this class
> org.apache.tomcat.util.net.JIoEndpoint.
> 
> if (curThreadsBusy == maxThreads) { 
> log.info(sm.getString("endpoint.info.maxThreads", 
> Integer.toString(maxThreads), address, Integer.toString(port))); }
> 
> I modified  the following logging file: 
> tomcat/conf/logging.properties, added this entry to this file and 
> bounced the server.
> 
> cat /usr/Interwoven/tomcat/conf/logging.properties | grep -A 4 -B 3
> JIo 
> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level
> = INFO 
> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers
> = 5host-manager.org.apache.juli.FileHandler
> 
> org.apache.tomcat.util.net.JIoEndpoint.level = FINE
> 
> # For example, set the com.xyz.foo logger to only log SEVERE #
> messages: #org.apache.catalina.startup.ContextConfig.level = FINE
> 
> 
> I also configured the server.xml as follows:
> 
> <Connector port="1776" maxThreads="8" 
> threadPriority="MAX_PRIORITY" minSpareThreads="3" 
> maxSpareThreads="5" enableLookups="false" acceptCount="512" 
> debug="0" connectionTimeout="20000" useURIValidationHack="false" 
> disableUploadTimeout="true" URIEncoding="UTF-8"/>
> 
> Then, i ran the test as follows which generates 500 concurrent 
> request, as there are only 8 max threads, i should get log message
> that all threads are busy.
> 
> ab -n 1000 -c 500 http://localhost:1776/test.
> 
> In theory i should see the log message if i configured everything 
> correctly. So do you have any idea on what am i missing here. How
> do i see the logging for JIoEndpoint class ?
> 
> Any insights would be helpful.

Thank you for asking a question with complete details!

I can confirm when setting:

org.apache.tomcat.util.net.JIoEndpoint.level=FINE

I get no output in catalina.out when I clearly should have reached
maxThreads.

I also tried:

org.apache.tomcat.level=FINE

...which gives me an incredible amount of output, but searching for
"threads " finds nothing. I was using Tomcat 7.0.39 which is quite
different but I suspect that the problem might be the same between
both versions.

I'll bet that you are using an "executor", whether you know it or not.
I checked, and the StandardThreadExecutor class (in 6.0.x) has no
logging whatsoever. Sure enough, the ThreadPoolExecutor in 7.0.x also
has (virtually) no logging.

So, I suspect you will not be able to get this kind of information
sent to the log file. Instead, you'll have to obtain it through other
means (e.g. JMX).

I'm not sure why JIoEndpoint contains all of the code it does, as
IIRC, Tomcat 6 switched-over to using Executors for all thread
management, even if you don't define one yourself using <Executor>.
Tomcat 7's JIoEndpoint has none of the thread-management code that
still exists in Tomcat 6, so I suspect it has simply been deprecated
in 6.0 and removed entirely in 7.0.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRnjW6AAoJEBzwKT+lPKRYntwP/R89LI8anb5rXjRA9Eb005I4
1LXoclPKY4XjAIqpW+Y8Egjat1WDCBNXEqJE0fo2IVwA8rEiOmFZiuK/YGNywcWm
O8jDrbs8AbURMP1lHFTnuepLzKObIcr4mGvu3FMhthOimv8CHJtfAtVsc6e/1Di9
J/LfyDMdptOl9JEbit+qNiUVDbRDCst8Xj4hi9bnWNtB5KSCFXcA3DxKIsHueCeH
/GRHrBXBemsjXUu+HvW5UGTNdF5fgnt9a/cKT5iuwTd7wgQJYiOIeHXNKvFTrkZQ
tjMaKvlvCWT+9ZqHOUU5irvntHgnGOQTP6nu5RiVq482kwVHyysyBpy3aE7rI+48
qLRzc7831a9hbh2v5nREQ7jkj5J1Q7pDtJs4F2UKIxVPfK0OyegaqjOM6IxDp12p
QON9S9TeedC9c+r0HIoBwhR19qhwdEM40Xx7DLQW1Hmr0KAyOfSFBV1ZRIfWwc7m
cetoEdkFuor/CxYdtvYYvaEYG1x48LY9hAoJkZBYFp7m8vjc02AJgassqlxVijHF
qp4fHX2CaemOHOg6x+q5mDwZJpvyRNe5h2zkyU4k0HAo4wnEi1+QZ06yBQzju3QW
aIR7+/w2ZeGieddpZuJjkcCIxoZueTPgT4upTQKR3mdtVq7uMox+QMMj4ZKtHcLq
RgogWtxUA9BBy9cASzdF
=gDxl
-----END PGP SIGNATURE-----

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

Reply via email to