Topic 23
■■■
Spring Application Monitoring
A typical JEE application contains a number of layers and components, such as the presentation layer,
service layer, persistence layer, backend data source, and so on. During the development stage or after
the application had been deployed to the quality assurance (QA) or production environment, we want to
ensure that the application is in a healthy state without any potential problems or bottlenecks.
In a Java application, various areas may cause performance problems or overload server resources
(such as CPU, memory, I/O, and so on). Examples are inefficient Java code, memory leaks (for example,
Java code keeps allocating new objects without releasing the reference and prevents the underlying JVM
from freeing up the memory during the garbage collection process), JVM parameters, thread pool
parameters, data source configurations (for example, the number of concurrent database connections
allowed), database setup, long-running SQL queries, and so on.
Consequently, there is a need to understand an application's runtime behavior and identify whether
there are any potential bottlenecks or problems. In the Java world, a lot of tools can help monitor the
detailed runtime behavior of JEE applications. Most of them are built on top of the Java Management
Extensions (JMX) technology.
In this chapter, we will discuss several common techniques for monitoring Spring-based JEE
applications. Specifically, this chapter will cover the following topics:
Spring support of JMX: We will discuss Spring's comprehensive support of JMX
·
and demonstrate how to expose Spring beans for monitoring with JMX tools. In
this chapter, we will use VisualVM (http://visualvm.java.net/index.html) as the
application monitoring tool.
Monitoring Hibernate statistics and Spring Batch: Hibernate and Spring Batch also
·
provide support classes and infrastructure for exposing the operational status and
performance metrics using JMX. We will take a look at how to enable the JMX
monitoring of those commonly used components in Spring-powered JEE
applications.
Spring Insight: Spring Insight (www.springsource.org/insight) is a technology
·
developed by SpringSource that provides comprehensive support and a user
interface that can help developers understand and visualize the behavior of any
Spring-powered application. The tool is bundled with the tc Server Developer
Edition in STS. We will discuss how to use Spring Insight to monitor Spring-based
JEE applications.
Remember that this chapter is not intended to be an introduction to JMX, and a basic
understanding of JMX is assumed. For detailed information, please refer to Oracle's online resource at
www.oracle.com/technetwork/java/javase/tech/javamanagement-140525.html.
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home