Profiling tool for Java Based Webapplication
We are working on a web-application which preliminary using Struts2+Spring 3.x+Hibernate 3.x.We are taking in to consideration of using good profiling tool to avoid any potential problems.
i am new to this area so while doing some research came up with these two candidate
- Jprofiler
- VisualVM
please provide your feedback on these two or if there is any other good candidate please suggest. i also have few more queries regarding this.
- How relevant to use profiler as the project is still in middle.
- Since we will use this initially on the development system so i don't think it is a replica of production and there may be many issues which are just out of scope in production.
- How much an OS can make difference in profiling results as most of the development machine will be window based while the staging and production will be Linux based.
Please provide your valuable feedback.
Go with JProfiler. I been using this for 3 years, it is really awesome especially for CPU profiling. VisualVM do not provide the kind of drill down that JProfile does. It recognizes J2EE components and also gives you exact SQLs fired in a flow.This is really important, from my experience, 95% of the performance issues comes from irresponsible and unnecessary DB hits.
Because you are using Hibernate, profiling will help you to identify when to enable lazy loading and when to enable object, query and association caching.
To answer your other questions,
It does not matter at what stage your project is, if you feel it is not performing well, profiling is relevant for you. Do not delay it because if the issue is in design of core component there are chances that it will spread throughout the application and difficult to fix it in later stages.
duffymo's answer.
A lot of difference. Our Linux machines with same configuration usually much faster and responsive than Windows machines. But as duffymo answered, profiling gives you hotspots and percentage of time taken by each component and method. Application classes instrumented for profiling are at least 50% slower than normal scenario(my experience with JProfiler).
VisualVM is a terrific tool. It's hard to believe that something so good comes bundled with the JDK download from Sun/Oracle. I'd recommend using JDK 6 and higher. All you have to do is get the PID of the application and give it to VisualVM; it'll do the rest.
Here are responses to your questions:
How relevant to use profiler as the project is still in middle.
I'm not sure what you mean here. I'll assume that you're asking about the negative impact that the profiler has on performance. You're checking for relative effects, not absolute numbers. You baseline performance, make a change, and re-measure. Profiler is the same for both.
Since we will use this initially on the development system so i don't think it is a replica of production and there may be many issues which are just out of scope in production.
You'll only learn about the system that you measure. If development is that different from production, the best you can do is relative effects of changes, not absolute values.
How much an OS can make difference in profiling results as most of the development machine will be window based while the staging and production will be Linux based.
I'd benchmark it on Windows and Linux if you're worried. My guess is that it's negligible, but a one-time measurement will confirm or deny that.
If you use Eclipse, and start your development Server from Eclipse, than have a lock at Eclipse TPTP.
I don't have any experience with those two, but we do run a lot of Java web applications (both servlet containers and game server platforms). Our development and production servers are a mix of Linux and BSD, while our developers are on just about everything: Linux, MacOS, Windows.
For all of our profiling needs, we use Yourkit (http://www.yourkit.com/). We do not normally do a lot of profiling work to identify bottlenecks, etc (although we have done some), but it's turned out to be a great tool for finding deadlock, memory leaks, permgen issues, etc.
We have it running in a low-impact mode on our production servers full-time so that we can get a snapshot whenever necessary, and have employed its use at all stages of development.
I have very good experience with the profiler built into NetBeans.
The profiler in VisualVM is a stripped down version of the NetBeans profiler.
精彩评论