jump to navigation

Apache Tomcat 5.x : Determining Server side response times June 17, 2009

Posted by Aditya Thatte in Performance Modeling, Web services.
Tags:
trackback

This article explains the method of finding the server side response times for Apache Tomcat 5.x. The idea is to modify the server.xml configuration file located in the “conf” folder. Adding the required parameters to the server.xml file forces Tomcat to spit out data in the log files. The values are not debatable since we query the Tomcat server logs.

There is a list of parameters that can be queried, however this article only considers response time at the server side. We will be able to determine which servlet acts as a bottleneck at run-time by analyzing the server side response times.

The AccessLogValve component in Catalina creates the server logs. This creates a log file containing timestamps, performance metrics and other related information. The configuration can be changed according to the users requirements. Lets take a look at a part of the server.xml file.

An important aspect here is to know that the AccessLogValve node in the xml file is “commented” by default. It needs to be “un-commented” so that the log file is created in the logs folder.

Here is a snapshot of a part of the server.xml showing the AccessLogValve node. The default configuration shows pattern= “common”. The common pattern corresponds to “%h %l %u %t “%r” %s %b”, where

%h – Remote host name (or IP address if resolveHosts is false)
%l – Remote logical username from identd (always returns ‘-’)
%u – Remote user that was authenticated (if any), else ‘-’
%t – Date and time, in Common Log Format
%r – First line of the request (method and request URI)
%s – HTTP status code of the response
%b – Bytes sent, excluding HTTP headers, or ‘-’ if zero

tomcat_accesslogvalue_common

We shall also consider the response times at the server side, which is represented by ” %D “. We need to modify the server.xml accordingly.

tomcat_accessvalvelog_responsetime

serverlogs_responsetime

It is interesting to note that some request show a value of  ” 0 ” . This may be because of the fact that the response time for that particular request is in the order of micro seconds. This can help developers understand potential bottlenecks in the system.

References :

- http://tomcat.apache.org/tomcat-5.5-doc/config/valve.html

Comments»

No comments yet — be the first.