tags:

views:

909

answers:

10

For Java SE there are several JVM's available for running in production on x86:

plus some custom offerings for running on a server:

Other platforms:

  • Sun Solaris JVM - better scalability than x86?
  • (edit) GNU compiler for Java - http://gcc.gnu.org/java/ - can compile to native code on multiple platforms.

The Sun JVM has a distinct advantage with the jvisualvm program, which allows runtime inspection of running code. Is there any technical advantages of any other JVM that might make it a better choice for development and/or production?

In other words, is there a killer facility or scenario that would make any investment of time/effort/money worth it in another JVM?

(Please also suggest additional JVM's if they would be a good choice).

+4  A: 

Not strictly a JVM, but still a Java implementation: gcj. It has the advantage of supporting many processors, so if you target one of the embedded processors, gcj may be your only choice. Plus, since it is a true compiler (not just a JIT), you save the overhead of JIT compilation (both in memory and cycles) on the embedded target.

Martin v. Löwis
Problem with gcj is that it is based on GNU Classpath (as far as I know) which has not passed the TCK (Suns test for Java compliency). I'll add it to the list.
Thorbjørn Ravn Andersen
+2  A: 

From what I've been told, the main difference with Sun's JVM and IBM's JVM is in the actual garbage collectors, IBM's garbage collector(s?) are much more configurable than Sun's and are made only the business world in mind. Additionally IBM's JVM can tell a lot more than "I just crashed, here's my heapdump" in error situations which is obviously important in the business world which is the main living space of IBM's JVM.

So assuming I haven't been lied to, I'd say that IBM's JVM should be used when doing memory-intensive things in business software which relies on aggressive or otherwise highly tunable garbage collection.

Esko
More configurable than the Sun JVM? Sun's JVM must have 20+ configurable parameters. Having even more is not a good thing. http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html
jonathan-stafford
Sometimes the level of configurability is the difference between crashdumping and stable software, good example being the odd way Sun's JVM handles native DOM elements (hint: poorly, gc:s at the last possible moment instead of granulary piece by piece). Then again I had a nice chat with a pleasant IBM representative about these issues some time ago so that's purely what I base my "knowledge" on.
Esko
+3  A: 

Back in the Java 1.4 days my team used the IBM JVM for a high-volume, message-based system running on Linux. Why did we do this? Because we benchmarked the different JVMs! JRockit was actually the fastest, but it would occasionally crash, so not so great for production.

As always with these things, measure it!

hbunny
I was not thinking as much in speed, but in facilities that help. I believe that Sun has a killer application in jvisualvm, and I was wondering if I missed something similar in other offerings.
Thorbjørn Ravn Andersen
Back in those days, I used the IBM JVM because it did nice heapdumps, but I used JRockit for speed and stability. (I know it has a bad reputation, but we experienced less crashes than Sun or IBM).
Nicolas
For the record, JRockit used to be fast but somewhat unstable but IMHO it is really solid and stable nowadays and deserves a second chance.
Fredrik
Life is unfair - you often don't get a 2nd chance.
hbunny
@stevendick: True, especially since they became part of the same organization as the Sun JVM. I think we will soon see the last of it.
Fredrik
+8  A: 

IBM J9

This is the kind of sales speech you can read or hear about J9:

IBM has released an SDK for Java 6. Product binaries are available for Linux on x86 and 64-bit AMD, and AIX for PPC for 32- and 64-bits. In addition to supporting the Java SE 6 Platform specification, the new SDK also focuses on, Data sharing between Java Virtual Machines, Enhanced diagnostics information, Operating system stack backtraces, Updated jdmpview tool, platform stability, and performance.

Some would say that the IBM SDK has some advantages beyond speed, that the use and expansion of PermGenSpace is much better than in the Sun SDK or GCJ (not a big deal for client applications, but heavy lifting J2EE servers, especially portal servers, can really cause the Sun JDK heartburn). But, according to this paper comparing Sun vs IBM JVM GC, it turns out that memory performance depends mostly on the application and not so much on the VM.

So, while it's true that the IBM JVM is well known for its troubleshooting features (more advanced than Sun's JVM), I'm not convinced by the differences at the GC level.

