Open Source Performance Monitoring Tools, Tips and Tricks for Java
description
Transcript of Open Source Performance Monitoring Tools, Tips and Tricks for Java
Open Source Performance Monitoring Tools, Tips and Tricks for Java
Matt SecoskeConsultant - Bass & Associates
http://www.bass-inc.com
email: [email protected]
• Planning
• Process
• Tools
• Tips, Tricks
Agenda
Where does performance matter?
... where your business requires it.
Why don't we treat this like a test case?
1) Determine your performance goals
2) Create testing scenarios
3) Determine monitoring/profiling needs
4) Integrate into development process - continuous performance testing?
5) Integrate into production environment
Plan for Performance
•Hardware (web, app, db servers)- CPU- Memory- Cache Hits/Misses- Disk/Network speed
• Java Specific- GC- Application specific metrics
What to monitor
• Load Testing / Driving
• Logging / Log Analysis
•Contained Profiling (Profiler wraps Application)
• External Profiling (JVMPI)
• java.lang.instrumentation
Profiling Tools
•Decorates existing JUnit tests
•Great for running benchmarks against a particular test case (or cases) while refactoring.
•Not so great as an over-all monitoring solution
JUnitPerf
•Clusterable performance testing
• Stress, Load, Capacity and Functional Testing
•HTTP, Web Services, RPC, JMS, JUnit,
• Proxy for recording traffic (real users)
• Scriptable in Jython
The Grinder
Load Testing – Apache JMeter
• Easy
•Common (Web server logs)
• Affects environment (file I/O)
• Affects code
•Generally solved by N.I.H. code
• Accuracy
Log files / Analysis
Log4J or other logging tool +Aspects =simple, transparent, targeted
Logging Tools
•Handcarved (AspectJ, AspectWerkz)
• Java Interactive Profiler
•GlassBox Inspector
Aspect-based Logging Tools –
GlassBox Inspector
• Sun's new JVM profiling tool
• Part of NetBeans Profiler extension
• Local or Remote Profiling
• Limited JVM support (mainly 5.0+)
JFluid / NetBeans Profiler
NetBeans Profiler
• Test and Performance Tools Platform
• Local or remote profiling
•Requires JVM agent for remote
Eclipse TPTP
Eclipse TPTP
• Treat performance as a test casered bar – green bar – refactor
•Real-world data + Real-world usage patterns = accurate benchmarks
• Put in just enough metrics to get your performance measurements
• Performance Test != Production
• Keep some monitoring in production
Tips, Tricks
• Performance Monitoring, like most things in software development, is an iterative process.
• Initial setup will take longer than expected. Its worth it.
• “Premature optimization is the root of all evil” - Hoare, Knuth
• Know when and what to optimize – comes from experience and profiling
•Make performance a part of your development process
Final Thoughts
JMeter: http://jakarta.apache.org/jmeter
The Grinder: http://grinder.sf.net
JUnitPerf: http://clarkware.com/software/JUnitPerf.html
Log4J: http://logging.apache.org/log4j/docs/
GlassBox Inspector: https://glassbox-inspector.dev.java.net/
Java Interactive Profiler: http://jiprof.sourceforge.net/
NetBeans Profiler: http://www.netbeans.org/products/profiler/index.html
Eclipse TPTP: http://www.eclipse.org/tptp/
Links - Tools
“Add Object Cache Monitoring using JMX and Aspects” - Srini Penchikala
http://www.devx.com/Java/Article/29526
“Build your own profiling tool” - Andrew Wilcox
http://www-128.ibm.com/developerworks/java/library/j-jip/?ca=dgr-lnxw01JavaProfiling
“Performance monitoring with AspectJ, Part 1” - Ron Bodkin
http://www-128.ibm.com/developerworks/java/library/j-aopwork10/
“Continuous Performance Testing with JUnitPerf” - Mike Clark
http://www.javapronews.com/javapronews-47-20030721ContinuousPerformanceTestingwithJUnitPerf.html
Links - Articles