DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Redis-Based Tomcat Session Management
  • Logging vs. Monitoring: Part 1
  • 10 Node.js Security Practices
  • Using Event-Driven Ansible to Monitor Your Web Application

Trending

  • Failure Handling Mechanisms in Microservices and Their Importance
  • Solid Testing Strategies for Salesforce Releases
  • Subtitles: The Good, the Bad, and the Resource-Heavy
  • Scaling InfluxDB for High-Volume Reporting With Continuous Queries (CQs)
  1. DZone
  2. Data Engineering
  3. Databases
  4. Performance Monitoring Using Glassbox

Performance Monitoring Using Glassbox

By 
Viral Thakkar user avatar
Viral Thakkar
·
Mar. 05, 09 · Interview
Likes (0)
Comment
Save
Tweet
Share
20.3K Views

Join the DZone community and get the full member experience.

Join For Free

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.

Troubleshooting
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.

Internals 
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.

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.
TestServlet.java

/**
 * File: TestServlet.java
 * @author Viral Thakkar
 */
package com.infosys.star.glassbox;
import java.io.IOException;
import java.io.PrintWriter;

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();
	}
}

DelayGenerator.java  

/**
 * File: DelayGenerator.java
 * @author Viral Thakkar
 */
package com.infosys.star.glassbox;

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;
	}
}

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 com.infosys.star.glassbox.DelayGenerator 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

Conclusion

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.

References

Glassbox web site - http://www.glassbox.com/glassbox/Home.html
Glassbox User Guide - http://nchc.dl.sourceforge.net/sourceforge/glassbox/Glassboxv2.0UserGuide.pdf
Apache JMeter - http://jakarta.apache.org/jmeter/

Download & Support

Glassbox Download Link - http://www.glassbox.com/glassbox/Downloads.html
Glassbox forum Link - http://sourceforge.net/forum/forum.php?forum_id=575670

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.

From http://viralpatel.net/blogs

Web application Apache Tomcat Application server Database code style Open source Monitor (synchronization)

Opinions expressed by DZone contributors are their own.

Related

  • Redis-Based Tomcat Session Management
  • Logging vs. Monitoring: Part 1
  • 10 Node.js Security Practices
  • Using Event-Driven Ansible to Monitor Your Web Application

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!