Solved

Identify processing time at each layer

Posted on 2014-09-03
7
190 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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 26

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

There are numerous questions about how to setup an IBM HTTP Server to be administered from WebSphere Application Server administrative console. I do hope this article will wrap things up and become a reference for this task. You need three things…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
The viewer will learn how to implement Singleton Design Pattern in Java.

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now