Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Profiling - Heap & GC between Linux and Windows

 
Sudatta Gautham
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I was trying to profile as well as evaluate different versions of Java for my app.
Started the app with '-Xms 100 -Xmx 300' on windows. With JDK 1.4 with a few transactions, this memory was used up and GC had to kick in. This repeats with transactions.
Switched to JDK 1.5. This time, even with lot of transactions, the heap mem used stayed below 10M! And you could see partial GC kicking in at times.

This proved a considerable improvement. Hence thought of trying this out on Linux, which is my deployment environment.
Started the app with '-Xms 100 -Xmx 300'. But this time, on both JDKs with a few transactions, this memory was used up and GC had to kick in. This repeats with transactions!

I wonder why the significant performance difference is not showing in Linux?

Apart from -Xms and -Xms I am not using any other VM options. Any insight is helpful.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sudatta, welcome to Java Ranch!

Are you sure that you were running the 1.5 JVM on Linux? It should run the same on Windows and Linux (there are platform differences, but not any that I know of in the heap management area).

Try adding the -showversion option to the command line to ensure you are running the version you think you are.
 
Sudatta Gautham
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Peter

On Linux Adding -showversion shows

JProfiler> CPU profiling enabled
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

On Windows
java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode)

So linux is using "Mixed mode, sharing" and Windows is using just "mixed mode". That is the only difference.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are running different versions - update 6 on Linux and update 16 on Windows.
 
Sudatta Gautham
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good catch!
So I tried running the same test on Windows with JDK 1.5.0_06. I still see the same performance improvement as that of 1.5.0_16-b02.

JProfiler> CPU profiling enabled
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
JProfiler> Hotspot compiler enabled

Another critical difference that I forgot to mention earlier is in case of windows I am starting my app THROUGH Jprofiler. For Linux it is remote-integrated. I have also posted a question to Jporfiler to see if they have anything to say on this.

Thanks
Gautham
 
Sudatta Gautham
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just another interesting update. I tried to see if this could be a problem with they profiling tool is running/controlling the VM. I repeated the exercise on Jprobe. This time on both JDK 1.4 and 1.5 the app memory stayed below 10 MB!!!

I will try running app as remote app and try again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic