Wednesday, October 5, 2011

JVM Performance Tuning

It is just a methodological philosophy !

Simple 3 steps:

1) Watch
2) Observe
3) Change

Naaaaah ! Cant be so simple right?? True...

Thing to remember: Apart from other smart stuff JVM does like memory allocation, memory deallocation and much more, it is just an Instruction Set Generator and Interpreter based on your input code. So neater and smarter code(thoughtful usage of collections) improves JVM's performance!

Lets get into technical jargons:

1) Frame the problem

WHY DO YOU CARE????

2) Just try it

TWEAK GC OR JIT OPTIONS FOUND ON WEB

USE OPTIONS WITH DIFFERENT APPS TO UNDERSTAND THAN NOT ONLY JVM OPTIONS TUNE JVM PERFORMANCE BUT ALSO YOUR CODE


3) KISS principle

Those those who are not aware of KISS (Keep It Simple Stupid)
Incremental changes on the path to success


What you guys think CPU or Memory is the bottle neck for JVM???????

Out of Brain Cells (If you would have used to think about it!)???????

Don't worry simple answer to it is both !

CPU- Number of cores, CPI(Cycles Per Instructions), threading

I/O- Network Shared Capacity, Spinning plated in the loop...

You have to really think about latency vs throughput

Tips and Tactics:

1) Try to use performance measuring PROFILERS and JVM ANALYZERS !

2) Use java.util.concurrent but remember there is overhead of synchronization memory allocation

3) Do you really need synchronization. Vector vs ArrayList

4) Try to play around with GC (Garbage Collector). Most important calling System.gc() doesn't force GC to clean up. It just raises an I/O interrupt.

5) Think about data structure complexity. I would use HashMap/HashTable if I had to just search to achieve O(1) complexity.. Thats really affects JVM performance..

No comments:

Post a Comment