Lightweight Servlet Analytics

Abstract

A simple yet robust system for recording hits on your servlet-based applications, including response times and full path information. Provides several backend options, including flatfile and JDBC.

BSD licensed. Requires J2SE 5.0.

For download information and source code, visit the SourceForge project page.

Overview

At this time, the system consists of two principal components:

  1. The TimingFilter, which is plugged into your servlet container to intercept the requests you wish to monitor.
  2. A number of TimingRecordConsumers, which take data from the TimingFilter and transfer it to some other medium.

The TimingFilter

The TimingFilter is a standard ServletFilter, usable with any servlet container supporting the 2.4 spec (or later). By adding a few lines to your application's web.xml file, you can configure the TimingFilter to intercept requests of your choice — whether they be requests to a given servlet, URLs that match a wildcard pattern, or some combination of the two.

The TimingFilter is designed to have minimal impact on your application's responsiveness by moving processing out of the critical path. Once data on the request has been completed, it is transferred to a work queue to be processed out-of-band by your record consumer.

The TimingRecordConsumer

The TimingRecordConsumer runs in a separate, dedicated thread, processing information from its work queue.

Included TimingRecordConsumer implementations:

System Robustness and Health Monitoring

The system is designed to prevent a failure in the analytics code from damaging your application's availability. If the consumer fails for any reason (say the database becomes unavailable, or the disk fills up), the TimingFilter will disable itself until the condition is resolved.

Cliff L. Biffle <cliff@biffle.org>