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-embe...
| Elapsed to determine CodeSource: 1
| JBOSS_HOME: ZipEntryHandler@12724795[path=embedded
context=file:/Users/svn/repository.jboss.org/maven2/org/jboss/embedded/jb...
real=file:/Users/svn/repository.jboss.org/maven2/org/jboss/embedded/jboss...]
| Elapsed to locate child 'embedded' : 759
| LIBRARY_URL: ZipEntryHandler@14031599[path=
context=vfszip:/Users/svn/repository.jboss.org/maven2/org/jboss/embedded/...
real=vfszip:/Users/svn/repository.jboss.org/maven2/org/jboss/embedded/jbo...]
| ZipEntryHandler@3232789[path=empty
context=vfszip:/Users/svn/repository.jboss.org/maven2/org/jboss/embedded/...
real=vfszip:/Users/svn/repository.jboss.org/maven2/org/jboss/embedded/jbo...]
| 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#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...