Loading... Cancel

Performance issue with tomcat 5.x.x series R

August 6th, 2007

one of our escenic colleagues (Simen L. Haagenrud) just noticed a bottleneck with tomcat 5.x.x series containers. so we had a details digging to let find the reason.

as he mentioned it was because of recurring invocation of “getAttribute”, and tomcat 5.x.x series is using synchornization block inside “getAttribute” method, where lock is kept on “attributes” variable.
so i had a quick look on the source code of the 3 recent series -

1. 5.0.28
http://svn.apache.org/repos/asf/tomcat/container/tags/tc5.0.x/TOMCAT_5_0_28/catalina/src/share/org/apache/catalina/core/ApplicationContext.java

2. 5.5.24 (the last version from 5.5.x series)
http://svn.apache.org/repos/asf/tomcat/container/tags/tc5.5.x/TOMCAT_5_5_24/catalina/src/share/org/apache/catalina/core/ApplicationContext.java

3. 6.0.x (trunk)
http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java

so the code says 6.0.x series came with the fixes, the fix is the replacement of HashMap with ConcurrentHashMap.

in his case, recurring invocation of “getAttribute” was nearly reduced 50% server request handling capability.
best wishes,

Total 1 response found

Close
  •   Mogsie

    Thu Jan 70 06:33

    So you're basically saying that in tomcat 5.x.x a call to getAttribute in an application context can be very expensive under heavy loads (since they contend for a resource). How many other containers embed tomcat? IBM's WebSphere for one, JBoss obviously, and probably a few more... They would all have "inherited" this problem. Oops :-)