Monday, October 12, 2009

Performance analysis of web application

Performance analysis of web application

1. Comparison between TPTP and Visual VM.
TPTP tool is a plug-in in eclipse which is open source.
Visual VM comes with JDK 6.0.12 onward.

TPTP >>
Can be used for
1. Execution Time analysis
2. Memory Analysis
3. Thread analysis

Used for one application at a time
Reports can be exported in EXCEL , HTML ,XML

Reference http://www.eclipse.org/tptp/



Visual VM >>


Mainly used for Memory analysis (heap space and perm gen space)
Can be used to all applications running on JVM.
Only image snap shots can be taken.

Reference http://java.sun.com/javase/6/docs/technotes/guides/visualvm/



1. Execution Time analysis
In this we can analyze the a method in class
1. Number of times called
2. Average time taken in each call
3. Call tree for method

Ø For locating hot spot –
· Analyses a method which requires more time to execute and it is called many times.
· Optimize the code logic and again analyze the same to verify that time taken a method execution is less than previous method.

Tools used –
TPTP tool is used. Refer TPTP execution online documentation from eclipse's site.

2. Memory Analysis
In this we can analyze
· CPU Memory
· Heap space and PermGen of JVM.
· Number of classes loaded
· Total number of threads

JVM memory details diagram à




· Heap Memory
In this one can monitor heap memory where new/old objects are kept.
This is used for analyzing exception called – java.lang.OutOfMemoryError

PermGen Memory
· This memory is used while loading classes are loaded in JVM, example while generating PDF.
This analysis can be used to determine cause for exception - java.lang.OutOfMemoryError: PermGen space

Tools used –
Visual VM or Jconsole is used. Refer document memory profile using Visual VM.

Ø Locating memory leak –
· Analyze the number of objects on each class and their average age.
· Objects which are user specific should be cleaned when used logs out from web application.
· Check for unnecessary object references in memory which are less frequently used like cache.

3. Thread analysis
In this analysis we can see
· Total number of threads in application
· Block and wait time of each thread
· Thread start, stop, and wait with timescale.
· Dead lock between threads if there is any.
This analysis can be used to determine thread dead lock, Thread interaction and data corruption due to simultaneous data update.
Tools used –
TPTP tool
Visual VM.

--- Nilesh Salpe