Wednesday, April 08, 2009

Some facts about the JVM used by Google's App engine

As you probably have noticed Google has released Java support for it's App Engine!

I wrote a small servlet to find out more about which Java they are running:

java.specification.version: 1.6
java.vendor: Sun Microsystems Inc.

java.class.version: 50.0
java.util.logging.config.file: WEB-INF/ Java Platform API Specification
java.vm.version: 1.6.0_13 Linux
java.version: 1.6.0_13
java.vm.specification.version: 1.0
user.dir: /base/data/home/apps/wanlatency/1.332645732335305520
java.specification.vendor: Sun Microsystems Inc. Java Virtual Machine Specification
java.vm.vendor: Sun Microsystems Inc.
file.separator: /
path.separator: :
java.vm.specification.vendor: Sun Microsystems Inc. Java HotSpot(TM) Client VM
file.encoding: ANSI_X3.4-1968
Total Memory 104857600
Free Memory 6293011

Note that the Free Memory does not change if you allocate 10Mbyte (nor the Total memory). It might therefore by faked.
Allocating 1Gbyte results in a very simplistic error.

They use jetty!

java.lang.OutOfMemoryError: Java heap space at org.kohlerm.wanTestGoogleServlet.doGet( at javax.servlet.http.HttpServlet.service( at javax.servlet.http.HttpServlet.service( at org.mortbay.jetty.servlet.ServletHolder.handle( at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter( at at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter( at at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter( at org.mortbay.jetty.servlet.ServletHandler.handle( at at org.mortbay.jetty.servlet.SessionHandler.handle( at org.mortbay.jetty.handler.ContextHandler.handle( at org.mortbay.jetty.webapp.WebAppContext.handle( at at org.mortbay.jetty.handler.HandlerWrapper.handle( at org.mortbay.jetty.Server.handle( at org.mortbay.jetty.HttpConnection.handleRequest( at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete( at at org.mortbay.jetty.HttpConnection.handle( at at at$EvaluationRuntime$6.handleBlockingRequest( at$EvaluationRuntime$6.handleBlockingRequest( at at at$ at at at at

Because my "hobby" is memory usage analysis, I ran another test on the appengine and it seems you can allocate about 110Mbyte.
Allocation seems to be very slow. I first tried to allocate a byte array in 1Mbyte steps, but until it reached 100 Mbyte it would need 30 seconds "CPU time".
Maybe they persist larger blocks to disk???


Prashant Deva said...

Interesting that they use the 'client' vm and not the 'server' vm.

chris☆lewis said...

Interesting. I got into the Java beta and grabbed the local SDK. I haven't played with it yet, but one of the first things I did was glance at the server they chose: Geronimo. I've not used Geronimo, but a quick google says that Jetty is the container used in Geronimo. Thanks for the sharing the info!

Unknown said...

Hi Chris,
Geronimo, that's interesting. It would make sense that they would also use Geronimo on the server then, also we cannot be sure. Hmm maybe I should try to use JPA ...

gorlok said...

Nice and interesting.

Unknown said...

Client makes sense in this instance as startup time is more important than long term optimisation.

Marcus Breese said...

Just because they use Jetty doesn't mean that Geronimo is being used. Jetty is a very common Java web server that is known for being small and fast. It's also designed to be embedded in a variety of environments. So, I'd suspect that Jetty is being used standalone.

knowtheory said...

Are you getting this info dump from the dev env? or did you pull this info from an app running on the cloud?

Unknown said...

The stack trace above is from a servlet running on the cloud.
It's running at

Prashant Deva said...

@Brett I dont see how startup time is so important. server side applications usually run for a long time once they are started, hence there is a server vm. since google app engine is all server side stuff it seems they would be better served with the server vm.

_lowell said...


thanks for the info; btw you have a js somewhere blocking the Page Back while using Safari 4 in Mac OS 10 - i'm able to exit the page fine in Firefox 3.

Thilo said...

Interesting data points. Maybe you can periodically run the same test again, to see if they seem to gradually enhance the service (as Google usually does).

I am running a similiar experiment to try to figure out when JVM and threads are spawned. Please have a look:

Thilo said...

Startup time could be important because Google wants to be able to fire up more servers and shut down unused ones as demand fluctuates.

Anonymous said...
This comment has been removed by a blog administrator.
Unknown said...

I am very frankly to say that each & every info is sharing by you for all types’ topics and solutions. This is the best information to jave programmers. You are really great going.

Mobile App Development Services