jvm tuning and profiling
TRANSCRIPT
![Page 1: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/1.jpg)
JVM Tuning & Profiling
P E R F O R M A N C E T U N I N G
C A T A L O G
![Page 2: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/2.jpg)
C A T A L O G @ S N A P D E A L . C O M
Overview
![Page 3: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/3.jpg)
C A T A L O G@ S N A P D E A L . C O M H
Heap Structure
![Page 4: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/4.jpg)
C A T A L O G@ S N A P D E A L . C O M H
GC ProcessObject AllocationFilling up EdenCopying Referenced ObjectsObject AgingAdditional AgingPromotion
![Page 5: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/5.jpg)
C A T A L O G@ S N A P D E A L . C O M
HeapGC OVERHEAD
SURVIVOR SPACE
GC in java - a background job it will involve overheadCan be made faster by using parallelismCan be made faster by reducing heap size - at the cost of more frequent collections and reduced throughput
Helpful in buffering objects so as more and more objectsage expire in young gen as far as possible Main tunable - Survivor size & max age count
![Page 6: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/6.jpg)
C A T A L O G@ S N A P D E A L . C O M
Common Heap Switches-Xms - Sets Initial Heap Size-Xmx - Sets Max Heap-Xmn - Young Gen Size-XX:PermSize - Start Perm Gen -XX:MaxPermSize - Max Perm Gen-XX:+UseSerialGC - Depricated-XX:+UseParallelGC - -XX:+UseParallelOldGC-XX:+UseConcMarkSweepGC
![Page 7: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/7.jpg)
C A T A L O G@ S N A P D E A L . C O M
Common Heap Switches
-XX:ParallelGCThreads-XX:ParallelCMSThreads-XX:+UseG1GC - New Gen collector-XX:CMSInitiatingOccupancyFraction-XX:MaxTenuringThreshold=15-XX:SurvivorRatio=8
![Page 8: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/8.jpg)
C A T A L O G@ S N A P D E A L . C O M
Common Heap Switches
-XX:ParallelGCThreads-XX:ParallelCMSThreads-XX:+UseG1GC - New Gen collectorCMSInitiatingOccupancyFraction-XX:MaxTenuringThreshold=1-XX:SurvivorRatio=8-XX:+PrintGCDetails
![Page 9: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/9.jpg)
C A T A L O G@ S N A P D E A L . C O M
Tuning JVM HeapTradeoff - Responsiveness vs Throughput
Our Tuning Strategy - Read & Write
More the young gen - less promotions & more throughputMore Parallelism in old gen collector - more fragmentation
Admin Nodes - Throughput driven Web - Better latency for good 99, 95% iles
![Page 10: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/10.jpg)
C A T A L O G@ S N A P D E A L . C O M
Issues faced
![Page 11: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/11.jpg)
C A T A L O G@ S N A P D E A L . C O M
Profiling ToolsVisualVM - Monitor
![Page 12: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/12.jpg)
C A T A L O G@ S N A P D E A L . C O M H
Profiling ToolsVisualVM - Sampler/Profiler - Threads
![Page 13: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/13.jpg)
C A T A L O G@ S N A P D E A L . C O M H
Profiling ToolsVisualVM-Sampler/Profiler - CPU Hotspots
![Page 14: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/14.jpg)
C A T A L O G@ S N A P D E A L . C O M H
Profiling ToolsVisualGC - Realtime Heap Graphs
![Page 15: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/15.jpg)
C A T A L O G@ S N A P D E A L . C O M H
Profiling ToolsJava Mission Control-JVM Debugging in detail
![Page 16: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/16.jpg)
C A T A L O G@ S N A P D E A L . C O M H
Profiling ToolsSjk- Java Swiss Knife - CPU Profiling
![Page 17: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/17.jpg)
C A T A L O G@ S N A P D E A L . C O M
Profiling ToolsSjk- Java Swiss Knife - GC
SSA & STCAP
IOSTAT - Disk Stats
SSA - used for taking continuous stack trace dumpTakes thread dump in super dense filesCan be analyzed using stcapstcap - can be used to print complete trace or histogram
![Page 18: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/18.jpg)
C A T A L O G@ S N A P D E A L . C O M H
Profiling Toolsiostat -x 1 100 vda vmstat # pagefaultsdstat -lvrn 5 # All in one tool sysctl -A # Kernel netstat -punta / tcpdumpiftopsar , sar -q , sar -B , sar -b # historysar -f /var/log/sa/ strace
![Page 19: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/19.jpg)
C A T A L O G@ S N A P D E A L . C O M H
Profiling ToolsFio #Disk BenchmarkingSysbench # CPU Benchmarkingjstat/jmap for thread / heap dumpsOracle Java Mission ControlEclipse MAT / IBM MatJVisual VM with Visual GC jvmtop SJK - Java swiss knife - ttop, gc, stcap
![Page 20: JVM Tuning and Profiling](https://reader034.vdocuments.us/reader034/viewer/2022042510/58f062071a28abde2c8b4587/html5/thumbnails/20.jpg)
Thank You!