Java Runtime Monitoring, part 2nd: Post-compilation and performance monitoring

Source: Internet
Author: User
Tags current time

Brief introduction

As you learned in part 1th of this series (three articles), monitoring the availability and performance of Java applications and dependencies in production is critical to ensuring problem detection and accelerating problem diagnosis and repair. Source-code-level inserts for classes that need to be monitored have the advantages that are discussed in part 1th, but this method is often not available or impractical. For example, many of the monitoring points you are interested in may be in third party components, and the source code for Third-party components is unknown to you. In the 2nd part, I focused on ways to insert Java classes and resources without modifying the original source code.

Alternative methods for arranging inserts in the source code are:

Intercept

Class packaging

Byte code cartridge

This article uses the ITracer interface presented in part 1th to implement performance data tracking, illustrating these techniques in turn.

Java Inserts by intercepting

The basic premise of interception is the conversion of a particular invocation pattern through an interception construct and the collection of incoming inbound and outbound call information. The implementation of a basic Interceptor program will:

Gets the current time of the request to the inbound call.

Retrieves the current time of the outbound response.

Calculates the run time as an increment of two measures.

Submits the call's elapsed time to the application performance management (APM) system.

Figure 1 shows the process:

Figure 1. Basic process of performance data collection and interception program

Many Java frameworks, such as Java Platform and Enterprise Edition (Java EE), include core support for the interception stack, which can be passed through a series of preprocessing and reprocessing components in the interception stack. With these stacks, it is possible to inject the cartridge into the execution path. There are two benefits to doing this: first, you don't need to modify the source code of the target class; second, you insert an interceptor class into the execution process by inserting it into the JVM's classpath and modifying the component's deployment descriptor.

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.