Nitin Garg
Nitin Garg

Reputation: 2079

Performance profiler for a java application

I need to optimise a Java application. It makes some 3rd party calls. I need some good tool to accurately measure the time taken by individual API calls. To give an idea of complexity- the application takes a data source file containing 1 million rows, and it takes around one hour to complete the processing. As a part of processing , it makes some 3rd party calls (including some network calls). I need to identify which calls are taking more time then others, and based on that, find out a way to optimise the application.

Any suggestions would be appreciated.

Upvotes: 28

Views: 28559

Answers (8)

aioobe
aioobe

Reputation: 420921

I can recommend JVisualVM. It's a great monitoring / profiling tool that is bundled with the Oracle/Sun JDK. Just fire it up, connect to your application and start the CPU-profiling. You should get great histograms over where the time is spent.

Getting Started with VisualVM has a great screen-cast showing you how to work with it.

Screen shot:

VisualVM screenshot


Another more rudimentary alternative is to go with the -Xprof command line option:

-Xprof

Profiles the running program, and sends profiling data to standard output. This option is provided as a utility that is useful in program development and is not intended to be be used in production systems.

Upvotes: 31

Ivan Senic
Ivan Senic

Reputation: 649

Just wanted to mention the inspectIT tool. It recently became completely open source (https://github.com/inspectIT/inspectIT). It provides complete and detailed call graph with contextual information, there are many out-of the box sensor for database calls, http monitoring, exceptions, etc.

Seams perfect for your use-case..

Upvotes: 5

Andy Fields
Andy Fields

Reputation: 21

Try OPNET's Panorama software product

Upvotes: 2

Xorty
Xorty

Reputation: 18861

I use profiler in NetBeans (it is really brilliant and already built in, no need to install plugin) or JVisualVM when not using NetBeans.

Upvotes: 0

arcamax
arcamax

Reputation: 600

In our office we use YourKit profiler on a day to day basis. It's really light weight and serves most of the performance related use cases we have had.

But I have also used Visual VM. It's free and fast. You may first want to give Visual VM a try before going towards YourKit (YourKit is not freeware).

Upvotes: 1

Michael Borgwardt
Michael Borgwardt

Reputation: 346240

It sounds like a normal profiler might not be the right tool in this case, since they're geared towards measuring the CPU time taken by the program being profiled rather than external APIs that it calls, and they tend to incur a high overhead of their own and collect a large amount of data that would probably overwhelm your system if left running for a long time.

If you really need to collect performance data over such a long time, and mainly for external calls, then Perf4J is probably a better tool.

Upvotes: 1

s5804
s5804

Reputation: 995

visualvm (part of the SDK) and Java 7 can produce detailed profiling.

Upvotes: 0

ewernli
ewernli

Reputation: 38605

I've been using YourKit a few times and what quite happy with it. I've however never profiled a long-running operation.

Is the processing the same for each row? In which case the size of the input file doesn't really matter. You could profile a subset to figure out which calls are expensive.

Upvotes: 7

Related Questions