Performance Monitoring using Glassbox

performance-testing-using-glassbox Industry is recognizing the fact that Performance testing & engineering should be part of the project execution road map starting from Requirement 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-logoGlassbox is an open source web application which aid in performance monitoring and troubleshooting of multiple web applications deployed in container. Troubleshooting – It contain 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. Internals – 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. Technologies – 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. Overhead – 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. Licensing – 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 */ package; import; import; 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(); response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<HTML><BODY>"); out.println("<H1> Hello World from Test Servlet : "+delay+" milliseconds </H1>"); out.println("</BODY></HTML>"); out.flush(); } }
Code language: Java (java)
/** * File: * @author Viral Thakkar */ package; public class DelayGenerator { private static int counter = 1; public int generateDelay() { try { Thread.sleep(counter * 100); counter++; } catch (InterruptedException e) { e.printStackTrace(); } return counter*100; } }
Code language: Java (java)

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. glassbox-installation-steps-1 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. glassbox-installation-steps-2 For Apache Tomcat 6.0- Add following command line arguments to Tomcat’s Java options: -Dglassbox.install.dir=C:\Tomcat6.0\lib\glassbox -Djava.rmi.server.useCodebaseOnly=true -javaagent:C:\Tomcat6.0\lib\aspectjweaver.jar glassbox-tomcat-configuration

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.
glassbox-summary-view 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 glassbox-output-slow-operation Technical Summary -> Technical Details Views glassbox-output-slow-java-method 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. jmeter-thread-properties Next step is to add HTTP Request element to added Thread Group. jmeter-thread-group-configuration 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-java-slow-method-50-sec


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.
Get our Articles via Email. Enter your email address.

You may also like...


  1. Great stuff! Thanks.


  2. Server monitoring is done very capably with the SysOrb monitoring system. Is is highly scalable and at the same time so easy to use, which often leads to completion success.

  3. Dzmitry Kashlach says:

    Also there is another way how to perform results monitoring using JMeter.
    There is one JMeter plugin, which allows running tests on local machine and observing them on server.

  4. Ganesh says:

    I may be late, but would like to know if this tool is still active and updated to work on Tomcat 8? The glassbox link seems broken. Please share if any update.

Leave a Reply

Your email address will not be published. Required fields are marked *