And Sun's JVM has a big advantage over IBM, at least on Solaris: DTrace providers. Actually, I've been mainly working with Weblogic on Solaris so Sun' JVM has always been the natural choice.

Oracle JRockit

I did some benchmarks of BEA/Oracle JRockit some years ago and it was indeed a fast VM and it was then supporting bigger heaps than Sun's VM at this time. But it has some stability problems which is not really good for production. Things might have changed since then though.

Apache Harmony

I might be wrong but, to me, Harmony is made of code donations from IBM (benefits: the community is doing maintenance) and I don't really see why I should consider Harmony rather than IBM J9.

Apple's JDK

I never had to use Mac for production so I can't really answer. I just remember Apple needed some time to bundle Java 6, and I don't know why. This is maybe not rational but this makes me suspicious.

OpenJDK

I know that some vendor are offering production support (e.g. RedHat with RHEL 5.3+, see this blog entry) for OpenJDK so it might be an option for platforms not supported by Sun. However, unless someone can tell me what makes OpenJDK work better than Sun's, I think I'll install Sun JVM on supported platforms.


So to me, the choices are actually: Sun's JVM unless I've to run some Websphere stuff, in which case I'd choose IBM J9. But to be honest, I've never faced a situation that I couldn't solve on a Sun's JVM and that could have justified (temporary) swapping to IBM' one so I can't actually tell if the troubleshooting features are that nice. But I admit that I may suffer from a lack of knowledge of IBM's JVM.

Pascal Thivent
Thank you for listing the options. I was not looking for a comparison or suitability, but a "hey, THIS is so much better than everything else!".
Thorbjørn Ravn Andersen
dTrace - I explicitly asked Kirk Pepperdine if dtrace had ever helped him with a Java performance issue. He said, "Never". The iostat and vmstat tools provide enough information to determine system bottlenecks.
Thorbjørn Ravn Andersen
Well, to *my* knowledge, there is no such ultimate thing. But people may have a different opinion so I'll follow this thread very carefully. Regarding dTrace, coming from Kirk Pepperdine, that's a very interesting feedback. Thanks for sharing this.
Pascal Thivent
The problem with dtrace and java as I understand it is that the additional things you can learn are low-level and relevant for those _implementing_ the JVM, not those _using_ the JVM. If you can see that "writing to disk is the bottleneck" then it will not make you much wiser to know the name of the C routine doing the work, if you would simply wrap a Writer with a BufferedWriter anyway.
Thorbjørn Ravn Andersen
@Pascal - I don't know much about the technical details of Harmony (or how much code is common to IBM's JRE), but the terms of distribution are likely to come into play if you were choosing between the two.
McDowell
@McDowell Absolutely true. Good point.
Pascal Thivent
+2  A: 

In my own experience and at face value, I see simplicity in the IBM GC design. Sun's various and new GCs are excellent no doubt and offer a host of tuning options at minute levels, but even in some of the most active web apps I know that handle heavy/aggressive new objects and keep a lot in the heap for cache I rarely see GC ever exceed 1% even trying to keep the footprint low. Sure we could probably tune it better but there's a diminishing return.

I have had much more of a challenge in the exact same applications running IBM's JDK. In particular having issues with pinned clusters and having to tune -Xk.

Now I could mention about a dozen items that both IBM and Sun should implement for the killer JVM but not the scope of your question I presume :)

Xepoch
+8  A: 

JRockit comes with JRockit Mission Control, which is a tools suite you can use to monitor the JVM and your application. You can download it here, it's free to use for development.

Mission Control has a lot of features that VisualVM is missing, for instance an online memory leak detector, a latency analyzer, Eclipse integration, JMX.logging to file. etc. If you want to compare VisualVM with Mission Control here are the release notes and the documentation for the latest version.

