Good article about general approach of finding leaks
http://www.toptal.com/java/hunting-memory-leaks-in-java
1) In every jvm should be enabled following flags, to gather statistics:
http://www.toptal.com/java/hunting-memory-leaks-in-java
1) In every jvm should be enabled following flags, to gather statistics:
-XX:-PrintGCDetails
-XX:+PrintGCTimeStamps-Xloggc:gc.log or -verbose:gc
-XX:+PrintGCTimeStamps-Xloggc:gc.log or -verbose:gc
2) To read gc logs https://github.com/chewiebug/GCViewer
metrics:
throughout - the percent that your application works vs garbage collector
largest pause - the pause when gc works and your app is not responding
3) most used ways to solve memory problems
a) solve memory leaks problems, see article
b) Xmxn - enlarge heap size
c) change garbage collector algo, in general about GC's
Parallel GC - bad largest pause but good throughout
CMS - good pause but bad throughout
G1 - soon will be default, should be used from jvm8+, for jvm 7 still not so good
sometimes:
-XX:OldSize - the amout of data alive after Major GC, should be:
for Parallel GC XX:OldSize = LiveSet * (1,2 - 1,5)
for CMS GC XX:OldSize = LiveSet * 2
^where LiveSet - amout of memory after Major GC
More links:
More about verbosegc
Dump heap to file when java.lang.OutOfMemoryError is throw
-XX:+HeapDumpOnOutOfMemoryError and use Heap Analyzer tool
metrics:
throughout - the percent that your application works vs garbage collector
largest pause - the pause when gc works and your app is not responding
3) most used ways to solve memory problems
a) solve memory leaks problems, see article
b) Xmxn - enlarge heap size
c) change garbage collector algo, in general about GC's
Parallel GC - bad largest pause but good throughout
CMS - good pause but bad throughout
G1 - soon will be default, should be used from jvm8+, for jvm 7 still not so good
sometimes:
-XX:OldSize - the amout of data alive after Major GC, should be:
for Parallel GC XX:OldSize = LiveSet * (1,2 - 1,5)
for CMS GC XX:OldSize = LiveSet * 2
^where LiveSet - amout of memory after Major GC
More links:
More about verbosegc
Dump heap to file when java.lang.OutOfMemoryError is throw
-XX:+HeapDumpOnOutOfMemoryError and use Heap Analyzer tool
No comments:
Post a Comment