When a user says that “the system is slow” we would like to know: Is the system actually running slow or is it a matter of subjective perceptions? Is the chronometer actually “distorted” or does the system in fact prevent the user from working in a normal way?

Nothing beats numbers when we’re in search of conclusions and to understand the system’s true behavior. Something that proves quite useful in revealing the response time of web applications is to enable what is known as “time taken.” It is used not only for performance tests but also, and mainly, for systems in production.

Basically, we indicate what it is that we want recorded on the access_log. What is usually recorded here is the moment at which a resource was accessed. We have the option to request that information of the “user-agent” be saved (to know from what browser, or even from what device, the access occurred), in addition to the size of the resource sent, the http response code (200 indicating OK, 4XX indicating error on the client side, 5XX indicating error on the server side, and 3XX indicating, in general, a redirection), as well as the time elapsed from the time of receipt of the request until the return of a response.

This is something quite simple to configure. For example, in Tomcat, we must modify the “server.xml” by including, at the end, the following information:

<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="access_log." suffix=".txt"
pattern="%h %l %u %t &quot;%r&quot; %s %b &quot;%{Referer}i&quot; &quot;%{User-Agent}i&quot; %D" />

The part where we indicate what should be saved is the one defined in “pattern”. To know the meaning of each parameter, there is a reference here, but, by way of advance, you should know that the %D (or %T) is what we have to add for the response time, or time taken, to be saved.

After we have an access log with all this information, we can use one of the many tools available for viewing. There are two alternatives to mention, one is commercial (Apache Log Viewer) and the other is open source (AccessLog Viewer by Abstracta).

If we get this accurate measures of each request, we can be sure about the time taken by the server. If those values are far away from user feeling, we still need to avoid possible subjectivities in the response times reported by users, so, we can do that measuring time taken in browser (with tools like Fiddler or PageSpeed) and comparing results.


Check out these related posts

How to Optimize E-commerce Website Performance for Black Friday
How to Execute Performance Tests with Fewer Problems


Get the “8 Ways to Improve JMeter Scripts” Checklist


Eightways
Our performance and load testing specialist, Leticia, shares with you the checklist that she developed for building scripts that are easy to read, understand, use, and modify even for those unfamiliar with JMeter.