简体   繁体   中英

How to identify which methods are eating time while serving request for a webpage?

My JSF (webapp) pages are taking long time to load. Tested through firebug, most of the time is spent waiting for response from server. So I think it's something on server that's eating up time. I have been trying to get some hints using Netbeans based profiler but while analyzing CPU performance, it just shows the time spent in each method since some point of time. So I cannot figure out what's eating up time when I sent request for a page.

Can you give some hints as to how I should be able to gain this information that which of methods are eating time while serving request ?

I think you should take a look at a Profiler tool , if you have a large system and want to have the job done in a professional way. Otherwise you will end up by tracing your own code with time elapsed methods before each call (lol)

I have used Borland OptimizeIt and it did great job, back in the days :)

Take a look at:

JProfiler

YourKit

Jvisualvm (Javas own) visualvm.java.net (which is used in Netbeans too)

If you use eclipse take a look at TPTP bundle

OptimizeIt

Time being taken on server. First I would check if this might mean that the network is inducing latency (You need to check how firebug measures this).

If you confirm is not a network latency issue then the best path to take would be a profiler, depending on your platform and the size of your app you can make the best choice.

For example, I would go for jvisualvm if your application loads less than 65k classes, otherwise you might experience issues.

Once you start jvisualvm you can attach it to your app process. Once in there I would recommend you try sampling profiling first, it is less aggresive in resource consumption (Not sure how big or loaded is your scenario, instrumentation profiling might be too heavy to support).

You just need to attach jvisualvm to your process, go to Sampler and press the Start button, data will be collected after that point in time, so after you have activated the sampling you should trigger your request, maybe a few times so you can get a better feel on where the time is being spent.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM