• Bug
  • Status: Open
  • 2 Major
  • Resolution:
  • eng group
  • Reporter: siyer
  • May 20, 2007
  • 0
  • Watchers: 1
  • January 21, 2008



See http://forums.terracotta.org/forums/posts/list/235.page See attached tc-config.xml. Startup degradation of 2x (50-100s) seems rather severe, given that it seems that only 3 or 4 classes are being instrumented.


Geert Bevin 2007-05-21

I haven’t read through all the code yet that instruments the classloader, but my initial thought immediately went to this: Sun’s URL classloader maintains a cache for classes that are being read from jar files and such by implementing their custom sun.misc.URLClassPath class. If this isn’t used and the bytes of all the classes are being read through URL.openStream(), jars are opened and searched through for each and every class, even if the jar had already been opened beforehand for another file. It looks like ClassProcessorHelper.getTCClass could be causing this.

I ran into exactly this for RIFE and implemented a way to still use this performance improvement with Sun VMs: https://svn.rifers.org/rife/trunk/src/framework/com/uwyn/rife/tools/ClassBytesLoader.java

We could look into adapting the same approach.

When measuring, this did increase startup performance of RIFE apps by 40% when running on Windows (Linux was a bit less dramatic IIRC).

Steve Harris 2007-05-21

We should only be intrumenting 4 classes. Does that matter? I thought the problem could be a boot jar that has auto-locking turned on. I recommend also trying to rebuild the boot jar with out the auto-lock everything in the config.

Geert Bevin 2007-05-21

I think is can matter since it looks like Terracotta is instrumenting all ‘loadClassInternal’ method calls by replacing it by ClassProcessorHelper.getTCClass. As I said, I haven’t read through everything related yet, but to me it looks like this could have an impact, disregarding the amount of classes that are actually instrumented since it seems to change the way classes are loaded in a global way.

Steve Harris 2007-05-21

Great! sounds like worth it’s investigating :-)