Kire Haglin
Chosen since this answer explicitly list a tool providing functionality I did not know already.
Thorbjørn Ravn Andersen
+2  A: 

Incremental garbage collection and very small runtime size for realtime embedded systems is the only thing that would really matter enough to warrant chancing less stability or platform support. There was some jvm with this in mind but I forget its name now.

Charles Eli Cheese
Have you by chance recalled its name?
Thorbjørn Ravn Andersen
+3  A: 

A few years back (JDK1.4), different JVMs had different advantages:

  • the IBM JVM was able to do heap dumps (programatically, on signals, or on OOM), and the heaproot utility was very useful to track memory leaks (less intrusive than profilers). No other JVM had this.

  • JRockit had many useful options that the Sun JVM didn't have, parallel collection. It was also (much) faster (and more stable than the Sun VM).

Today, the Sun one has these features, but I'm sure there are others. Speed could be one. Garbage collection strategies another.

If you're using WebLogic, some bugs in the Sun JVM may lead to bugs in WebLogic. These bugs are more likely to be solved faster in JRockit.

Nicolas
+5  A: 

Some applications, like financial and computational science would benefit greatly from hardware implementations of decimal floating point. IBM has rolled out a series of processors (POWER6, the z9 and z10 mainframes) which implement the IEEE 754-2008 decimal floating point standard. The latest IBM JDK can use hardware acceleration for BigDecimals.

To allow developers to easily take advantage of the dedicated DFP hardware, IBM 
Developer Kit for Java 6 has built-in support for 64-bit DFP through the 
BigDecimal class library. The JVM seamlessly uses the DFP hardware when 
available to remove the need for computationally expensive software-based decimal
arithmetic, thus improving application performance.

It's a very fringe case, but if you have a z10 mainframe handy and want to use its decimal floating point unit in Java, then the IBM JVM would be a better choice than the Sun JVM.

-- Flaviu Cipcigan

Flaviu Cipcigan
I'd generalize that: on IBM hardware that's not Intel-based, the IBM JVM is almost always the better choice (and more often than not the only choice).
Joachim Sauer
+4  A: 

The typical feature/scenario that you should look at is performance and speed.

No matter what the white papers say, ultimately you need to benchmark and decide for yourself.

I am biased towards IBM, because I worked there a few years ago. I didn't personally deal with jvm development, but I remember that the emphasis of the jvm development group was on the following points:

  • Proprietary garbage collection optimizations. This includes not only faster GC, but also more configuration options, like GC for server and client. This was before Sun offered similar options.
  • Much faster (x10) native performance with the JNI interface. This was particularly important at the time when Eclipse/WSAD began to gain traction and swt was heavily used. If your app uses JNI a lot, then I think it's worth while for you to benchmark the IBM jdk against the Sun jdk.
  • Stability and reliability. I think this is only relevant if you buy commercial support from IBM, like SLA for a service tier (WebSphere and db2, clustered environment, etc.). In this case, IBM will guaranty the stability of their offering only if you use their jvm.

Regarding OpenJDK, I recommend that you look at this history of OpenJDK. My understanding is that OpenJDK 7 will be almost identical to Sun's jdk 7, so the performance is very likely to be identical. The primary differences will be licensing, and small components like webstart.

Oracle's jvm is useful if you want to run java code from within your database (via stored-procedure). It includes some optimizations that help the db run faster in this scenario.

As others have said, Sun has been catching up on their competitors. I think that in the 1.4 days the differences were much more noticeable, but no so much today. Regarding jvisualvm, other vendors also offer similar tools, so I don't think that is an issue.

Finally, there is one other metric (albeit a bit controversial) to indicate how serious are those vendors about their VM's. That is the number of related patents that they issue. It might be useful if you need to convince your boss, or if you like to read patents :)

Patent search: ibm and java - 4559 patents.

Patent search: oracle and java - 323.

Yoni