Thursday, April 26, 2012

Handy Jmap command options

Heap Space

jmap -heap pid
- To get Heap details. Here look at the section named - "PS Old generation" -  if its above 90% then fire the next two commands in that order

jmap -histo pid
For each Java class, number of objects, memory size in bytes, and fully qualified class names are printed. VM internal class names are printed with '*' prefix. This helps to find who is occupying the heap.
If If the live suboption is specified, only live objects are counted
Note - jmap –histo:live triggers a FULL GC as compared to jmap -histo

jmap -dump:live,format=b,file=file name pid
jmap -dump:format=b,file=file name pid

The dump can be equal to the size of the heap set. For e.g. 3 GB hence ensure that much disk space is available.  One of the ways to view the dump is using a IBM heap dump analyzer which shows top leak suspects. Its been observed that the memory required to open the dump is usually at least twice as the size of the dump.

Permanent Generation Space

jmap –permstat pid

Thursday, April 12, 2012

Anomaly Detection - Fault Tolerance - Anticipation Patterns

Sharing the four cornerstones of anomaly detection, fault tolerance and anticipation pattern. I came across this in one of the many presentations floating on the web.

1. Anticipation - Knowing What To Expect

- During choice of technologies
- During design of monitoring and metrics
- During design of architecture

2. Monitoring - Knowing What To Look For
3. Response - Knowing What To Do
4. Learning -Knowing What Has Happened

Areas of redundancy -

Spatial (server, network, process)
Temporal (checkpoint, “rollback”)
Informational (data in N locations)

Wednesday, April 4, 2012

Detecting .NET application memory leaks

I came across an article that talks about a utility named debugdiag that helps to take a heap dump of a .NET application and view the dump in a html format.

www.dotnetfunda.com/articles/article625-best-practices-no-5-detecting-net-application-memory-leaks.aspx

Also, found a way to test a desktop based .NET application using AutoIT and turning ON the Perfmon logs for monitoring key performance counters like CPU, Memory, Private bytes of process, .NET gen0, gen1 and gen2 space and collections.