[NFJS Denver] Mike Clark and Continuous Performance Testing
I'm sitting in Mike Clark's Continuous Performance Testing talk right now and he's telling us about his experience with performance optimization. Unfortunately, there's wireless access in this hotel's lobby, but not in the (small) rooms. This post is being sponsored by Bluetooth and my T68i. There's two traditional methods of performance tuning - pre-optimization and after-the-fact. He's pointing out that it's most important to have well-factored code - then when you do decide to do performance optimization, it's simply easier to do.
I had lunch with Bruce and Rod Cope (my new boss) has joined us in this talk. It's cool to be engrossed in Java with my friends and peers. Choices for this first session included: EJB CMP, JDO and Hibernate (Bruce Tate), JSF (David Geary), Naked Object (Dave Thomas), Continuous Performance Testing (Mike Clark) and Practical J2EE Security (Tom Marrs).
Back to the talk - Mike is talking about JUnitPerf and how it works. JUnitPerf looks pretty easy to use, below is a simple test.
public class TunesTimedTest {
|
Looks pretty simple huh? I'm assuming that the Test
and TimedTest
classes are part of JUnitPerf. Next up - Profilers. Use a profiler when your performance tests fail. Low tech profiling (we've all done this) - using System.out.println with a variable and some math that prints out how long it took for a method to run. Even better - using a "Profiler" utility class that does that math for you and has start() and end() methods. Medium-Tech Profiling - JVMPI using -Xhrunprof. It spews out a whole bunch of information so you can see how long methods take to run. The problem with it? It spits out ALL the information from the JVM and your class/methods end up at the bottom of the stack. Sounds like too much information for me. Mike's take: hprof is a sledgehammer that is basically unusable in a J2EE environment. In JDK 1.5, JVMPI is going to go away and it will be replaced with JVMTI (Tool Interface). He also mentions JFluid and Dynamic Bytecode Generation
High-Tech Profiling: JProfiler, OptimizeIt, JProbe - all of which use JVMPI. Mike likes JProfile b/c it's cheap and recommends looking at javaperformancetuning.com for open source tools.
Performance Testing Cycle
- Choose a measurable performance goal
- Write an automated performance test
- Run the test to baseline performance
- Profile the code to identify hot spots
- Tune one thing
- Run the test again to measure progress
- Repeat until performance goals are met
As I blog Mike's presentation, I'm starting to realize there's probably not much point to doing what I'm doing - regurgitating his presentation on the web. A better way to "blog this" event (IMO) would be if I could merely provide my thoughts and comments about each presentation I attend. The presenters will certainly get more out of it, and readers will probably enjoy the post more. But that's the hard part. It's easy to blog as a presenter speaks - but it's hard to formulate your thoughts and opinion as they speak. It's easy to blog your thoughts after the fact, but that's supposed to be the best part of NFJS - the hallway conversations b/w sessions. I could miss the first 10-15 minutes of each new presentation writing about the old one, but that's no fun either. I guess I just need to start thinking faster, formulating my opinions as fast as possible and writing them down. From now on, I'm going to try to refrain from regurgitation and go more for opinionated reporting. Is that what you'd prefer? If my readers want regurgitation, I can continue that route - I just think it makes for boring entries.
Man, these are long sessions. I just looked at the schedule and all the talks today are 1 1/2 hours! That's too long IMO. I'd loathe it as a speaker and as an attendee - I'd prefer 45-60 minute presentations. Mike's a good speaker, but it's tough to keep anyone's attention for more than an hour - unless it's something like soft core porn.
Choices for the next session are: Programming with Hibernate (Tate), Rapid UI Development (Geary), OpenSource Ecosystems (Thomas), Java Classworking (Dennis Sosnoski) and Getting Fit (Daniel Steinberg). I'm leaning towards Rapid UI Development or OpenSource Ecosystems.