users@glassfish.java.net

GlassFish 3.1 starts slower and takes more memory than 2.1.1 in some cases

From: <forums_at_java.net>
Date: Fri, 15 Apr 2011 16:19:52 -0500 (CDT)

I'm looking at switching from GlassFish 2.1.1 to 3.1 for an application that
is made up of an EAR and a couple of WARs.  One of the reasons to do so is
to get the startup/performance benefits that the HK2/OSGi kernel provides.
 But before just blindly making the leap, I wanted to do a few tests to see
how much faster and lighter weight v2 is than v3.

To try it out, I did a few quick tests.  For the record, what I tested was
GlassFish v2.1.1, v3.1 Full, v3.1 Web Profile, and I included Tomcat 7 for
one test just to compare.  I also did this all on OS X on a fairly new
MacBook Pro.
First, I deployed a fairly small and simple Web-app and then stopped and
restarted each app-server several times.  My observations on startup times
and footprint after start were:

Container Startup Time Footprint GlassFish v2.1.1 16 sec 178 MB GlassFish
v3.1 6.5 sec 153 MB GlassFish v3.1 Web Profile 5 sec 123 MB Tomcat 7 1 sec 74
MB
This shows that v3 has clearly made improvements over v2 in both startup time
and footprint This is as expected.
Also, Tomcat is clearly the speed demon and lightest weight, but this isn't
really an apples to apples comparison as Tomcat doesn't offer as much as any
of the other options. It still sets the standard for fast startup and small
footprint though.
Next, I deployed another EAR and WAR file that make up our application.
 Here is what I observed:

Container Startup Time Footprint GlassFish v2.1.1 20 sec 207 MB GlassFish
v3.1 24 sec 400 MB
Now this was more surprising.  Not only did v3 take longer to startup, the
footprint was nearly twice that of v2!  Effectively, v2 added 4 seconds to
startup a second WAR and an EAR, but v3 added nearly 18 seconds to do the
same.  And why v3 is using so much more memory, I'm not sure.
Now, perhaps my test is too simple or I'm not looking at the exact right
metrics to really measure startup time.  But what I'm using is the Real
Memory reported by Activity Monitor and both the time it takes for "asadmin
start-domain" to return the the start time reported in the server.log file.
As additional background, I'm deploying the same WAR and EAR files to both v2
and v3, and since they run in v2 they are not specific to EE 6 and the only
EJBs are SSBs.

When I first shared this with someone, they pointed out I should use the app
once to make sure it is fully loaded.  So I added doing an HTTP request to
each of the Web apps to the test and get the following:

 


Container Startup Time Footprint GlassFish v2.1.1 26 sec 207 MB GlassFish
v3.1 30 sec 400 MB
So both increased roughly the same 6 seconds.

Why would v3 startup so much slower than v2?  It appears it is the EAR, so
is it because it is a Java EE 5 EAR rather than a pure Java EE 6 one?

 

 


--
[Message sent by forum member 'schmke']
View Post: http://forums.java.net/node/792447