Tag Archives: jcs

JCS and performance

JCS is a caching system maintained at apache and is located here: http://jakarta.apache.org/jcs/

When using JCS in a large project, we did a lot of performance testing, and the cache seemed to perform just fine. After some more testing and the use of JProfiler (gotta love that tool) for optimizing, I discovered that lookups in the JCS cache (LRU) where really slow.

After some searching on google, I found a mailing list, where a person had similar performance problems with JCS. They eventually found out, that JCS uses log4j and has DEBUG turned on by default. When DEBUG logging was turned on, JCS did a verifyCache() on the cache, and then I tried to turn off the DEBUG logging on org.apache.jcs, and then I got a factor 475 improvement on the lookups!

Performance chart:
Before removing the debug logging on JCS: (Didn’t set any log4j up on the jcs cache)
1980 lookups took 10458ms.

After removing the debug logging on JCS: (Set the following log4j on the jcs cache this time: log4j.logger.org.apache.jcs=info,CONSOLE)
1980 lookups took 22ms.
Factor calculation is: 10458 / 22 = 475.36

Thanks to the guys on the mailinglist http://www.mail-archive.com/turbine-jcs-user@jakarta.apache.org/msg00464.html and especially to Jean-Marc Spaggiari for finding the actual error.