Bug 52091 - TagHandlerPool is slow when high concurrently
Summary: TagHandlerPool is slow when high concurrently
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 7.0.19
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2011-10-26 10:39 UTC by Taiki Sugawara
Modified: 2011-11-10 11:18 UTC (History)
0 users

Reduce lock patch (6.18 KB, patch)
2011-10-26 10:41 UTC, Taiki Sugawara
Details | Diff
2011-10-29_tc6_52091_StandardWrapper.patch (5.38 KB, patch)
2011-10-28 22:55 UTC, Konstantin Kolinko
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Taiki Sugawara 2011-10-26 10:39:01 UTC
TagHandlerPool is slow when I ran stress test my web application using tomcat7.
It occured in 7.0.19.
Profiler said that it causes are followings:

 1. Lock of log instance at org.apache.jasper.runtime.TagHandlerPool.

 2. Lock of parameters field at org.apache.catalina.core.StandardWrapper.getInitParameter.

An attached patch resolve this issue in my environment.
It makes following changes:

 1. Makes log field to static.

 2. At StandardWrapper, changes lock policy from synchronized block to ReentrantReadWriteLock.
Comment 1 Taiki Sugawara 2011-10-26 10:41:29 UTC
Created attachment 27851 [details]
Reduce lock patch
Comment 2 Mark Thomas 2011-10-28 14:43:14 UTC
The lock changes look good to me.

The log change needed more careful checked. I have vague recollections of memory leaks with Jasper and logging and a number of components using non-static loggers to avoid them. Having checked the initialisation sequence, the logger is created by the container class loader, not a web app class loader so that change should be fine to. I'll commit these changes shortly.
Comment 3 Mark Thomas 2011-10-28 15:16:39 UTC
Many thanks for the patch. It has been applied to trunk and 7.0.x and will be in 7.0.23 onwards.
Comment 4 Konstantin Kolinko 2011-10-28 22:55:06 UTC
Created attachment 27862 [details]

TC6 patch for StandardWrapper - backport of r1190389
Comment 5 Taiki Sugawara 2011-10-31 04:02:14 UTC
Thanks for applying all changes!

Followings are changesets of this ticket for my reminder:
r1190388, r1190389
Comment 6 Konstantin Kolinko 2011-11-10 11:18:43 UTC
Fixed in 6.0 and will be in 6.0.34.
r1200268 and r1200269