Wednesday, September 19, 2012

HotSpot VM Binaries: 32-Bit vs. 64-Bit

Yes. The following option is used to select the 64-bit compiler of HotSpot:
  • -d64
But, it's only good for the 32/64-bit hybrid JDK existing for some platforms (such as HP-PA, HPIA, and Solaris64).   This article tries to clarify the selection of the different flavors of compiler implementation with HotSpot on our selected platforms: Linux and Solaris.

32-Bit vs. 64-Bit


The main difference between 32-bit and 64-bit JVMs is the address space.  For 32-bit JVMs, memory address is limited to 4 GB.  However, the actual Java heap space available for a 32-bit HotSpot VM may be further limited depending on the underlying OS[2]:
  • Microsoft Windows
    • ~1.5 GB
  • Linux 
    • ~2.5 - 3.0 GB for very recent Linux kernels
    • ~2 GB for less recent Linux kernels
  • Solaris
    • ~3.3 GB
The actual maximums vary due to the memory address space consumed by both a given Java application and a JVM version.

On Solaris, there are three compilers for the VM:[4,5]
  • -client
  • -server
  • -d64
They are all installed in the same binary (or same Java Home) and you can switch between them with the above VM options.

On Linux, if you install the 32-bit binary, it has the -client and -server flavors. If you install the 64-bit binary, it has only the -d64 flavor. So, if you provide -d64 option on a 64-bit Linux binary, it's a no-op.

For example, I have a 64-bit binary installed on my Linux box.  Here is my JDK and JVM version information:

  java version "1.7.0_04-ea"
  Java(TM) SE Runtime Environment (build 1.7.0_04-ea-b17)
  Java HotSpot(TM) 64-Bit Server VM (build 23.0-b18, mixed mode)

Note that the wording is "64-Bit Server VM" because there is no such thing as a 64-bit client VM on either Linux or Solaris.

References

  1. Unable to load performance pack (Solaris 10)
  2. Java Performance by Charlie Hunt and Binu John
  3. weblogic.nodemanager. common.ConfigException Native version is enabled but node manager native library could not be loaded : NativeVersionEnabled
    • If you're switching from 32 bit JVM to 64 bit JVM  in WebLogic Server environment, the challenge is that the WLS native libraries installed are based on the JVM used to do the installation.  That means the native libraries will be 32 bit libraries that do not work with a 64 bit JVM.  This will also have performance/scalability implications. 
  4. Installing WebLogic Server on 64-Bit Platforms Using a 64-Bit JDK
    • (UNIX or Linux only) Include the -d64 flag in the installation command when using a 32/64-bit hybrid JDK (such as for the HP-PA, HPIA, and Solaris64 platforms). 
  5. Which JDK is my FMW 11g WebLogic Domain Configured to Use?
    • For 32/64-bit-hybrid JVMs on some platforms, you would have to include the -d64 flag to tell the JVM to run in 64-bit mode.

No comments: