JVM Performance

I just need some general advice on whether there is anything I can do to improve performance of my java program on my Linode or whether the performance I'm getting compared to my desktop environment is to be expected.

My java program will ultimately used in a JRuby on Rails web app but most of the intensive execution time is within java so I am just running and timing the java class from the command line for purposes of determining performance.

The class is a card game simulator. So it runs over the same methods 500K times but uses virtually no IO and not much memory.


My home/development machine is a Mac Pro Dual Core 2.66 GHz (6 gb of RAM) running OSX Snow Leopard. The output of 'java -version' is:

java version "1.6.0_33"

Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-10M3720)

Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)


My Linode (512 Plan) is running distro Ubuntu 12.04 LTS that I recently created. I installed OpenJDK via apt-get. Output of 'java -version' is:

java version "1.7.0_03"

OpenJDK Runtime Environment (IcedTea7 2.1.1pre) (7~u3-2.1.1~pre1-1ubuntu3)

OpenJDK Client VM (build 22.0-b10, mixed mode, sharing)


The same calculations consistently take about 50% longer on my Linode compared with my home machine. This may be perfectly normal considering the hardware and expected performance of a Linode. That is what I don't know. It doesn't seem like an upgrade (of the Linode plan) would change this result considering my application does not use a lot of memory, but I am also unsure of that.

I would appreciate any input on what I can do to improve my Linode performance or whether this is just a normal experience that I should expect.



4 Replies

Your home machine is running HotSpot, can you install the official "oracle" version of the JDK and compare?

Also your home machine is more or less "yours" - on a linode512 you're sharing resources with 39 other users. For a better comparison you should upgrade your linode plan so that there is less contention for the resources.

Forgot to mention - have you adjusted your java heap size on your home machine which isn't the same as that on your linode?

Adding to Mr. Nod's comments, you might want to uninstall Java 7 and install Java 6 and compare too but definitely using the Oracle Java 7 or 6 version I would think should give better performance.

You can use update-alternatives to switch between versions and compare.

Thank you for your input, guys.

I have tried Oracle's JVM, both 6 and 7. I have also tried varying heap sizes on both machines. Under all variations the performance (and performance difference) is similar to as originally reported.

This leaves an upgrade as the only other possibility. Would this be likely to help though? The only difference in specs in the pricing grid is RAM and disk space and bandwidth. Do higher plans necessarily get more CPU cycles per unit of time?

EDIT: Never mind I think I find where it says 10 less users for the next available plan. I think for me the only real option other than improving the application itself is seeing if some other type of VPS or environment works better for my application.


You could log in with ssh -X [email protected] and run jvisualvm, it comes with Java SDK and is nicer than jconsole. It might give you some helpful information.

Look into Java profiling tools, jvisualvm has one.



Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct