Forgot your password?
typodupeerror

Java Profilers - Which One Are You Using? 79

Posted by Cliff
from the in-search-of-long-call-times dept.
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."
This discussion has been archived. No new comments can be posted.

Java Profilers - Which One Are You Using?

Comments Filter:
  • by jnana (519059) on Thursday June 29, 2006 @10:10PM (#15633506) Journal
    I give my most enthusiastic recommendation to YourKit [yourkit.com]. It takes about a minute to install, has optional integration (1-click) with Eclipse, IDEA, Netbeans. I use Eclipse, and the integration there adds a new 'Profile as' options that works just like the 'run as' and 'debug as' launch options.

    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 give my most enthusiastic recommendation to YourKit.

      I second this. It's been a year or two since I looked, but I was happy to pay my own money for the YourKit profiler. In particular, I like the good UI. As with an IDE, I think it's worth paying for a good tool when it substantially increases my productivity, and the YourKit tool fits that.
      • I fourth this. In demonstrating it to a colleague shortly after receiving it, I found a major bottleneck in our corporate portal which allowed a 20% performance increase - saving the cost of the license just in server hardware alone!
  • Profilers (Score:2, Informative)

    by overbarg (790290)
    Java's available sets of tools for this kind of stuff is woefully inadequate, but here's what I use: NetBeans Profiler: Not bad for what it does, Memory Stack Allocation tracers are nice, but I haven't been able to get it to profile just certain methods in a selected class. It also seems pretty stable over long periods of time and doesn't interfere too much with the running of the application. JMP: I started using this for it's heapwalking abilities. Other things I've tried are hprof and hat... but wit
  • OptmizeIt (Score:3, Informative)

    by SuperKendall (25149) on Thursday June 29, 2006 @10:33PM (#15633617)
    Although I've not had call to use one for a few years, I've liked OptimizeIt for a long time - they were bought by Borland but I think you can still buy the software on its own.

    JProbe also seemed pretty good...

    I also had good luck with HAT (heap allocataion tool, built into Java) if you are just looking for memory leaks. The HProf stuff also works and again is built in.

    ---> Kendall
    • We're also happy OptimizeIt users. It seems to do almost everything we could want from it and mostly satisfies our needs. That said, its GUI is *awful*. If you're looking for functionality, I don't know of any reason not to choose it. But if prettiness is a requirement, give it a miss.
  • JRat (Score:5, Informative)

    by Anonymous Coward on Thursday June 29, 2006 @10:47PM (#15633673)
    JRat [sf.net] is open-source, and works anywhere using bytecode injection. It's the only serious solution for profiling applications running in production as it

    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 :) Enjoy.
    • ... and doesn't support java 1.5 and hasn't been updated in a loooong time. I checked it out a few months ago and unless something has changed in the meantime, it's basically a dead project and not usable for anyone working on non-legacy systems.
  • by sfjoe (470510)
    The tools that come with Java, while not at all user-friendly, have always been enough to point us in the right direction. We've never really come across a situation where we couldn't find the problem or optimize the code once the right track has been pointed out. YMMV.

  • JProfiler (Score:3, Informative)

    by Flwyd (607088) on Thursday June 29, 2006 @11:13PM (#15633779) Homepage
    We bought a few JProfiler licenses a few years ago and have had good success with it. It can easily profile remote JVMs (servlet containers, for instance). I've used the Heap Walker a few times to discover static references that shouldn't be kept around and have had good success finding performance bottlenecks.

    I hear recent versions plus 1.5 resolve a lot of stability and performance problems, but I haven't had enough problems to warrant pulling it out in a while. It's not a perfect product, but it's told us what we need to know.
    • Yep, I've used it at work to profile out J2EE application and find some memory leaks in our applet. Very useful product, and definetly recommended.

      Regards
      elFarto
    • +1 Of all the profilers I've used, I have found this to be the most intuitive. This is a really important attribute. A lot of the time, this kind of software gets used to sort out a super-critical production/customer issue, and developers don't always have the luxury of time to figure out the quirks and metaphors behind a product.
    • Ceci n'est pas une signature...
  • PerfAnal.jar (Score:5, Interesting)

    by edwinolson (116413) on Thursday June 29, 2006 @11:37PM (#15633879) Homepage
    Believe it or not, I do most of my profiling by running by using:

    alias java-prof='java -agentlib:hprof=cpu=samples,depth=8,interval=1,thr ead=y'

    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.)
  • For us... (Score:4, Informative)

    by Leftmoon (610062) on Thursday June 29, 2006 @11:48PM (#15633924) Homepage Journal
    We use DevPartner [compuware.com] 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.
  • Eclipse TPTP (Score:4, Interesting)

    by sgifford (9982) <sgifford@suspectclass.com> on Friday June 30, 2006 @12:03AM (#15633999) Homepage Journal
    I've used the Eclipse Test & Performance Tools Platform with pretty good results:

            http://www.eclipse.org/articles/Article-TPTP-Profi ling-Tool/tptpProfilingArticle.html [eclipse.org]
    • I like and use Eclipse TPTP as well. I've used OptimizeIt before and fiddled with JProbe before settling on Eclipse TPTP.

      Subjectively, I liked JProbe's interface more, but they only supported Java 1.4 at the time, whereas OptimizeIt and Eclipse TPTP supported 1.5 (which I was using).

      I find Eclipse TPTP a little finnicky to set up though. I've set it up two or three times, and I must not be understanding the instructions properly - they're very detailed and specific, but it doesn't go smoothly for me.
    • TPTP is awesome. It has some quirks (like depending on your working directory you sometimes have to manually fiddle with the config xml so it profiles correctly). However the new version has integration points with the Web Tool Project WTP, which means you can profile on your container. Obviously the biggest draw is that it's completely free.
  • I had good results with JProfiler when tracking down some memory leaks in our Java app. Found out we were hanging on to some references much longer than we should have. JProfiler lets you snapshot counts of objects (after GC), do this again after a 'test run', and then find the offending objects. You can then locate where they were allocated, who is still holding on to them and so forth. Neat.
  • by Toveling (834894) * on Friday June 30, 2006 @02:46AM (#15634544)
    A stopwatch.
  • JMeter (Score:3, Interesting)

    by LarsWestergren (9033) on Friday June 30, 2006 @02:59AM (#15634574) Homepage Journal
    I have used JMeter [apache.org] a couple of times to detect bottlenecks and synchronization problems with web apps. Very simple to set up and run just using a GUI. Apart from http/https it can appearently call java methods, EJBs etc too, but I haven't tried that. I think this tool is easier to use for stress testing rather than going through a whole use case. Also, when running against a web server of course it just tells you that something is slow, not what.

    At Java One I talked to some fellow Swedes who were a bit disappointed with JProbe, they claimed it was a bit of a resource hog and that they had found a better more light weight open source library to use instead. I've looked through my notes, but it seems I didn't write down the name of the one they recommended. Darn.

    Symantec had an app that seemed pretty impressive, though I don't know how much they charge for it. I think it was this one [symantec.com]. I remember them because unlike most who just had a lottery for prizes, you actually had to run the demo to be able to answer their quiz. Pretty clever, made people remember and gave you a better chance of winning because most people wouldn't bother. I won a PSP. :-)

    Also at Java One this year Sun had loads of labs and talks on profiling tools and frameworks that come with the JDK itself these days - JMX (especially in combination with DTrace if you run on Solaris), jconsole, jmap, jhat.

    And then of course there is this whole site [javaperfor...tuning.com]...
    • Heh. You too? I saw how much traffic they had and figured it would be worth the time to study the whitepaper before taking the test. Most folks just winged it or did not bother. Profiling the booth paid out big time. One of the best bits of marketing swag I have ever brought home. (Grin)
  • JProfiler (Score:5, Interesting)

    by Wizard of OS (111213) on Friday June 30, 2006 @04:04AM (#15634706)
    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.
    • Re:JProfiler (Score:3, Interesting)

      by Wizard of OS (111213)
      Oh, I saw I forget to mention the features I used:
      - attach the profiler to a remote machine (in our case a test environment)
      - trace memory allocations: you can see live which objects live in the JVM
      - memory snapshot, this makes a snapshot in which you can see which objects live, which other objects have references to it, where it was allocated etc. So if you have a mem-leak, you can find out exactly why the object wasn't GC'ed
      - cpu profiling: see which methods take how many percent of your processing, and f
    • You hit the nail on the head mate.

      JProfiler just works, and you get the information you need really quickly. I'm not a shill, just a fan. I've introduced it to my new employer, and the developers now go through a compulsory JProfiler session before any significant changes get committed. We're working in a large, mostly legacy code base, where the impact of changes isn't always understood. Just ordered another 3 floating licenses. Yes, it's about AUD 3000, but that is repayed sooooo quickly.

  • I definitely recommend JProfiler - I've used it for a couple of years now and it has always been easy to use and very effective at giving me the information I need.

    Hope that helps.
  • by tedgyz (515156) *
    I like JProbe [quest.com]. It's a little cumbersome to setup, but has great analysis tools with graphical call trees, call stack drill-down, etc. What I like the best is the ability to prune the results interactively to isolate the piece of code you are interested in.
    • Re:JProbe (Score:3, Interesting)

      by Doctor Memory (6336)
      I second this recommendation. I haven't used it for a few years, but the first time I did I was blown away by the level of detail you could get. Very easy to drill down to just about any level of detail you could want. ISTR it also had breakpoints on garbage collection, so you could examine the heap before and after GC. Very handy for making sure that something you thought should be reclaimed actually was, and very easy to trace the errant references if it wasn't.

      It seemed expensive at first, but in two
      • I'm not sure who owns it now

        It was originally developed by a company called KL Group, which changed their name to Sitraka. Most people only knew about JProbe though, so a lot of people thought that was the company name too. In 2002 Sitraka was acquired by Quest Software.

    • My team has also been using JProbe. We used the unsupported free edition for a while and decided it was worth it to go ahead and get the full version. We got a single concurrent license (as opposed to node-locked) and have been able to share it among 4-8 people successfully with little contention. The installation and management of the license server is easy, and hooking the clients up to it was dead simple.

      Their performance profiling is great, and their remote profiling works wonderfully as well. We ha
  • Symantec has an awesome product called Indepth for J2EE, or i3 for J2EE depending on how you get it bundled. It's more designed for the production level/test level performance issues, as it's very customizable to balance level of detail with overhead. There's even a cool setting where you can specify the level of overhead you're willing to incur (specified as a %), then it determines the maximum amount of level of detail it can obtain, based on the level of overhead you've specifed. All this is done wh
  • JFluid (Score:2, Informative)

    by ungerware (316294)
    JFluid (a.k.a the NetBeans Profiler)

    1. Free
    2. Trivial to configure/run (as easy as debugging in NB)
    3. You can specify a subset of the app to profile, and the rest of the app runs at full speed (profilers like JProbe force you to slow down the whole VM). This also makes the output much more readable, since you're not seeing all kinds of statistics from code you're not interested in.
    4. Attach/detach to a running application, which requires no special cmd line options when launching.
    5. Analysis tools are good
    • I did not succeed to install eclipse plugins from TPTP (Tracing and Profiling Tools Platform) on my Mac. I think, but I'm not sure, that something is missing, something like platform specific software agents to run up the profiler on Mac. Then, I myself reminded a news about the release of the NetBeans Profiler for Mac OS X. http://profiler.netbeans.org/ [netbeans.org] What an experimental stuff! This is definitely the PROFILER for Java! (Cross my heart, I'm not working for Sun and I'm still using the eclipse IDE). I h
  • The replies to this post has given my team a lot of food for thought. As usual, the slashdot community replied with a lot of intelligent feedback and added a dash of humor too.

    I especially appreciated the discussions on features. Many had been on our wish list, but others had been overlooked.

    Thanks Again!

  • YourKit, hands down, at least for memory profiling. When I was debugging few particularly nasty cases of memory leaks ( see http://www.szegedi.org/articles/memleak.html [szegedi.org]) it was the only profiler that got the Java Memory Model assumptions right, i.e.
    • didn't think static fields are GC roots (they aren't, they are reachable through classes, and classes are not GC roots, unless loaded by system classloader)
    • recognized that classes keep a strong reference to their classloader
    • recognized that array classes keep
  • As a part of MacOSX dev tools, you get shark, which includes java profiling. What is nice about Shark is it is the tied to the kernel profiler as well, so you can switch from java to native profiling in a flash, with the same UI. Also, it includes a bunch of data mining features, such as filtering out small methods (profile time http://developer.apple.com/tools/sharkoptimize.htm l

I bet the human brain is a kludge. -- Marvin Minsky

Working...