Java tips

  • java -version => check to see if the default is a “server” VM or a “client” VM. On my mac (the default is a server VM):
    $ java -version
    java version “1.6.0_26″
    Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
    Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)
  • Make sure that you are running 32 bit or 64 bit VM by running the following command:
    $ file /usr/bin/java
    /usr/bin/java: Mach-O universal binary with 3 architectures
    /usr/bin/java (for architecture x86_64):    Mach-O 64-bit executable x86_64
    /usr/bin/java (for architecture i386):    Mach-O executable i386
    /usr/bin/java (for architecture ppc7400):    Mach-O executable ppc
  • On Solaris, you would need to install 64 bit support explicitly (as of Solaris-Sparc 10). All you need to do is to download the 64 bit self installing sh file and run it in the same folder as the existing 32 bit installation.
  • To test the Virtual Memory that your process utilized run the following command:
    ps -eafl -o vsz,rss => here vsz: is the total memory including in RAM and rss: is the total memory in RAM.
  • To confirm the bitness (32 vs 64) of a running JVM process, use jinfo:
    jinfo -d64 -sysprops [pid]
    And look for “sun.arch.data.model = 64″ property.
  • To view the swap available, you need to either use top, vmstat (on solaris, check the swap column => that specifies the swap available)
  • On solaris, use prstat to figure out the no of threads that a process is spawning.

Leave a Reply

Your email address will not be published. Required fields are marked *

     

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">