Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Slow classloading after second start of equinox
Slow classloading after second start of equinox [message #1733447] Fri, 27 May 2016 15:00 Go to next message
Arnaud MERGEY is currently offline Arnaud MERGEYFriend
Messages: 243
Registered: March 2010
Location: France
Senior Member
Hello,

I have an osgi application using groovy GStringTemplate in some layer
Since we moved to equinox mars we noticed a significant bootstrap performance issue after second start of the application.

meaning performances are normal at first start of the application, but very slow for other starts, until we clear work files created by equinox (.metadata, .plugins, ...), in order to simulate a fresh start.

It is very strang something done by equinox in its work files seems to change something in classloading making bootstrap performances of our application bad.

By monitoring the application the difference of time is spend in calling stack above.

What could explain classloading seems to be slow after the second start of equinox and what is the difference between the first time an equinox application is starting and other starts ?
We did not experienced this in previous equinox release (luna)

Quote:
sun.nio.cs.UTF_8$Encoder.encode(char[], int, int, byte[])
java.lang.StringCoding$StringEncoder.encode(char[], int, int)
java.lang.StringCoding.encode(String, char[], int, int)
java.lang.String.getBytes(String)
java.io.UnixFileSystem.getLastModifiedTime(File)
java.io.File.lastModified()
java.util.zip.ZipFile.<init>(File, int, Charset)
java.util.zip.ZipFile.<init>(File, int)
java.util.zip.ZipFile.<init>(File)
org.eclipse.osgi.framework.util.SecureAction.getZipFile(File)
org.eclipse.osgi.storage.bundlefile.ZipBundleFile.basicOpen()
org.eclipse.osgi.storage.bundlefile.ZipBundleFile.getZipFile()
org.eclipse.osgi.storage.bundlefile.ZipBundleFile.checkedOpen()
org.eclipse.osgi.storage.bundlefile.ZipBundleFile.getEntry(String)
org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findClassImpl(String, ClasspathEntry, List)
org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(String, List)
org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(String)
org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(String)
org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(String)
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(String, boolean)
org.eclipse.osgi.internal.loader.BundleLoader.findClass(String, boolean)
org.eclipse.osgi.internal.loader.BundleLoader.findClass(String)
org.eclipse.osgi.internal.loader.buddy.DependentPolicy.loadClass(String)
org.eclipse.osgi.internal.loader.buddy.PolicyHandler.doBuddyClassLoading(String)
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(String, boolean)
org.eclipse.osgi.internal.loader.BundleLoader.findClass(String, boolean)
org.eclipse.osgi.internal.loader.BundleLoader.findClass(String)
org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(String, boolean)
java.lang.ClassLoader.loadClass(String)
java.lang.Class.forName0(String, boolean, ClassLoader, Class)
java.lang.Class.forName(String)
groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createWithCustomLookup(Class, MetaClassRegistry)
groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(Class, MetaClassRegistry)
org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock()
org.codehaus.groovy.reflection.ClassInfo.getMetaClass()
org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(Class)
org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(Class)
groovy.lang.GroovyObjectSupport.<init>()
groovy.lang.Closure.<init>(Object, Object)
groovy.tmp.templates.GStringTemplateScript87$_getTemplate_closure1$_closure4.<init>(Object, Object)

[Updated on: Fri, 27 May 2016 15:05]

Report message to a moderator

Re: Slow classloading after second start of equinox [message #1733583 is a reply to message #1733447] Mon, 30 May 2016 09:57 Go to previous messageGo to next message
Arnaud MERGEY is currently offline Arnaud MERGEYFriend
Messages: 243
Registered: March 2010
Location: France
Senior Member
After doing more tests it seems it is the configuration area that is disturbing equinox classloader, meaning if I clear the configuration area before launching my application, I do not experienced the slow bootstrap
Re: Slow classloading after second start of equinox [message #1733599 is a reply to message #1733583] Mon, 30 May 2016 11:32 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2903
Registered: July 2012
Senior Member
Are you using the BuddyClassloading policy? Do you use Require-Bundle or Import-Package statements? If you use Require-Bundle, do you use re-exports?
Re: Slow classloading after second start of equinox [message #1733612 is a reply to message #1733599] Mon, 30 May 2016 12:20 Go to previous messageGo to next message
Arnaud MERGEY is currently offline Arnaud MERGEYFriend
Messages: 243
Registered: March 2010
Location: France
Senior Member
No I am not using BuddyClassloading policy. But I am using require-bundle and I am using re-exports for groovy bundle

[Updated on: Mon, 30 May 2016 12:20]

Report message to a moderator

Re: Slow classloading after second start of equinox [message #1733615 is a reply to message #1733612] Mon, 30 May 2016 12:37 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2903
Registered: July 2012
Senior Member
AFAIK Require-Bundle in combination with re-exports causes startup performance issues. From my understanding the reason is hidden in the bundle wiring, because multiple bundles export the same package from the same original bundle, and resolving and wiring such bundles is time consuming. Well, at least if you mix require-bundle and import-package. If you always use require-bundle (which is not suggested from a plain OSGi perspective) it should not matter regarding the performance, as you always depend on the producer of a package, not the package itself, which means you have already a tight coupling.

One other reason could be the Groovy magic. It looks like GStringTemplate is searching for some closure and is searching a class with meta informations. Maybe something has changed in the classloading mechanism. But at that point I'm not an expert. Maybe someone from the Equinox team has an idea then.
Re: Slow classloading after second start of equinox [message #1733629 is a reply to message #1733615] Mon, 30 May 2016 14:06 Go to previous messageGo to next message
Arnaud MERGEY is currently offline Arnaud MERGEYFriend
Messages: 243
Registered: March 2010
Location: France
Senior Member
Thanks for your inputs, bootstrap performances are probably related to this, even my application does not used directly BuddyClassloading, groovy bundle itself is using dependent as buddy policy (I consume standard groovy bundle jar from maven which is osgified).
There is still this strange thing, about the fact that bootstrap is "normal" when configuration area is cleared
Re: Slow classloading after second start of equinox [message #1733756 is a reply to message #1733629] Tue, 31 May 2016 13:06 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
I don't understand how the configuration area is causing the slowdown in class loading. I also do not think the Require-Bundle or Reexporting should be causing the slowdown. The performance issues with that were in resolving at one point. But on restart the resolution should be cached. But you state that if the clear the cache then performance is faster.

I suspect the buddy class loading implementation could be causing the slowdown, but still I don't see how the configuration area cache would make that slower. The only think I can think of is that perhaps the buddy class loading is not fully searching dependents on initial launch, but from a cached resolution state it is.
Re: Slow classloading after second start of equinox [message #1733856 is a reply to message #1733756] Wed, 01 June 2016 13:41 Go to previous messageGo to next message
Arnaud MERGEY is currently offline Arnaud MERGEYFriend
Messages: 243
Registered: March 2010
Location: France
Senior Member
I confirm this behavior, as a workaround, I clean the configuration area before starting equinox, so bootstrap performances are as they were before mars.
i experienced this behavior by switching from equinox luna SR2 to mars SR2, so this behavior has been introduced recently
Re: Slow classloading after second start of equinox [message #1733858 is a reply to message #1733856] Wed, 01 June 2016 13:47 Go to previous message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
Any way you can provide an environment/app to reproduce the slowdown?
Previous Topic:Equinox Launcher EXE vs. bundle jar
Next Topic:Current Neon version seems to prevent JDKs JAX-WS implementation from working
Goto Forum:
  


Current Time: Sun Oct 06 20:15:13 GMT 2024

Powered by FUDForum. Page generated in 0.04690 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top