Jprofiler 8 & OVIRT
Agenda
• Why profiling
• Installing Jprofiler
– Connecting Jprofiler to OVIRT
• Analyzing the results
– CPU analysis
– Mem...
• "We should forget about small efficiencies, say
about 97% of the time: premature
optimization is the root of all evil"
–...
Profiler
• Connects to running code and instruments the
Java classes
• Application should run at least slower
than without...
private static void test1() {
String s = "";
for (int i = 0; i < 100; ++i) {
s = s + "a";
}
}
private static void test2() ...
Pretty Code vs. Fast Code
• What’s the clearer code?
• What’s the faster code?
Installing JProfiler
• We have licenses to Jprofiler 8.
• Contact me for serial number information
– We were asked not to ...
OpenJDK Issues
• Install Oracle Java 
• Update alternatives –config java or just the
jprofiler.sh script
# Uncomment the ...
Configuring OVIRT
• Jprofiler automatic configuration updates
jboss’s script files.
• Since we use ovirt-engine service, a...
Jprofiler main page
• Create a new session
Connection Page
Analyzing Information
• CPU
– Check method execution time – only Runnable or
any state
• Memory
– Who allocates which obje...
CPU
• CPU View
• Hotspots
– Inherent Time vs Avg Execution Time vs Num Of
Executions
CPU
CPU
Memory
• Allocated objects
• Monitor GC activity
Live Memory
Threads
• State
• Thread snapshot
Threads
Database Access
• Connection status
• Hot spots
Database
Other Monitoring Capabilities
• Network
• HTTP servlets
Alternatives
• Don’t want a profiler? That’s fine. Other tools
exist (can also assist in production):
– Jmap
• Heap status...
JProfiler8 @ OVIRT
JProfiler8 @ OVIRT
Upcoming SlideShare
Loading in …5
×

JProfiler8 @ OVIRT

837 views

Published on

Using JProfiler8 at the OVIRT project

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
837
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
21
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

JProfiler8 @ OVIRT

  1. 1. Jprofiler 8 & OVIRT
  2. 2. Agenda • Why profiling • Installing Jprofiler – Connecting Jprofiler to OVIRT • Analyzing the results – CPU analysis – Memory analysis – Threads analysis – Database analysis
  3. 3. • "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil" – Donald Knuth
  4. 4. Profiler • Connects to running code and instruments the Java classes • Application should run at least slower than without a profiler • Gives a very good insight on what's going on inside our code
  5. 5. private static void test1() { String s = ""; for (int i = 0; i < 100; ++i) { s = s + "a"; } } private static void test2() { StringBuffer sb = new StringBuffer(); for (int i = 0; i < 100; ++i) { sb.append("a"); } } private static StringBuffer sb = new StringBuffer(); private static void test3() { sb.setLength(0); for (int i = 0; i < 100; ++i) { sb.append("a"); } }
  6. 6. Pretty Code vs. Fast Code • What’s the clearer code? • What’s the faster code?
  7. 7. Installing JProfiler • We have licenses to Jprofiler 8. • Contact me for serial number information – We were asked not to publish S/N
  8. 8. OpenJDK Issues • Install Oracle Java  • Update alternatives –config java or just the jprofiler.sh script # Uncomment the following line to override the JVM search sequence INSTALL4J_JAVA_HOME_OVERRIDE=~/jre1.7.0_25 # Uncomment the following line to add additional VM parameters # INSTALL4J_ADD_VM_PARAMS=
  9. 9. Configuring OVIRT • Jprofiler automatic configuration updates jboss’s script files. • Since we use ovirt-engine service, add the following line: • I added it directly in /etc/init.d/ovirt-engine under engineArgs.extend, but other options are possible too -agentpath:/root/jprofiler8/bin/linux-x64/libjprofilerti.so=port=8849,nowait
  10. 10. Jprofiler main page • Create a new session
  11. 11. Connection Page
  12. 12. Analyzing Information • CPU – Check method execution time – only Runnable or any state • Memory – Who allocates which objects • Threads – To check for thread leaks, dead-locks, etc. • Database – To check for query execution time
  13. 13. CPU • CPU View • Hotspots – Inherent Time vs Avg Execution Time vs Num Of Executions
  14. 14. CPU
  15. 15. CPU
  16. 16. Memory • Allocated objects • Monitor GC activity
  17. 17. Live Memory
  18. 18. Threads • State • Thread snapshot
  19. 19. Threads
  20. 20. Database Access • Connection status • Hot spots
  21. 21. Database
  22. 22. Other Monitoring Capabilities • Network • HTTP servlets
  23. 23. Alternatives • Don’t want a profiler? That’s fine. Other tools exist (can also assist in production): – Jmap • Heap status – Jstack • Thread status – verboseGC • GC duration

×