Performance Zone is brought to you in partnership with:

Viral has posted 1 posts at DZone. View Full User Profile

Performance Monitoring Using Glassbox

  • submit to reddit

The industry is recognizing the fact that performance testing & engineering should be part of the project execution road map starting from the requirements gathering phase. At many times during project executions, performance engineering related activities are executed based on customer need or slow response time of application after development phase gets completed.

Glassbox can be leveraged (by developers/testers/business users) during and after the development cycle to monitor the response times of requests with-out being aware of underlying application structure and code details. Analysis generated by Glassbox gives direct pointers on where is the bottleneck which causes slow response time for that particular request/page/URL.

About Glassbox

Glassbox is an open source web application which aid in performance monitoring and troubleshooting of multiple web applications deployed in container.

It contains the built-in knowledge repository of common problems which are used to pinpoint the issues and suggestions on causes as Java code executes.

Performance Monitoring
It monitors the requests as Java code executes and provides details about response times. Glassbox web client (AJAX GUI) provides nice summary dashboard view which contains various attributes like (server-name, application name, operation/request-URL, average time, no. of executions, status (slow / OK) and analysis details). By default, an operation that takes more than 1 sec execution time is marked as SLOW status. Such SLA can be modified using Glassbox properties file.

Analysis part describes the problem precisely and very clearly in plain English words, rather than displaying large code/exception trace. This definitely increases developer productivity by reducing developer’s time spent in log files and using IDE debuggers.

The two main components of Glassbox are Monitor and Agent. Monitor uses Aspect-Oriented Programming (AOP) to monitor the JVM activity. Agent diagnoses and presents the monitoring results and uses knowledge repository to cross reference the problem with suggestions/solutions. Glassbox agent supports viewing of the analysis results using JMX (eg. Java 5 JConsole) Consoles. Glassbox extensively uses the AOP approach internally to monitor the Java code. This gives the benefit of not making any changes to source code or build-process and hence can work with any legacy web application/jar file as well.

Glassbox should work on any application server that supports Servlet 2.3 or later. The servers where Glassbox is tested and installation process is automated are Apache Tomcat, weblogic, websphere, Resin, Oracle OC4J, websphere, Resin, Jetty & GlassFish.

Having Glassbox application running on same container would generate a performance overhead. Typically this would affect the response time and memory overhead. Hence it is recommended to start the Glassbox application only when it’s required for performance monitoring.

Glassbox is an open source project, it is free to download and run. Glassbox uses the GNU Lesser General Public License to distribute software and documentation.

Demo Application Development & Deployment to Tomcat

