One problem with 64-bit Java is the amount of Memory it occupies. As of 2011 we feel that all the majority of application profiles we have encountered do not require 64-bit Java as they often do not take advantage of using more than than 1-2GB of memory. Also, we have observed that when a Java Application has access to a large amount of memory, the application gets bogged down when garbage collection occurs. As explained by Oracle, "... every native pointer in the system takes up 8 bytes instead of 4".
Note |
---|
This has improved due to newer algorithms such as concurrency, parallelization and generational collection. However we observe there is still significant impact. |
As suchGenerally, in many cases it is also better to scale horizontally (running multiple JVMs) as opposed to using one giant JVM. This point is true for both 32-bit and 64-bit JVMs.
At least in the cloud based environments we use, where memory is a premium, 32-bit Java makes more sense.
Just to be clear, you still should use a 64-bit Operating Systems. A 64-bit Operating System will allow a 32-bit JVM to come closer to the theoretical 4GB memory limit and of course take full advantage of the system memory.
Note |
---|
We have not encountered in our own benchmarking, but here is a an example of 64-bit Java performing better than 32-bit Java on a 64-bit OS. The accepted theory here is that this is due to the emulation mode required by the 64-bit OS to run 32-bit Java. Again, we have yet to have encountered this in our usage. |
JVM | Operating System | Maximum Heap Size | Reference |
---|---|---|---|
32-bit | 32-bit Windows | 1.4GB to 1.6GB | |
32-bit | 32-bit Solaris | 2GB | |
32-bit | 64-bit Solaris | Approaching 4GB | |
32-bit | 64-bit Ubuntu |
|
|
...
No, the point is to closely look at your application profile, user base and hardware and determine if you really do need to use a 32-bit or 64-bit JVM.makes sense. In some cases, 64-bit is actually faster (depending on the hardware and OS).
It has just been in our experience that often our profiles fall in,
...