In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)05/31 Report--
This article analyzes "How to perform CaptureFramework analysis" with you. The content is detailed and easy to understand. Friends interested in "How to Conduct CaptureFramework Framework Analysis" can read it slowly and deeply along with the ideas of Xiaobian. I hope it can help everyone after reading. Let's learn more about how to do CaptureFramework analysis together with Xiaobian.
I. Background
Application service monitoring is an important part of intelligent operation and maintenance system. In UAV system, Middleware Enhancement Framework (MOF) probe provides application profile and performance data collection functions. Data collection function mainly collects four types of data: real-time data, profile data, call link data generation and thread data analysis data. To achieve real-time data acquisition, UAVStack designed the CaptureFramework framework to provide uniform data capture behavior and the ability to generate capture results.
II. CaptureFramework Operation Principle
2.1 Description of key technologies
JavaAssist
Monitor Capture System
precap/docap
2.2 Architecture Description
Capture points: Tomcat, MSCP, Springboot, Jetty buried points are supported.
UAVServer Singleton: Provides synchronous and asynchronous methods as a unified capture entry point.
StandardMonitor: implements Monitor interface, is a real-time data capture implementation class, provides doCapture method, responsible for capturing behavior and generating capture results.
MonitorElemCapHandler: Different grab logics and grab point common interfaces implement different buried point logics, providing preCap and doCap methods for grab behavior and preStore methods for generating grab results.
StandardMonitor Repository: Store real-time data grab data structures.
DataObserver: Exposes JMX/HTTP interface data.
2.3 Key class description
Monitor real-time monitoring is mainly to initialize StandardMonitor object from DefaultMonitorSupporter class, and install monitor object into DataStore object through CaptureFramework.
DataObserver provides JMX/HTTP services for subsequent MA capture, in which Http service registers three handlers, namely HttpJEEJVMObserver, HttpJEEMonitorObserver and HttpJEEProfileObserver. Different handlers expose different interfaces.
The Handler class under the MonitorHandler package specifically handles the metric data calculation and statistics of Monitor.
2.4 capture point profiling
CaptureFrameWork framework provides a unified capture entry point, and provides synchronous and asynchronous methods in UAV Server:
Synchronous Capture Entry Point: runMonitorCaptureOnServerCapPoint
Asynchronous Capture Entry Point: runMonitorAsyncCaptureOnServerCapPoint
2.4.1 Analysis of Differences Between Synchronous and Asynchronous Calls
Asynchronous adds a parameter CaptureContextMapFromAnotherThread more than synchronous. If this parameter is not empty, the context information needs to be merged. In general, when using asynchronous method buried points, call asynchronous capture method before method execution. CaptureContextMapFromAnotherThread passed in is empty and returns encapsulated context information. After method execution, call asynchronous capture method to pass in context information and merge context information, and then perform specific capture operation. For details, please refer to the following code snippet:
Asynchronous invocation before method execution
The asynchronous call after method execution is as follows, where ccMap is the encapsulated context information returned by the asynchronous call.
2.5 Grasping behavior analysis
Monitor interface: provides multiple interfaces, the most important of which are doCapture and doPreStore methods, doCapture is used to implement data capture behavior at specific capture points, doPreStore method is used to implement some capture actions before storing into the data structure, do some special data processing.
StandardMonitor class: concrete implementation class of Monitor interface.
StandardMonitorRepository class: stores real-time data grab data structures.
MonitorElementInstance interface: An instance interface that stores real-time data grab data structures.
StandardMonitorElementInstance class: concrete implementation class of MonitorElementInstance interface.
The doCapture method is executed regardless of whether the entry point is captured synchronously or asynchronously, and the code snippet is as follows:
monitor.doCapture calls doCapture in the Monitor interface, and its implementation class is StandardMonitor.
The doCapture method in StandardMonitor does the following:
Acquire the current MonitorElement array according to the parameters. The MonitorElement array is implemented by getElementByCapId of StandardMonitorRepository.
Loop the MonitorElement array, obtain the implementation class of capture data, obtain the handler to be executed according to the implementation class, and finally determine the capture stage (precap/docap) according to the currently obtained handler, and then perform corresponding processing. Different handlers generate MonitorElementInstance according to different characteristic processing, and finally store the result in StandardMonitorRepository data structure.
Take ServerEndRespTimeCapHandler as an example:
The preCap method records only the start request time of the service.
doCap method: Perform different logical processing according to different monitorElemId, and finally encapsulate the MonitorElementInstance instance, and then process the behavior result, including corresponding data processing such as maximum value peak elimination, maximum value, minimum value, return status code, timestamp update, counting, etc.
3.1 What is real-time data?
Runtime data refers to information generated when a program is running, CPU occupied by the program, heap memory, JVM information, and statistics related to service access and client calls (average response time, access count, etc.).
3.2 Server data acquisition
Implementation of DefaultMonitorSupporter
Server-side data collection takes DefaultMonitorSupporter.start as the entry point to construct monitor instance:
StandardMonitor instance of service type is built by default, which contains StandardMonitorRepository instance, StandardMonitorRepository instance registers monitor, one instance contains multiple MonitorElement instances, and all MonitorElement instances are saved in elemsMap attribute.
The elemsMap property holds different collection class handlers according to different collection objects:
ServerEndRespTimeCapHandler: response time and load count of collection Server, APP, URL, etc.
JVMStateCapHandler: Collect jvm state, including Heap usage, GC count, thread count, CPU, class count, etc.
The code snippet is as follows:
3.3 Client-side data acquisition
Implementation of DefaultClientMonitorSupporter
Client-side data collection takes DefaultClientMonitorSupporter.start as the entry point to build a monitor instance:
StandardMonitor instance of client type is built by default, which contains StandardMonitorRepository instance, StandardMonitorRepository instance registers monitor, one instance contains multiple MonitorElement instances, and all MonitorElement instances are saved in elemsMap attribute.
elemsMap: Property holds only one ClientRespTimeCapHandler collection class.
ClientRespTimeCapHandler: Collect client response time and load count, etc.
Both client-side and server-side data collection install monitors into DataObserver; and finally, successfully built monitors are bound to specified capture methods (i.e., precap and docap).
3.4 Implementation of DataObServer
DataObServer provides two modes for exposing interface data, JMX and HTTP:
HTTP mode: HttpDataObserverWorker.start is used as the entry point, and three handlers are registered respectively, which are handlers for obtaining JVM data, Monitor data and profile data respectively. Different handlers expose different interfaces and eventually return data in JSON format.
JMX mode: JMX agent obtains exposed interfaces through getMBeanInfo method to obtain data.
DataObServer also provides methods to install and uninstall monitors, add and remove listeners, and obtain profiles and monitors:
About how to carry out CaptureFramework framework analysis to share here, I hope the above content can make everyone improve. If you want to learn more, please pay more attention to the updates of Xiaobian. Thank you for your attention to the website!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.