The Developer Swiss Knife: TroubleshootingTools for Java EE Applications
Assumptions•This presentation aims experienced developerswith a little (but good) knowledge about how theJVM works•The pre...
The Application stackOur primary focus
The Tools•JDK CLI Tools (jstack, jmap, jps, etc.)•JDK GUI Tools (JVisualVM, JConsole)•Eclipse Memory Analyzer Tool (MAT)•T...
JDK has its own troubleshooting tools● jps● jmap● jinfo● jhat● jstack
Some of them are Graphical● JConsole● JVisualVM
What should I do when my application has amemory problem?
Generating a Heap Dump● -XX:-HeapDumpOnOutOfMemoryError● jmap● JVisualVM
Ok, I have a Heap Dump. Now can I analyze it?
Meet Eclipse MAT
What should I do if my application have a CPUproblem? e.g. High CPU consumption
Generating a Thread Dump● jstack● kill -3● AS7 CLI command:– /core-service=platform-mbean/type=threading:dump-all-threads(...
Now with a Thread Dump, what should I do withit?
Samurai – A Thread Dump viewer
High CPU consumption can be high GC activity
Enabling GC Logging● Add to java command:-XX:+PrintGC -Xloggc:gc.log -XX:+PrintGCDetails-XX:+PrintGCTimeStamps
GC Log content3.122: [GC 132096K->24592K(504320K), 0.0321910 secs]4.558: [GC 156688K->26752K(504320K), 0.0340520 secs]6.60...
Garbagecatjava -jar garbagecat-1.0.0.jar --helpusage: garbagecat [OPTION]... [FILE]-h,--help help-o,--options <arg> JVM op...
Garbagecat report========================================Throughput less than 90% for PARALLEL_SCAVENGE===================...
Applications also might have classloadingproblems
Tattletale
JBoss AS7 has JDR
Wait a minute! I tried to run jvisualvm in OpenJDKand it says “command not found”
Thermostat – The next heat
Please Remember● Dont develop applications without make useof testing approaches (unit, integration,functional, ...)● Alth...
The links● http://icedtea.classpath.org/wiki/Thermostat● http://eclipse.org/mat/● http://yusuke.homeip.net/samurai/en/inde...
Thank you!
What about Byteman?
Race Condition Tests with BytemanFlávia RainoneDont miss it!
Jud con presentation_brazil
Upcoming SlideShare
Loading in …5
×

Jud con presentation_brazil

535 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
535
On SlideShare
0
From Embeds
0
Number of Embeds
124
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Jud con presentation_brazil

  1. 1. The Developer Swiss Knife: TroubleshootingTools for Java EE Applications
  2. 2. Assumptions•This presentation aims experienced developerswith a little (but good) knowledge about how theJVM works•The presentation focus only on the tools, not onthe troubleshooting methods•Some of the tools are only for Linux. Windowsusers, get out! =P•All tools presented in this presentation are OpenSource projects and some of them aredeveloped by JBoss
  3. 3. The Application stackOur primary focus
  4. 4. The Tools•JDK CLI Tools (jstack, jmap, jps, etc.)•JDK GUI Tools (JVisualVM, JConsole)•Eclipse Memory Analyzer Tool (MAT)•Thermostat•Garbagecat•Samurai•AS7 JDR (JBoss Disaster Report) tool•Tattletale•Byteman*
  5. 5. JDK has its own troubleshooting tools● jps● jmap● jinfo● jhat● jstack
  6. 6. Some of them are Graphical● JConsole● JVisualVM
  7. 7. What should I do when my application has amemory problem?
  8. 8. Generating a Heap Dump● -XX:-HeapDumpOnOutOfMemoryError● jmap● JVisualVM
  9. 9. Ok, I have a Heap Dump. Now can I analyze it?
  10. 10. Meet Eclipse MAT
  11. 11. What should I do if my application have a CPUproblem? e.g. High CPU consumption
  12. 12. Generating a Thread Dump● jstack● kill -3● AS7 CLI command:– /core-service=platform-mbean/type=threading:dump-all-threads(locked-monitors=true,locked-synchronizers=true)
  13. 13. Now with a Thread Dump, what should I do withit?
  14. 14. Samurai – A Thread Dump viewer
  15. 15. High CPU consumption can be high GC activity
  16. 16. Enabling GC Logging● Add to java command:-XX:+PrintGC -Xloggc:gc.log -XX:+PrintGCDetails-XX:+PrintGCTimeStamps
  17. 17. GC Log content3.122: [GC 132096K->24592K(504320K), 0.0321910 secs]4.558: [GC 156688K->26752K(504320K), 0.0340520 secs]6.609: [GC 158848K->50117K(504320K), 0.0628430 secs]7.077: [GC 80334K->54921K(504320K), 0.0416730 secs]7.119: [Full GC 54921K->46716K(504320K), 0.2522170 secs]8.510: [GC 178812K->60924K(504320K), 0.0190690 secs]9.683: [GC 193020K->69447K(461696K), 0.0308020 secs]
  18. 18. Garbagecatjava -jar garbagecat-1.0.0.jar --helpusage: garbagecat [OPTION]... [FILE]-h,--help help-o,--options <arg> JVM options used during JVM run-p,--preprocess preprocessing flag-s,--startdatetime <arg> JVM start datetime (yyyy-MM-dd HH:mm:ss,SSS)for converting GC logging timestamps to datetime-t,--threshold <arg> threshold (0-100) for throughput bottleneckreporting
  19. 19. Garbagecat report========================================Throughput less than 90% for PARALLEL_SCAVENGE========================================18020.492: [GC [PSYoungGen: 161888K->1376K(166016K)] 949359K->789159K(1214592K), 0.0294550 secs]...========================================SUMMARY:========================================# GC Events: 46044GC Event Types: PARALLEL_SCAVENGE, PARALLEL_SERIAL_OLDMax Heap Space: 1566912KMax Heap Occupancy: 1562164KMax Perm Space: 77864KMax Perm Occupancy: 46645KThroughput: 99%Max Pause: 4098 msTotal Pause: 1703657 msFirst Timestamp: 4616 msLast Timestamp: 232465068 ms========================================0 UNIDENTIFIED LOG LINE(S):
  20. 20. Applications also might have classloadingproblems
  21. 21. Tattletale
  22. 22. JBoss AS7 has JDR
  23. 23. Wait a minute! I tried to run jvisualvm in OpenJDKand it says “command not found”
  24. 24. Thermostat – The next heat
  25. 25. Please Remember● Dont develop applications without make useof testing approaches (unit, integration,functional, ...)● Although all testing efforts, there is no 100%bug free applications● For all unpredictable and complex problems,this presentation will help you troubleshoot, ifnot all, most of the problem
  26. 26. The links● http://icedtea.classpath.org/wiki/Thermostat● http://eclipse.org/mat/● http://yusuke.homeip.net/samurai/en/index.html● https://code.google.com/a/eclipselabs.org/p/garbagecat/● http://docs.oracle.com/javase/7/docs/index.html● http://www.jboss.org/tattletale● http://jboss.org/bytemanTwitter: @rimolivehttp://aprendendo-cloud-computing.blogspot.com
  27. 27. Thank you!
  28. 28. What about Byteman?
  29. 29. Race Condition Tests with BytemanFlávia RainoneDont miss it!

×