Professional Documents
Culture Documents
Diagnose Performance
Issues
Claudio Miranda
Summa Technologies
3320
2
Objective
Disclaimer
Disclaimer 2
AGENDA
AGENDA
AGENDA
> Monitoring:
jmap
> GC Algorithm
> Monitoring:
jstat
> GC Activity
20
> -XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=heapdump.hprof
23
2
28
> Causes
– Low RAM memory
– Small heap
– Memory leak
> Fix
– More physical memory
– Make heap larger
– Fix memory leaks
31
> Causes
– Low memory for permanent generation area
– Classes on permanent generation are prevented to be collected
Classloader leak
> Fix
– Make permanent generation area, larger
– Disable hot deployment or class reloading – for classloader leak
32
> Cause
– Often is caused by JNI code
– No memory available to operating system
> Fix
– Reserve more memory to operating system
– Lower the heap size
33
> Cause
– Big stack size (-Xss)
– Small memory available
– Poor thread management
> Fix
– Make stack size smaller
– Reserve more memory to operating system
– Lower heap size
– Better thread management
Java 5 thread pool
34
> Cause
– Attempt to allocate an array that is larger than the heap size
> Fix
– Lower the array size
– Make heap larger
35
> Cause
– Too much time spent on GC (98%) and little heap (2%) to be free
> Fix
– Similar to “java heap space”
– Tune GC behavior
36
> Fix
– Adjust GC
– Make heap larger
46
AGENDA
AGENDA
General Tips
General Tips
> Don't panic yourself into the crazy bandwagon
> Try to have a good view of the overall computing system
– Infrastructure, operating system, daemons, firewalls, application servers,
configurations, what was working before
> Be careful to trust the information sources
> Don't prematurely tell the customer about the solution
> Critical understanding of the affected services and importance to the customer
> Get to know teams and respective leaders/managers
> Confirm reports told by other people
> Verify system settings
61
General Tips
> Understand how to use the tools and its output
> Don't depend on graphical consoles
> Have access to the application's source code
> Have a good decompiler (if the previous one fails)
> When notifying the customer about the issue, bring him the fix
– And have a happy customer
62
Questions ?
Claudio Miranda http://weblogs.java.net/blog/claudio
claudio@claudius.com.br