To test the capabilities of Glassbox, a sample application is developed which has a TestServlet class. This servlet calls DelayGenerator class’s generateDelay() method. This method calls Thread class’s sleep() method which suspends the execution of servlet. A counter is being initialized in DelayGenerator class which determines the time interval till which servlet is needed to be suspended.

 * File:
 * @author Viral Thakkar

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class TestServlet extends HttpServlet {

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		DelayGenerator delayObj = new DelayGenerator();
		int delay = delayObj.generateDelay();

		PrintWriter out =  response.getWriter();
		out.println("<H1> Hello World from Test Servlet : "+delay+" milliseconds </H1>");

 * File:
 * @author Viral Thakkar

public class DelayGenerator {
	private static int counter = 1;

	public int generateDelay() {
		try {
			Thread.sleep(counter * 100);
		} catch (InterruptedException e) {
		return counter*100;

Glassbox Installation & Integration to Apache Tomcat 6.0

Glassbox installation is very straightforward for non-clustered environment for the server where it’s automated. Simply drop the glassbox.war file at the appropriate folder inside server folder or perform the server specific steps/configuration to deploy the war file. Browse to server url with context root as glassbox – http://<<server_name>>:<port>/glassbox.


Follow the instructions available on this page. According to specific server, this page would suggest the configuration changes for a server. Please refer to Glassbox User Guide document for details on how to install Glassbox for clustered application server environment.


For Apache Tomcat 6.0- Add following command line arguments to Tomcat’s Java options:



Monitoring & Technical Analysis

Glassbox web client (URL- http://<<server_name>>:<<port>>/glassbox ) shows the summary and detailed view of all the requests/operations that container/JVM has executed.

Summary Section View

Different attributes (columns) which gets displayed in this table are as below -

Attribute / Column NameComments
StatusThis indicates whether operation/request is performing OK, SLOW or FAILING
AnalysisFor SLOW/FAILING status, this value provides the small summary of the cause of the problem.
OperationThis is name of the operation/request of an application
ServerName of the server where monitoring is being done. In a clustered environment, this allows to distinguish operations on different servers.
ExecutionsThis value indicates how many times this operation has run since the application server was started or Glassbox’s statistics were last reset.


Click the request in above summary table to view its detailed analysis in below detailed section.

Detailed Section View

The details area provides information relating to operations selected in the summary table. Different sub-sections which gets displayed in this view are as below -

Sub-section NameComments
Executive SummaryHigh level summary view of the selected operation gets displayed in a table format. This is neat view to senior stake holders who are not interested in technical details.
Technical SummaryThis section contains more technical details in paragraph and table representation formats to provide insight into root cause of the problem if any, like which operation, query is slow and statistics of same. Details like stack trace, thread lock name are provided to find and fix the problem.
“Common solutions” sub section shows pointers to resolve the identified problem/s.
“Glassbox has ruled out other potential problems” sub section saves time to know what problems have already been ruled out.

Executive Summary View

Technical Summary -> Technical Details Views

Above two snapshots are parts of the Technical Details section and provide minute details at code level with line number so as to pinpoint where the problem is.

Here cause is identified at Class inside Method generateDelay at line number 12 where Thread.sleep is invoked.

Perform Load Testing Using JMeter and Monitor Using Glassbox

apache-jmeter-logoApache JMeter is used to test performance both on static and dynamic resources (files, Servlets, Perl scripts, Java Objects, Data Bases and Queries, FTP Servers and more). It can be used to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types. It can be used to make a graphical analysis of performance or to test server/script/object behavior under heavy concurrent load.

Using JMeter, create a test plan that simulates 10 users requesting for 1 page 5 times. i.e. 10 x 1 x 5 = 50 HTTP requests. First step is to add a Thread Group element. The Thread Group tells JMeter the number of users to simulate, how often the users should send requests, and the how many requests they should send.


Next step is to add HTTP Request element to added Thread Group.
In parallel, have the Glassbox up and running to monitor response time statistics of the load generated by JMeter application.

Below is the Executive summary view of above test in Glassbox web UI interface. Section “Monitoring & Technical Analysis” contains the details to understand the Glassbox generated analysis.


Glassbox is not the replacement for performance testing tool like load runner.

Glassbox aids in the project to various stakeholders in finding, conveying and fixing the performance problems at all phases starting build (development) to post deployment.

Glassbox application to be started/installed only during monitoring time so as to avoid the performance overhead for other applications due to CPU & memory footprint occupied by Glassbox application on the container.

During load testing of the application, Glassbox turns out to be good option to figure out the root causes inside an application code.


Glassbox web site -
Glassbox User Guide -
Apache JMeter -

Download & Support

Glassbox Download Link -
Glassbox forum Link -

About Author

Viral Thakkar is a Technical Architect with the Banking and Capital Markets vertical at Infosys. He has 9.5 years of technology consulting experience mainly on Java/JEE technologies and frameworks with large banks and financial institutions across the globe. He has been part of many small and large-scale initiatives related to application development, architecture creation and strategy definition.


Published at DZone with permission of its author, Viral Thakkar.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Srinivas Jaggumantri replied on Thu, 2009/03/05 - 5:59am

Good introduction to Glassbox. Thank you

Michal Gajewski replied on Thu, 2009/03/05 - 9:15am

main page's doc link at does not point to the guide

Viral Thakkar replied on Fri, 2009/03/06 - 12:53am in response to: Michal Gajewski

Please check this url directly in browser after copying from here - Thanks.

shilpa tr replied on Mon, 2009/04/20 - 2:47am

hi..viral I have gone through your glassbox article. It is interesting. I want to know, if any article , documentation exists, to learn glassbox in detail. Are u working on this glassbox? What works u have did related to glassbox? If u have any ideas to enhance itor modify it's functionalities. Is there any other works by any person/S going on this glassbox project? Please share with me details rearding it may helpful in my work. I am going through glassbox source code to enhance it. I need some materials/white papers/pdfs/documents to understand thoroughly. I wish, you would help me in this area. Please reply to it. Thanking You, shilpatr

Viral Thakkar replied on Sun, 2009/07/12 - 6:25pm

Hello shilpatr,
I agree that there is not much documentation for few advanced topics like modifying the existing functionlities / source code. Here are few pointers which might help you. Refer Section - XI. Custom Glassbox Monitors at

Glassbox SourceForge forum - Few messages have pointers to Glassbox documentation.

Glassbox heavily uses AspectJ internally, on customizing you will need to go the AOP way, here is pointer -

I would suggest to refer to IBM AOP tutorial before starting the customization part. This is AOP@Work: Performance monitoring with AspectJ, Part 1. &2 This series articles touches upon Glassbox internal components w.r.t to AOP -

Regards, Viral

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.