Java Profilers - Which One Are You Using?
splitPersonality asks: "Our Java programmers are researching various profilers to use in-house. We would appreciate some feedback from other shops that are using Java profilers. Along with the specific product, would you please include reasons behind your choice? If you now have misgivings about the one you or your shop chose, please let me know about those, as well."
YourKit is extremely easy to use thanks to a very intuitive interface.. All the java developers I've shown it to have been as impressed as I've been. It is cheaper than most profilers -- I got a deal on it for $125 a few months ago, which I is about 25% of the normal price, but it's still cheap at $499. It's not open-source, but they have a forum where they answer they questions extremely quickly. I've had 1 or 2 bugs since I've been using it (about 10 months), since I like to use the early release version for newer features, and both have been fixed within days, with a new build released within a week or so. Memory leaks are a snap to find using it's "compare snapshot", which lets you compare 2 snapshots and shows you what the difference is -- memory leak is generally the difference if you capture your snapshots intelligently.
Anyway, I can't speak highly enough of the product. For the record, I have no affiliation with them at all. I'm just a very happy customer.
My only minor gripe is that under some circumstances, the fastest CPU profiling option (unnoticeable impact on the running app) can give inaccurate results, in which case I have to use one of the two slower CPU profiling options, which are much, much slower--but that's certainly not particular to YourKit.
I use several tools depending on the application.
For step-through-your-code debugging nothing beats Jprobe, although perhaps a fellow slashdotter
can suggest a public domain equivalent
If you want to profile your code in a "production" situation, i.e. you need minimal overhead
while instrumenting methods to understand where in your stack trace time is being spent
you have two options. Mercury Interactive sells a product that instruments all methods,
aggregates method usage and gives you a "top talker" summary. Wyle Introscope on the other
hand instruments only the methods you want, but can drill down into things like JDBC and capture
executed SQL. Their product Leakhunter can help you find memory leaks, but creates too much drag for prod usage.
Finally if want something that combines elements of Mercury's inclusive approach of instrumenting
everything and top talker summaries and with Wyles approach of watching for heap usage, GCs and so
on you want a copy of YourKit. I own all the products mentioned but have to say YourKit is my current favorite.
JRat is open-source, and works anywhere using bytecode injection. It's the only serious solution for profiling applications running in production as it
:) Enjoy.
A) doesn't require much overhead
B) doesn't require code changes
C) doesn't require some sort of front-end to monitor or use
D) doesn't have a rediculous cost per server
E) runs in your typical environment, not some magical profiling IDE option
We use this every day (via an ant task) to profile a Wall Street trading system that handles billions of dollars of transactions every week. Would you trust that to anything else?
Signing anon because my employment contract specifically prevents me from revealing this sort of thing
Believe it or not, I do most of my profiling by running by using:
r ead=y'
alias java-prof='java -agentlib:hprof=cpu=samples,depth=8,interval=1,th
And then I view the results with PerfAnal.jar (google will find it for you), an extremely old (and even ugly) GUI that is also clean and mean. It's also free (beer? not sure.)
I've tried a number of other profilers (JFluid, YAJP, etc.), and they usually prove to be too much of a pain in the ass, or just give nonsense data.
Mind you, I'm usually interested in pure CPU performance-- tightening inner loops and things like that. I don't care too much about memory profiling or garbage collector behavior since I've long since eliminated most allocations in my performance-sensitive code.
Sadly, no profiler really satisfy me. Usually, line-by-line CPU usage just can't be computed given the optimization performed by HotSpot: you'll see trace-by-trace CPU usage, where a trace covers several lines of code. It makes it hard to know exactly where the CPU time is being spent. (You can run with -Xint, but the performance is so different without HotSpot that it's not helpful.)
Have you ever actually worked at a company in your life?
If I invented something tonight which was faster than whatever you were using today, and yet you were running into memory leaks that required restarting or rebooting servers you run 24/7, and losing thousands of dollars by the minute, but were within reach of serving your current load if you could identify the leaks, would you turn off your servers until you finished rewriting your application in my language?
He's not asking about 'performance', hes asking about how to chase memory leaks via a profiler. He's not concerned about performance, hes concerned about RAM usage due to memory leaks due to programming bugs. Please tell me people like you are not actually employed as programmers or programming project leads. You're advise is as useful as the lowest of the low tech support, "Oh, thats your problem? Well, you should just probably quit everything you're doing, and re-invest from the ground up in some other product or technology."
Its useless advice because thats not the question being asked. And just like low tech support, he probably knows more about the alternatives than you do.
"Old man yells at systemd"
We use DevPartner which seems to work pretty well for me. It's fairly neat the way it works. Although it does seem to identify some things as memory leaks that probably aren't actually leaks (ResultSets, IBM MQ Series objects, etc), if you limit the check to your own packages, a lot of your in-house errors will stand out right way and it will ignore the (assumed) false spots. Give it a try.
I've used the Eclipse Test & Performance Tools Platform with pretty good results:
i ling-Tool/tptpProfilingArticle.html
http://www.eclipse.org/articles/Article-TPTP-Prof
My Web Page
A stopwatch.
Interesting to see this question come up just a week after I was in deperate need of a profiler. I downloaded JProfiler 4.2 and got a test-license (for 10 days or so). (oh, and I work on a Mac, and it has downloads for 3 platforms).
The problem I had was the following. We upgraded our system from the previous stable release of our opensource CMS to the new stable release. We knew a lot had changed in the internals, so we did a good functional testround and fixed quite a few issues. Quite confident in the new software (it appeared faster) we deployed on our live environment. Looked fine, until after a few hours it didn't stop Full-GC-ing, the symptoms of a memory leak. (and yes, I know how to tune my VM to optimum GC performance).
All I can say about JProfiler is that after only 3 or 4 days, I found all memory leaks, several performance issues (even things like 'for (int i=0; istr.length(); i++)'), and got a real good feel about the bottlenecks inside the application. My manager just bought me a $400 or so license, and it's money very well spent.
So next week we'll go live again, but now with a piece of software of which we exactly know how it behaves.
I suggest you download the evaluation version and just give it a try. I can't imagine putting a release live anymore, without having profiled it for at least a day.
--
If code was hard to write, it should be hard to read