VISUALISING GARBAGE
COLLECTION USING VISUAL VM
LUIZ TESTON, WWW.FRACTA.CC
BEFORE
WE START
MANDATORY ITEMS TO REPRODUCE THE STEPS ON THE GC WORKSHOP
▸ JDK >= 1.5
▸ Visual VM + Visual GC plugin
▸ Jetty (or any other Java application to measure)
▸ Apache Bench “ab” or any other stress application
▸ credentials: cam20jan16 / AJtmN5d3
DISCLAIMER
▸ The objective is to visualise different GC configurations and
how they affect the application execution and the GC
behaviour itself.
▸ The stress tools are here just to help objects being created
and destroyed by the application.
▸ We are not benchmarking jetty.
▸ We are not benchmarking http.
▸ We are not benchmarking at all.
RECIPES TO TRY
RUN YOUR APP
STRESS IT
VISUALISE IT
VM ARGUMENTS TO TRY
▸ -Xmx<size>[m|g]
▸ -Xms<size>[m|g]
▸ -XX:NewSize=<size>[m|g]
▸ -XX:+UseSerialGC
▸ -XX:+UseParallelOldGC
▸ -XX:+UseConcMarkSweepGC
▸ -XX:+UseParallelGC -XX:+UseNUMA
▸ -XX:+UseG1GC
SCREENSHOTS
<no args>
-Xmx2G -Xms2G
-Xmx7G -Xms7G
-Xmx1G -Xms1G -XX:NewSize=800m
-Xmx1G -Xms1G -XX:NewSize=800m -XX:+UseSerialGC
-Xmx1G -Xms1G -XX:UseParallelOldGC
-Xmx1G -Xms1G -XX:+UseConcMarkSweepGC
-Xmx1G -Xms1G -XX:+UseParallelGC -XX:+UseNUMA
-Xmx1G -Xms1G -XX:+UseG1GC
QUESTIONS? THANKS FOR YOUR TIME!
▸ http://docs.oracle.com/javase/8/docs/technotes/guides/
vm/gctuning/index.html
▸ mechanical-sympathy.blogspot.com/2013/07/java-
garbage-collection-distilled.html
▸ https://visualvm.java.net
▸ fotos: Dani Teston

Visualising Gargage Collection using Visual VM