I was very interested in upgrading to Java 7 (for my own selfish coding reasons). However, we have users who are very latency sensitive (everything needs to be sub-millisecond). I did a simple performance comparison test between 3 different JVMs and found Java 7 to be so much slower. The test pushed some simple messages through our application. This test is a low load, load volume test, which pushes a single message through, every few seconds. The results were (in microseconds):
- Hotspot 6 (build 24): msgs= 23 avg= 902
- JRockit 6 (R28 b 29): msgs= 23 avg= 481
- Hotspot 7 (build 04): msgs= 34 avg=1130
Oracle's strategy is to merge JRockit and Hotspot starting with Java 7 (so JRockit 6 is the last available). Does anyone have any ideas why the performance is so much worse? (One point to note, is that the code was compiled under Java 1.6. Not sure if that would explain it...)
UPDATE: I voted to close my own question because I can see from the comments that I am not really able to communicate enough info to make this a constructive question. Thanks to all who commented.
UPDATE: After more feed back, I thought I would provide more info. Test is always after a fresh start. All factors are equal for each test. The only thing which changes is JVM. Repeating test multiple times gives consistent result. No GCs occurred in any test iteration.
Below is graphed values of one of the test runs. For both JRockit and Hotspot 7, the very first latency value was thrown out. JRockit has huge first value, but then very quickly optimizes and settles toward mean. Hotspot 7 takes longer to optimize, and never drops to a mean as low as JRockit. Each data point represents microseconds to read a message from TCP/IP socket, run through business logic, and write message on another socket. Every message is identical, and no new code paths are entered for any message.
-Xms40768M -Xmx40768M
. We have some other args, but they are pretty obscure:-Dsun.rmi.dgc.server.gcInterval=54000000 -Dsun.rmi.dgc.client.gcinterval=54000000
– Gramicidin[10, 9, 11, 2000, 12]
which will completely ruin the average. While it need not be the case, it's generally a good idea to avoid such problems by at least computing the standard deviation as well. That said it's certainly imaginable that JRockit is better than hotspot in some things, couldn't say. – Insolate-XX:CompileThreshold=1000
) and running with-XX:+PrintCompilations
to see what was being compiled? – Crock