Aop@work: Performance monitoring with ASPECTJ, part 1th

Source: Internet
Author: User

Deep observation of Glassbox Inspector with AspectJ and JMX

Introduction: As Ron Bodkin describes how to synthesize the AspectJ and JMX groups in a flexible and modular manner, you can say goodbye to messy and tangled code. In the first part of this article, which is divided into two parts, Ron helps you build a monitoring system with the code and ideas from the Open-source project Glassbox Inspector, which provides information that identifies specific problems, but is low enough to use in a production environment.

Modern Java™ applications are often complex, multi-threaded, distributed systems that employ many third-party components. On such a system, it is difficult to detect (or isolate) the root cause of performance problems or reliability problems, especially in production. Traditional tools such as profiler may be useful for situations where problems are easy to reproduce, but the overhead of such tools is impractical for using them in production environments and even in load test environments.

A common alternative strategy for monitoring and inspecting applications and failures is to provide critical code for performance on calls, logging usage, timing, and error conditions. However, this approach requires that duplicate code be dispersed in many places, and what code to measure will need to undergo many tests and errors to determine. When the system changes, this approach is difficult to maintain, and difficult to penetrate. This makes it difficult to add or modify the code for your application when you need a better understanding of the performance requirements. Simply put, system monitoring is a classic crosscutting concern, so any non modular implementation can make it confusing.

Learning this two-part article will tell you that aspect-oriented programming (AOP) is naturally appropriate to address system monitoring issues. AOP allows you to define pointcuts that match many of the connection points that you want to monitor for performance. You can then write recommendations, update performance statistics, and automatically invoke recommendations when you enter or exit any of the connection points.

In this part of the article, I'll explain how to create a flexible, aspect-oriented monitoring infrastructure with AspectJ and JMX. The monitoring infrastructure I'm using is at the heart of the open source Glassbox Inspector monitoring Framework (see Resources). It provides relevant information to help identify specific problems, but is small enough to be used in a production environment. It allows you to capture statistics such as the total number of requests, total time, and worst-case performance, and also allow for information about database calls in the request. And all of this is done in a medium-scale code base!

In this article and in the next article, I'll start with building a simple glassbox Inspector implementation and gradually add functionality. Figure 1 provides an overview of the final system for this incremental development process. Note that this system is designed to monitor multiple WEB applications at the same time, and to provide combined statistical results.

Figure 1. Glassbox Inspector with jconsole JMX client

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.