Wednesday, February 08, 2006

Tomcat Administration

How to figure out the number of Servlets that are deployed as part of a given web application.

To go to HTML Manager app we go to configure the Tomcat-Home/config/tomcat-users.xml file, by adding

role rolename="manager"/
role rolename="admin"/

user username="admin" password="" roles="admin,manager"/

these elements. Once done with this we got to restart Tomcat and goto to default Tomcat login-page, with the following URL.

http://localhost:8080/

We will be able to see "Administration" at left corner of the page below the tiger image with links to
1. Status
2. Tomcat
Administration
3.
Tomcat Manager

Click the second link. You will get a browser pop-up dialogue box requesting UserName/Password. Enter
UserName as "admin" and no password.

Tomcat will show you the deployed servlets if you fire up the HTML Manager app and go to Server Status -> Complete Server Status you'll see a list of all the servlets deployed in each application along with some data for each of them.

Example:

Lets consider we got a Web Application called ServletMethods with 3 servlets in it. If we follow the above links you will see

-----------------------------------------------------------------------------------------
localhost/ServletMethods

default [ / ]

Processing time: 1 s Max time: 1219 ms Request count: 1 Error count: 0 Load time: 0 ms Classloading time: 0 ms

LoginServlet [ /login ]

Processing time: 0 s Max time: 547 ms Request count: 1 Error count: 0 Load time: 531 ms Classloading time: 531 ms

TestServ [ /ts ]

Processing time: 0 s Max time: 0 ms Request count: 0 Error count: 0 Load time: 0 ms Classloading time: 0 ms
jsp [ *.jsp , *.jspx ]

Processing time: 0 s Max time: 0 ms Request count: 0 Error count: 0 Load time: 15 ms Classloading time: 15 ms

MyServ [ /myser ]

Processing time: 0 s Max time: 0 ms Request count: 0 Error count: 0 Load time: 0 ms Classloading time: 0 ms

-----------------------------------------------------------------------------------------
Where LoginServlet, TestServ and MyServ are the servlet names and those inside brackets are the url-patterns to be used to reach the servlets.

You can also get other details like

1. Processing time
2. Max time
3. Request count
4. Error count
5. Load time
6. Classloading time

1 Comments:

Blogger robsinner said...

Can you tell me exactly what these parameters mean:


1. Processing time
I'm assuming this is cumulative cpu time.

2. Max time
The maximum cpu time

3. Request count
Number of HTTP requests

4. Error count
Number of 500, 503 etc, pages that result in a stack trace

5. Load time

6. Classloading time

So if my assumptions are correct I can get the average servlet cpu time by dividing total processing time/ number of requests. And of course this doesn't include network latency just cpu time for the servlet.

5:34 PM  

Post a Comment

<< Home