[jboss-dev-forums] [Design of Embedded JBoss] - Need vfs work for the embedded startup
scott.stark@jboss.org
do-not-reply at jboss.com
Fri Jan 30 03:04:15 EST 2009
In looking at extending the JBossEmbeddedAS work Andrew started to allow for better integration with a profile service, the memory usage and speed of trying to use a jbossas structure from within a large monolithic jar is poor. The jboss-embedded-assembly-0.1.0-SNAPSHOT-embedded.jar which combines most of the jbossas dependencies is ~40Mb.
This little test which is the start of identifying the embedded server locations is taking way too much memory and time:
| public void testBootstrapLib()
| throws Exception
| {
| long start = System.currentTimeMillis();
| URL jarUrl = JBossEmbeddedAS.class.getProtectionDomain().getCodeSource().getLocation();
| System.out.println("JBossEmbeddedAS CodeSource: "+jarUrl);
| long now = System.currentTimeMillis();
| System.out.println("Elapsed to determine CodeSource: "+(now = start));
| // Construct VFS representation
| VirtualFile jarVirtualFile = VFS.getRoot(jarUrl);
| VirtualFile jbossHome = jarVirtualFile.getChild("embedded");
| if(jbossHome == null)
| throw new IllegalStateException("Failed to locate child 'embedded' in: "+jarUrl);
| URL homeURL = jbossHome.toURL();
|
| System.out.println("JBOSS_HOME: "+jbossHome);
| now = System.currentTimeMillis();
| System.out.println("Elapsed to locate child 'embedded' : "+(now - start));
|
| URL libraryURL = new URL(homeURL, ServerConfig.LIBRARY_URL_SUFFIX);
| now = System.currentTimeMillis();
| VirtualFile libraryDir = VFS.getRoot(libraryURL);
| System.out.println("LIBRARY_URL: "+libraryDir);
| List<VirtualFile> jars = libraryDir.getChildren();
| if(jars != null)
| {
| for(VirtualFile jar : jars)
| {
| URL url = jar.toURL();
| System.out.println(jar);
| }
| }
| now = System.currentTimeMillis();
| System.out.println("Elapsed to locate/list boot lib: "+(now - start));
| }
|
The output shows its taking 5+ secs just to get to the point of loading listing the contents of the JBOSS_HOME/lib directory, and this also requires increasing the test memory to 128m:
| JBossEmbeddedAS CodeSource: file:/Users/svn/repository.jboss.org/maven2/org/jboss/embedded/jboss-embedded-assembly/0.1.0-SNAPSHOT/jboss-embedded-assembly-0.1.0-SNAPSHOT-embedded.jar
| Elapsed to determine CodeSource: 1
| JBOSS_HOME: ZipEntryHandler at 12724795[path=embedded context=file:/Users/svn/repository.jboss.org/maven2/org/jboss/embedded/jboss-embedded-assembly/0.1.0-SNAPSHOT/jboss-embedded-assembly-0.1.0-SNAPSHOT-embedded.jar real=file:/Users/svn/repository.jboss.org/maven2/org/jboss/embedded/jboss-embedded-assembly/0.1.0-SNAPSHOT/jboss-embedded-assembly-0.1.0-SNAPSHOT-embedded.jar/embedded]
| Elapsed to locate child 'embedded' : 759
| LIBRARY_URL: ZipEntryHandler at 14031599[path= context=vfszip:/Users/svn/repository.jboss.org/maven2/org/jboss/embedded/jboss-embedded-assembly/0.1.0-SNAPSHOT/jboss-embedded-assembly-0.1.0-SNAPSHOT-embedded.jar/embedded/lib/ real=vfszip:/Users/svn/repository.jboss.org/maven2/org/jboss/embedded/jboss-embedded-assembly/0.1.0-SNAPSHOT/jboss-embedded-assembly-0.1.0-SNAPSHOT-embedded.jar/embedded/lib/]
| ZipEntryHandler at 3232789[path=empty context=vfszip:/Users/svn/repository.jboss.org/maven2/org/jboss/embedded/jboss-embedded-assembly/0.1.0-SNAPSHOT/jboss-embedded-assembly-0.1.0-SNAPSHOT-embedded.jar/embedded/lib/ real=vfszip:/Users/svn/repository.jboss.org/maven2/org/jboss/embedded/jboss-embedded-assembly/0.1.0-SNAPSHOT/jboss-embedded-assembly-0.1.0-SNAPSHOT-embedded.jar/embedded/lib/empty]
| Elapsed to locate/list boot lib: 5675
|
We need to be under a sec and 64Mb to fully boot the embedded server. I'm looking at what is happening. It looks like vfs 2.0.0.CR5 is being pulled in by the current snapshot dependencies.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205770#4205770
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205770
More information about the jboss-dev-forums
mailing list