Niyaz
Niyaz

Reputation: 54793

How to test java application for performance bottlenecks?

I am reviewing a big java application to see if there are any performance bottlenecks. The real problem is that I cannot pinpoint the performance issues to any single module. The whole application is slow as such.

Is there some tool/technique I can use to help me out in this?

Upvotes: 12

Views: 20046

Answers (6)

peceps
peceps

Reputation: 17557

YourKit is a excelent java profiler (not free).

Upvotes: 0

Riking
Riking

Reputation: 2480

As we see from How can I profile C++ code running in Linux?, the most statistically significant approach is to use a stack profiler.

Well, Java runs in the JVM, so getting a stack useful for C code won't be useful for us (it'll get the JVM stuff, not your code). Fortunately, Java has jstack! http://docs.oracle.com/javase/1.5.0/docs/tooldocs/share/jstack.html

It'll give you a bunch of threads, like the GarbageCollector. Don't worry about those, just look at where your threads are.

Upvotes: 0

wvdschel
wvdschel

Reputation: 11838

I'm often happy enough using Java -Xprof. This gives you a sorted list of the functions your code spends most of its time in.

Upvotes: 6

Tnilsson
Tnilsson

Reputation: 2190

For testing/development purposes, you can download Oracle JRockit Mission Control for free from this site. (Requires Login, but accounts can be set up with any email adress)

Docs Here. It will allow you to find hotspots, memory leaks and much more.

Upvotes: 0

HadleyHope
HadleyHope

Reputation: 1173

If you are running on Java 6 you can use the supplied monitoring tools

Upvotes: 3

Bartosz Bierkowski
Bartosz Bierkowski

Reputation: 2782

Try using a profiler on your running code. It should help you identify the bottlenecks. Try jprofiler or Netbeans profiler

Upvotes: 8

Related Questions