Solved

Identify processing time at each layer

Posted on 2014-09-03
7
195 Views
Last Modified: 2014-09-12
Hi,

I have created a sample web application in which there is a servlet.logic and dao layer.
I want to check how much time is taken at each layer while processing the request.,

Web application server is tomcat.

Is there any tool which can be configured in tomcat to achieve the above requirement?
0
Comment
Question by:Rocking
7 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 40302767
You can do it bu using System.currentTimeMillis().

Put a long start = System.currentTimeMillis(); before entering the layer. Then put a long finish = System.currentTimeMillis(); when exiting the layer. Then simply subtract start from finish.
0
 

Author Comment

by:Rocking
ID: 40305007
suppose there are 10,000 files and if we start doing like this it is time consuming.
What i need a open source too,or configuration which can meet the requirement.
0
 
LVL 35

Expert Comment

by:girionis
ID: 40305344
It's not easy to distinguish between software levels, so I don't think there is an automated tool to do this. But some other expert might have moire knowledge on this matter.
0
Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

 
LVL 12

Expert Comment

by:Sharon Seth
ID: 40309261
I believe JAMon should actually provide what you are looking for , not out of the box  but with some customization.
0
 

Author Comment

by:Rocking
ID: 40310622
Jamon is a text template engine for Java, useful for generating dynamic HTML, XML, or any text-based content. In a typical Model-View-Controller architecture, Jamon clearly is aimed at the View (or presentation) layer.

how can it achieve in Identify processing time at each layer?
0
 
LVL 27

Accepted Solution

by:
dpearson earned 500 total points
ID: 40311351
I think you can do this using a regular profiler - assuming your classes are sensibly named.

Start with a profiler (I like visualvm - http://visualvm.java.net/).
This allows you to see the overall performance of your application and where it's spending the most time.
Run your app and collect this overall data first.  (You don't need to modify tomcat for this sort of profiler - you just start it up and point visualvm at it).

However, it you want to specifically break the profiling into layers, you could do that by setting the "profiling roots" (see this article: https://blogs.oracle.com/nbprofiler/entry/profiling_with_visualvm_part_2) to the classes in your DAO layer (this is assuming the class name allows you to identify which layer it's in).

Run your app, collect this profile data.

Now if you subtract the time spent in the overall profile from the time spent in the DAO layer you have the time spent in the layer above the DAO.  If it's just 2 tier you're done.  But if you have a 3rd tier, you can then set your roots to your servlet classes and repeat the process.  Again, the different between the profiling data gives you the time spent in the layer.

It's not trivial, but you should be able to get everything you need in an afternoon.

Hope that helps,

Doug
0

Featured Post

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
tomcat administrtor 12 61
Android development question 2 54
sql import cannot be resolved jsp 3 49
$_SERVER Variable question 31 30
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This video teaches viewers about errors in exception handling.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question