Apache
Home » Documentation » Bundles

Request Processing Analyzer (reqanalyzer)

Introduction

Sling provides a helpful functionality to track progress of requests being processed: The RequestProgressTracker which is available through the SlingHttpServletRequest.

This tool provides mechanims to record states of request processing and a simple mechanism to time periods of processing. By default Sling itself uses this tool to track progress through Sling like script resolution and calling scripts.

Scripts and servlets called during Sling's request processing may themselves use the RequestProgressTracker to log their own processing.

Usually the data collected by the RequestProgressTracker is just dropped or it may be visible for a certain number of recent requests on the Recent Requests page of the Web Console. When doing load tests, though, this Web Console page is of limited use because a lot more requests are handled than can be displayed in the Web Console.

This is where the Request Processing Analyzer comes in handy. When deployed as a bundle it registers as a request level servlet Filter with the Sling Main Servlet. Each request is logged in a special file (currently fixed at ${sling.home}/logs/requesttracker.txt) with a header line provding core information on the request:

After that first line the complete data from the requests RequestProgressTracker is dumped.

Web Console Integration

The Request Processing Analyzer is available through the Web Console in the Sling category to

The option to launch the Swing-based GUI is only available if the Sling application is not running in headless mode and if the Web Console is accessed on localhost, that is on the same host as the Sling instance is running.

Analyzing the requesttracker.txt file

To analyze the requesttracker.txt file the Request Processing Analyzer module can also be used as a standalone Java application. Just start the module using the java command:

$ java -jar org.apache.sling.reqanalyzer-0.0.1-SNAPSHOT.jar requesttracker.txt

The command supports two command line arguments:

  1. The tracker file (required)
  2. The number of requests to load and display from the file. This second option is optional and may be used to limit the request information loaded to the first requests in the file

After starting and parsing the file, a window is opened showing the core request information in simple table. This table can be sorted by any of the columns by clicking on the column title.

Recorded Requests

Clicking on any row opens a second window displaying the detail request progress information as recorded before with the RequestProgressTracker.

Details of a recorded Request

The size, location, and the widths of the table columns are persisted with the Java Preferences API and thus when starting the application again, these settings are preserved.

Rev. 1525921 by fmeschbe on Tue, 24 Sep 2013 15:16:51 +0000
Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.