Memory Profiling On Applications

Last week I was stress testing a webapplication. While putting heavy load to the server, the server went Oom (Out Of Mana… , euh Memory) . That was a quick stress test. The testing task quickly changed into a debugging task.
Finding the leak isn’t an easy task. With just looking at a java.lang.OutOfMemoryError error you wont find it. You’ll need a profiler or a heapdump inspection tool.

I decided to go for the profiler. A year ago I tried the netbeans internal profiler, that was a very nice profiler but it’s a pain to import projects into NB that don’t follow it’s standards. So this time, no NetBeans.

I decided to test with TPTP, the main Eclipse profiling project. Before that got installed and launched, 4 hours passed, and it didn’t provide any needed information. Luckily the workday had passed by then, and I didn’t have to dive deeply into a manual for configuring/using TPTP (if there even is one besides the official).

The next day I got up, checked my mail and what did I see there? Invitiation to the early access program for YJP the YourKit Java Profiler (version 9.0) . A profiler from around a thousend euros. Although this is a very high price for an application, it really is worht it’s money.

It took about 30 minutes to install and setup the profiler to work with a standalone tomcat 6 version. Finding the memory leak was a piece of caké. It took the amount of time the server needed to go OOM, which wasn’t very difficult with Jakarta-JMeter (a nice tool to stress test (web)applications).

YJP is able to take memory snapshots at defined time intervals or when XX% of the heap is used. These snapshots can be inspected in YJP allowing you to track the amount of objects, the size of these objects, all references from an to, and so on. Actually for profiling, think of what you could need and YJP will have it!

Although I’m a big fan of opensource software, I would advise any java (or .Net) software company to purchase a licence of this uber-tool. (Worth mentioning: YJP grants free licences to OpenSource software.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.