CN111026601A - Monitoring method and device for Java application system, electronic equipment and storage medium - Google Patents

Monitoring method and device for Java application system, electronic equipment and storage medium Download PDF

Info

Publication number
CN111026601A
CN111026601A CN201910900316.9A CN201910900316A CN111026601A CN 111026601 A CN111026601 A CN 111026601A CN 201910900316 A CN201910900316 A CN 201910900316A CN 111026601 A CN111026601 A CN 111026601A
Authority
CN
China
Prior art keywords
monitoring
java
agent
application system
jvm
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910900316.9A
Other languages
Chinese (zh)
Inventor
彭程
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Rajax Network Technology Co Ltd
Original Assignee
Rajax Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Rajax Network Technology Co Ltd filed Critical Rajax Network Technology Co Ltd
Priority to CN201910900316.9A priority Critical patent/CN111026601A/en
Publication of CN111026601A publication Critical patent/CN111026601A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/079Root cause analysis, i.e. error or fault diagnosis

Abstract

The embodiment of the invention discloses a monitoring method, a monitoring device, electronic equipment and a storage medium of a Java application system. Therefore, the embodiment can more accurately embed the monitoring logic code in the designated position, thereby improving the accuracy and timeliness of monitoring data, and improving the efficiency of analyzing, diagnosing, positioning and solving the fault of the Java application system performance.

Description

Monitoring method and device for Java application system, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer application technologies, and in particular, to a monitoring method and apparatus for a Java application system, an electronic device, and a storage medium.
Background
With the continuous deepening and improvement of IT construction, the operation and maintenance of computer hardware systems become increasingly important. One important aspect of ensuring the normal and continuous operation of the application system is to monitor the behavior of the application system, and to give an alarm in time when the behavior of the application system is found to be inconsistent or abnormal, so that maintenance personnel can handle problems and remove faults or potential problems. In the monitoring technology, various probes are generally adopted to externally observe CPU, memory resources and the like occupied by an application system, so that the internal behavior of the application system cannot be detected, and the problem of a deep system cannot be positioned and analyzed. Therefore, how to accurately and timely detect the internal behavior of the application program in the application system running environment under the condition of having as low influence on the service as possible is a problem to be solved at present.
Disclosure of Invention
In view of this, embodiments of the present invention provide a monitoring method and apparatus for a Java application system, an electronic device, and a storage medium, so as to accurately embed a monitoring logic code at a designated location, thereby improving accuracy and timeliness of monitoring data, and further improving efficiency of analyzing, diagnosing, locating a fault, and resolving a fault of a Java application system.
In a first aspect, an embodiment of the present invention provides a monitoring method for a Java application system, where the Java application system is deployed with a Java virtual machine JVM, and the method includes:
starting the JVM and loading an agent;
loading a class file of an application program to be monitored according to a configuration file, wherein the configuration file comprises a class file name and a monitoring logic code to be embedded;
determining the appointed line number of the monitoring logic code to be embedded in the class file;
controlling the agent to modify the byte codes of the class files so as to embed the monitoring logic codes at the preset positions of the specified line numbers;
the monitoring logic code is executed to obtain monitoring data when a monitored application is invoked.
Optionally, a Java bytecode manipulation framework ASM is deployed on the Java application system;
controlling the agent to modify the byte codes of the class files, and embedding the monitoring logic codes at the preset positions of the specified line numbers specifically comprises the following steps:
causing the agent to control the Java bytecode manipulation framework ASM to modify the bytecode of the class file so as to embed the monitoring logic code at a predetermined position of the specified line number.
Optionally, the predetermined position of the designated line number is the end of the line of the designated line number.
Optionally, a monitoring index logic is embedded in the class file.
Optionally, the method further includes:
when the monitored application program is called, acquiring the monitoring index;
and determining the performance and fault information of the java application system according to the monitoring data based on the monitoring index.
Optionally, the starting of the Java virtual machine JVM and the loading of the agent specifically include:
and starting the JVM (Java virtual machine), and loading the agent according to the JVM interface.
In a second aspect, an embodiment of the present invention provides a monitoring apparatus for a Java application system, where a Java virtual machine JVM is deployed on the Java application system, and the apparatus includes:
the starting unit is configured to start the Java virtual machine JVM and load the agent;
the loading unit is configured to load a class file of an application program to be monitored according to a configuration file, wherein the configuration file comprises a class file name and a monitoring logic code to be embedded;
the specified line number determining unit is configured to determine the specified line number of the monitoring logic code to be embedded in the class file;
an embedding unit configured to control the agent to modify the bytecode of the class file to embed the monitoring logic code at a predetermined position of the designated line number;
an execution unit configured to execute the monitoring logic code to obtain monitoring data when the monitored application program is invoked.
Optionally, a Java bytecode manipulation framework ASM is deployed on the Java application system;
the embedding unit includes:
an embedding subunit configured to cause the agent to control the Java bytecode manipulation framework ASM to modify the bytecode of the class file to embed the supervisory logic code at a predetermined position of the specified line number.
Optionally, the predetermined position of the designated line number is the end of the line of the designated line number.
Optionally, a monitoring index logic is embedded in the class file.
Optionally, the apparatus further comprises:
a monitoring index acquisition unit configured to acquire the monitoring index when a monitored application program is called;
an information determination unit configured to determine performance and fault information of the java application system from the monitoring data based on the monitoring index.
Optionally, the starting unit includes:
and the promoter unit is configured to start the JVM and load the agent according to a JVMTI interface.
In a third aspect, an embodiment of the present invention provides an electronic device, including a memory and a processor, where the memory is used to store one or more computer program instructions, where the one or more computer program instructions are executed by the processor to implement the method as described above.
In a fourth aspect, embodiments of the present invention provide a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement a method as described above.
According to the embodiment of the invention, the agent embeds the monitoring logic code in the specified position of the specified line number in the class file of the application program to be monitored, so that when the monitored application program is called, the monitoring logic service code is executed, and the monitoring data is obtained. Therefore, the embodiment can more accurately embed the monitoring logic code in the designated position, thereby improving the accuracy and timeliness of monitoring data, and improving the efficiency of analyzing, diagnosing, positioning and solving the fault of the Java application system performance.
Drawings
The above and other objects, features and advantages of the present invention will become more apparent from the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:
fig. 1 is a flowchart of a monitoring method of a Java application system according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a monitoring method of a Java application system according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a monitoring method of a Java application system according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a monitoring apparatus of a Java application system according to an embodiment of the present invention;
fig. 5 is a schematic diagram of an electronic device of an embodiment of the invention.
Detailed Description
The present invention will be described below based on examples, but the present invention is not limited to only these examples. In the following detailed description of the present invention, certain specific details are set forth. It will be apparent to one skilled in the art that the present invention may be practiced without these specific details. Well-known methods, procedures, components and circuits have not been described in detail so as not to obscure the present invention.
Further, those of ordinary skill in the art will appreciate that the drawings provided herein are for illustrative purposes and are not necessarily drawn to scale.
Unless the context clearly requires otherwise, throughout the description, the words "comprise", "comprising", and the like are to be construed in an inclusive sense as opposed to an exclusive or exhaustive sense; that is, what is meant is "including, but not limited to".
In the description of the present invention, it is to be understood that the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. In addition, in the description of the present invention, "a plurality" means two or more unless otherwise specified.
Fig. 1 is a flowchart of a monitoring method for a Java application system according to an embodiment of the present invention. In this embodiment, a Java Virtual machine jvm (Java Virtual machine) is deployed on the Java application system. The JVM is a specification for a computing device, and is a fictitious computer implemented by simulating various computing functions on an actual computer. The JVM defines 5 specifications to implement the running of Java programs: the system comprises a JVM instruction system, JVM registers, a JVM stack structure, a JVM fragment recycle file and a JVM storage area. The JVM enables Java language to mask information related to a specific operating system platform, so that a Java language compiler can run on a variety of platforms without modification by only generating object codes (i.e., bytecode) that run on the JVM. When executing the bytecode, the JVM interprets the bytecode into machine instructions on a specific operating system platform for execution, thereby realizing that the Java program is 'compiled once and run everywhere'.
The class file can be correctly executed by the JVM. The Java probe constructs an agent program (namely an agent) independent of a business program by using a Java bytecode enhancement technology, and is used for detecting and assisting the program running on the JVM, and even can dynamically replace and modify the definitions of certain classes, thereby realizing code-level business performance monitoring and fault location.
As shown in fig. 1, the monitoring method for the Java application system of this embodiment includes the following steps:
and S100, starting the JVM and loading the agent. In an optional implementation manner, the Java Virtual Machine JVM is started, and the agent is loaded according to a JVM ti Interface (Java Virtual Machine Tool Interface). The JVM SI is a set of general programming interfaces provided by JDKs for developing JVM monitoring, problem locating and performance tuning tools. In this embodiment, the agent is developed based on the JVM interface and exists in the form of a shared library, and when the JVM is started, the agent is dynamically loaded according to the JVM interface.
Step S200, loading a class file of the application program to be monitored according to a configuration file, wherein the configuration file comprises a class file name and a monitoring logic code to be embedded. Optionally, the monitoring logic code includes a selection parameter, wherein the selection parameter includes at least one accessible parameter prior to the embedding location.
Step S300, determining the appointed line number of the monitoring logic code to be embedded in the class file of the monitored application program. Since the target code of the JVM is the bytecode, and the line number (LINENUMBER) of the source code is reserved in the bytecode corresponding to the class file, in this embodiment, by embedding the monitoring logic code at the designated line number, the accuracy of embedding the monitoring logic code at the designated position can be improved, and further, the accuracy of monitoring data and the efficiency of acquiring the monitoring data are improved.
Step S400, controlling the agent to modify the byte code of the class file so as to embed the monitoring logic code at the preset position of the specified line number. Optionally, the predetermined position of the designated line number is the end of the line of the designated line number. Thereby, the accuracy of embedding the monitoring logic code at the specified location can be further improved.
In an alternative implementation manner, a Java bytecode manipulation framework ASM is deployed on the Java application system of the embodiment. Step S400 specifically includes:
the control agent causes the Java bytecode manipulation framework ASM to modify the bytecode of the class file to embed the monitoring logic code at a predetermined position of the specified line number.
The ASM is a Java bytecode operation framework and can be used for dynamically generating classes or enhancing the functions of existing classes, and the ASM can directly generate binary class files and can dynamically change the class behaviors before the class files are loaded into the JVM. Class files contain sufficient metadata to resolve the elements of class name, method, attributes, and Java bytecode (Java instructions) in the class. After the ASM reads information from the class file, the ASM can change class behaviors, analyze class information and even generate a new class file according to user requirements.
In this embodiment, the ASM bytecode manipulation framework is controlled to generate a binary class file a.class, the class file a.class is loaded into the JVM according to a class loader in the JVM, and in the process of loading the class file a.class, the agent is enabled to embed the monitoring logic code at the end of a specified line number line in the bytecode of the class file a.class according to the configuration file to generate a modified class file a'. class.
Step S500, when the monitored application program is called, executing the monitoring logic code to acquire the monitoring data. Specifically, when the monitored application is called, for example, the monitored application includes the class file a.class, the engine in the JVM may acquire and execute the class file a '. class embedded with the monitoring logic code, where executing the class file a'. class may perform the normal service logic of the class file a.class, and may also perform the monitoring logic code to acquire the monitoring data.
In an alternative implementation, class files in the application program of the Java application system are embedded with monitoring index logic. The monitoring method of the embodiment further includes:
and when the monitored application program is called, acquiring the monitoring index, and determining the performance and fault information of the java application system according to the acquired monitoring data based on the monitoring index.
In another alternative implementation manner, the configuration file may include a monitoring index, and thus, the monitoring index may be obtained according to the configuration file, and the performance and the fault information of the java application system may be determined according to the monitoring index and the monitoring data.
The monitoring index comprises at least one of indexes such as an average response time index of the Java application system, an average response time index of a single transaction in the Java application system, a code execution time index, a throughput index of the Java application system, an error rate index of the Java application system and the like. Therefore, the monitoring data can be analyzed through the monitoring index to determine various performance and fault information of the Java application system.
In an alternative implementation, the agent in the JVM periodically sends out the monitoring data, for example, for 1 minute, and performs analysis according to the monitoring data by using a predetermined performance profiling technique (e.g., Eclipse Memory Analyzer, etc.). The performance analysis is to call system interrupt in a specified time range at regular time, then the terminal application program acquires the current call stack information, records the functions appearing in the call stack and the call structures of the functions, and acquires the call relation diagram of the functions and the CPU use information of each function based on the information, so that the information such as the time spent on executing each method can be clearly obtained through the information.
In the embodiment, the agent embeds the monitoring logic code in the specified position of the specified line number in the class file of the application program to be monitored, so that when the application program to be monitored is called, the monitoring logic service code is executed, thereby acquiring the monitoring data. Therefore, the embodiment can more accurately embed the monitoring logic code in the designated position, thereby improving the accuracy and timeliness of monitoring data, and improving the efficiency of analyzing, diagnosing, positioning and solving the fault of the Java application system performance.
Fig. 2 is a schematic diagram of a monitoring method of a Java application system according to an embodiment of the present invention. In this embodiment, the agent includes a dynamic link library or the like, and is loaded as a part of the Java program when the Java program is started. As shown in FIG. 2, when JVM21 starts, JVM21 looks up the dynamic link library 221 in agent 22 according to the run parameters, calls the agent _ onload method according to the JVM TI specification, and initializes it. In this process, agent 22 reads configuration file 23 to determine the class files in the application to be monitored, and then declares events of interest (e.g., response time of the application, etc.) to JVM21 accordingly. When these events occur, the relevant callback functions are executed to obtain the results of these events. With this mechanism, agent 22 can dynamically modify the bytecode of the Java program through the ASM bytecode manipulation framework to embed the monitoring logic code at a specified location when the class file is loaded. In the embodiment, the monitoring logic code is embedded at the end of the line of the specified line number so as to more accurately embed the monitoring logic code at the specified position, thereby improving the accuracy and timeliness of the monitoring data. When the method of the corresponding class is executed, the relevant monitoring logic code is executed, thereby obtaining monitoring data (e.g., behavior statistics) of the application 211. For example, the application 211 includes a class file a.class, the interesting time includes an execution delay of the a.class, and the agent modifies the bytecode of the related method in the class by ASM when the a.class is loaded, so as to obtain the system time when the method is started to be executed, obtain the system time again when the method is finished, and calculate the difference between the two to obtain the execution time of the method. agent 22, when loaded, initiates data send thread 222, and data send thread 222 periodically sends monitoring data to data collection unit 24 via the network. The performance profiling unit 25 may profile the monitoring data collected by the data collection unit 24 and output performance and failure information of the Java application system.
In the embodiment, the agent embeds the monitoring logic code in the specified position of the specified line number in the class file of the application program to be monitored, so that when the application program to be monitored is called, the monitoring logic service code is executed, thereby acquiring the monitoring data. Therefore, the embodiment can more accurately embed the monitoring logic code in the designated position, thereby improving the accuracy and timeliness of monitoring data, and improving the efficiency of analyzing, diagnosing, positioning and solving the fault of the Java application system performance.
Fig. 3 is a schematic diagram of a monitoring method of a Java application system according to an embodiment of the present invention. In this embodiment, the Java bytecode technology is used to monitor the running of the application program in the Java application system to obtain various monitoring data, and a predetermined performance profiling technology is used to analyze the performance of the Java application system. The Java virtual machine JVM and the ASM bytecode manipulation framework are deployed on the Java application system, and the application program runs on the JVM.
As shown in fig. 3, a binary file a.class file is directly generated in an ASM bytecode manipulation framework, the a.class file is loaded into the JVM according to a class loader in the JVM, and in the process of loading the class file a.class, a javaagent in the JVM embeds the monitoring logic code into the end of a specified line number line in the bytecode of the class file a.class according to a configuration file, so as to generate a modified class file a'. class. When a request needs to call the class file a.class, the engine in the JVM acquires and executes the class file a '. class embedded with the monitoring logic code, where executing the class file a'. class can perform the normal service logic of the class file a.class, and simultaneously can perform the monitoring logic code to acquire the monitoring data. And then, writing the acquired monitoring data into a monitoring data cache region by an engine in the JVM. Optionally, the data sending thread in the agent sends the monitoring data periodically (for example, every 1min), and cleans up the monitoring data buffer.
In the embodiment, the agent embeds the monitoring logic code in the specified position of the specified line number in the class file of the application program to be monitored, so that when the application program to be monitored is called, the monitoring logic service code is executed, thereby acquiring the monitoring data. Therefore, the embodiment can more accurately embed the monitoring logic code in the designated position, thereby improving the accuracy and timeliness of monitoring data, and improving the efficiency of analyzing, diagnosing, positioning and solving the fault of the Java application system performance.
Fig. 4 is a schematic diagram of a monitoring apparatus of a Java application system according to an embodiment of the present invention. In this embodiment, a Java virtual machine JVM is deployed on a Java application system. As shown in fig. 4, the monitoring apparatus 4 of the Java application system in this embodiment includes a startup unit 41, a loading unit 42, a specified line number determination unit 43, an embedding unit 44, and an execution unit 45.
And the starting unit 41 is configured to start the Java virtual machine JVM and load the agent. In an alternative implementation manner, the starting unit 41 includes a promoter unit, where the promoter unit is configured to start the Java virtual machine JVM and load the agent according to the JVMTI interface.
And the loading unit 42 is configured to load the class file of the application program to be monitored according to the configuration file, wherein the configuration file comprises the class file name and the monitoring logic code to be embedded.
A specified line number determining unit 43 configured to determine a specified line number in the class file, where the monitoring logic code needs to be embedded.
An embedding unit 44 configured to control the agent to modify the bytecode of the class file to embed the monitoring logic code at a predetermined position of the specified line number. In an alternative implementation, the embedding unit 44 includes an embedding subunit configured to cause the agent to control the Java bytecode manipulation framework ASM to modify the bytecode of the class file to embed the monitoring logic code at a predetermined position of the specified line number. In an alternative implementation, the predetermined position of the designated line number is the end of the line of the designated line number.
The execution unit 45 is configured to execute the monitoring logic code to obtain monitoring data when the monitored application is invoked.
In an optional implementation manner, a monitoring index logic is embedded in the class file, and the monitoring apparatus 4 of the Java application system of this embodiment further includes a monitoring index obtaining unit and an information determining unit. Wherein the monitoring index obtaining unit is configured to obtain the monitoring index when the monitored application program is called. An information determination unit configured to determine performance and fault information of the java application system from the monitoring data based on the monitoring index.
In the embodiment, the agent embeds the monitoring logic code in the specified position of the specified line number in the class file of the application program to be monitored, so that when the application program to be monitored is called, the monitoring logic service code is executed, thereby acquiring the monitoring data. Therefore, the embodiment can more accurately embed the monitoring logic code in the designated position, thereby improving the accuracy and timeliness of monitoring data, and improving the efficiency of analyzing, diagnosing, positioning and solving the fault of the Java application system performance.
Fig. 5 is a schematic diagram of an electronic device of an embodiment of the invention. In the present embodiment, the electronic device 5 includes a server, a terminal, and the like. As shown in fig. 5, the electronic apparatus 5: at least one processor 501; and a memory 502 communicatively coupled to the at least one processor 501; and a communication component 503 in communicative connection with the scanning device, the communication component 503 receiving and transmitting data under the control of the processor 501; wherein the memory 502 stores instructions executable by the at least one processor 501, the instructions being executable by the at least one processor 501 to implement the steps of:
starting the JVM and loading an agent;
loading a class file of an application program to be monitored according to a configuration file, wherein the configuration file comprises a class file name and a monitoring logic code to be embedded;
determining the appointed line number of the monitoring logic code to be embedded in the class file;
controlling the agent to modify the byte codes of the class files so as to embed the monitoring logic codes at the preset positions of the specified line numbers;
the monitoring logic code is executed to obtain monitoring data when a monitored application is invoked.
Optionally, a Java bytecode manipulation framework ASM is deployed on the Java application system;
controlling the agent to modify the byte codes of the class files, and embedding the monitoring logic codes at the preset positions of the specified line numbers specifically comprises the following steps:
causing the agent to control the Java bytecode manipulation framework ASM to modify the bytecode of the class file so as to embed the monitoring logic code at a predetermined position of the specified line number.
Optionally, the predetermined position of the designated line number is the end of the line of the designated line number.
Optionally, a monitoring index logic is embedded in the class file.
Optionally, the electronic device is further configured to implement the following steps:
when the monitored application program is called, acquiring the monitoring index;
and determining the performance and fault information of the java application system according to the monitoring data based on the monitoring index.
Optionally, the Java virtual machine JVM is started, and the agent loading agent specifically includes:
and starting the JVM (Java virtual machine), and loading the agent according to the JVM interface.
Specifically, the electronic device includes: one or more processors 501 and a memory 502, with one processor 501 being an example in fig. 5. The processor 501 and the memory 502 may be connected by a bus or other means, and fig. 5 illustrates the connection by the bus as an example. Memory 502, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The processor 501 executes various functional applications and data processing of the device by running the nonvolatile software programs, instructions, and modules stored in the memory 502, that is, implements the monitoring method of the Java application system described above.
The memory 502 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store a list of options, etc. Further, the memory 502 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, memory 502 may optionally include memory located remotely from processor 501, which may be connected to an external device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
One or more modules are stored in the memory 502 and, when executed by the one or more processors 501, perform the monitoring processing method of the Java application system in any of the method embodiments described above.
The product can execute the method provided by the embodiment of the application, has corresponding functional modules and beneficial effects of the execution method, and can refer to the method provided by the embodiment of the application without detailed technical details in the embodiment.
According to the embodiment of the invention, the agent embeds the monitoring logic code in the specified position of the specified line number in the class file of the application program to be monitored, so that when the monitored application program is called, the monitoring logic service code is executed, and the monitoring data is obtained. Therefore, the embodiment can more accurately embed the monitoring logic code in the designated position, thereby improving the accuracy and timeliness of monitoring data, and improving the efficiency of analyzing, diagnosing, positioning and solving the fault of the Java application system performance.
Another embodiment of the invention is directed to a non-transitory storage medium storing a computer-readable program for causing a computer to perform some or all of the above-described method embodiments.
That is, as can be understood by those skilled in the art, all or part of the steps in the method for implementing the embodiments described above may be implemented by a program instructing related hardware, where the program is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the method described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
The embodiment of the invention discloses A1 and a monitoring method of a Java application system, wherein a Java virtual machine JVM is deployed on the Java application system, and the method comprises the following steps:
starting the JVM and loading an agent;
loading a class file of an application program to be monitored according to a configuration file, wherein the configuration file comprises a class file name and a monitoring logic code to be embedded;
determining the appointed line number of the monitoring logic code to be embedded in the class file;
controlling the agent to modify the byte codes of the class files so as to embed the monitoring logic codes at the preset positions of the specified line numbers;
the monitoring logic code is executed to obtain monitoring data when a monitored application is invoked.
A2, the method according to A1, wherein a Java bytecode manipulation framework (ASM) is deployed on the Java application system;
the step of controlling the agent to modify the byte codes of the class files so as to embed the monitoring logic codes in the preset positions of the specified line numbers specifically comprises the following steps:
causing the agent to control the Java bytecode manipulation framework ASM to modify the bytecode of the class file so as to embed the monitoring logic code at a predetermined position of the specified line number.
A3, the method of A1 or A2, wherein the predetermined location of the specified line number is the end of the line of the specified line number.
A4, the method according to A1, wherein the class file has embedded therein monitoring metrics logic.
A5, the method according to A4, wherein the method further comprises:
when the monitored application program is called, acquiring the monitoring index;
and determining the performance and fault information of the java application system according to the monitoring data based on the monitoring index.
A6, according to the method of A1, wherein the starting the Java virtual machine JVM and the loading agent specifically comprise:
and starting the JVM (Java virtual machine), and loading the agent according to the JVM interface.
The embodiment of the invention also discloses B1 and a monitoring device of the Java application system, wherein the Java application system is provided with a Java virtual machine JVM, and the device comprises:
the starting unit is configured to start the Java virtual machine JVM and load the agent;
the loading unit is configured to load a class file of an application program to be monitored according to a configuration file, wherein the configuration file comprises a class file name and a monitoring logic code to be embedded;
the specified line number determining unit is configured to determine the specified line number of the monitoring logic code to be embedded in the class file;
an embedding unit configured to control the agent to modify the bytecode of the class file to embed the monitoring logic code at a predetermined position of the designated line number;
an execution unit configured to execute the monitoring logic code to obtain monitoring data when the monitored application program is invoked.
B2, the apparatus according to B1, wherein a Java bytecode manipulation framework (ASM) is deployed on the Java application system;
the embedding unit includes:
an embedding subunit configured to cause the agent to control the Java bytecode manipulation framework ASM to modify the bytecode of the class file to embed the supervisory logic code at a predetermined position of the specified line number.
B3, the apparatus of B1 or B2, wherein the predetermined position of the specified line number is the end of the line of the specified line number.
B4, the apparatus according to B1, wherein the class file is embedded with monitoring index logic.
B5, the apparatus according to B4, wherein the apparatus further comprises:
a monitoring index acquisition unit configured to acquire the monitoring index when a monitored application program is called;
an information determination unit configured to determine performance and fault information of the java application system from the monitoring data based on the monitoring index.
B6, the device according to B1, wherein the starting unit comprises:
and the promoter unit is configured to start the JVM and load the agent according to a JVMTI interface.
The embodiment of the invention also discloses C1, an electronic device, comprising a memory and a processor, wherein the memory is used for storing one or more computer program instructions, and the processor executes the one or more computer program instructions to realize the method according to any one of A1-A6.
The embodiment of the invention also discloses D1, a computer readable storage medium, and computer program instructions stored thereon, wherein the computer program instructions realize the method according to any one of A1-A6 when being executed by a processor.

Claims (10)

1. A monitoring method for a Java application system is characterized in that a Java Virtual Machine (JVM) is deployed on the Java application system, and the method comprises the following steps:
starting the JVM and loading an agent;
loading a class file of an application program to be monitored according to a configuration file, wherein the configuration file comprises a class file name and a monitoring logic code to be embedded;
determining the appointed line number of the monitoring logic code to be embedded in the class file;
controlling the agent to modify the byte codes of the class files so as to embed the monitoring logic codes at the preset positions of the specified line numbers;
the monitoring logic code is executed to obtain monitoring data when a monitored application is invoked.
2. The method according to claim 1, wherein a Java bytecode manipulation framework (ASM) is deployed on the Java application system;
the step of controlling the agent to modify the byte codes of the class files so as to embed the monitoring logic codes in the preset positions of the specified line numbers specifically comprises the following steps:
causing the agent to control the Java bytecode manipulation framework ASM to modify the bytecode of the class file so as to embed the monitoring logic code at a predetermined position of the specified line number.
3. The method of claim 1 or 2, wherein the predetermined position of the specified line number is the end of the line of the specified line number.
4. The method of claim 1, wherein monitoring metrics logic is embedded in the class file.
5. The method of claim 4, further comprising:
when the monitored application program is called, acquiring the monitoring index;
and determining the performance and fault information of the java application system according to the monitoring data based on the monitoring index.
6. The method according to claim 1, wherein the starting the Java virtual machine JVM, and the loading agent specifically comprise:
and starting the JVM (Java virtual machine), and loading the agent according to the JVM interface.
7. A monitoring device for a Java application system, wherein a Java virtual machine JVM is deployed on the Java application system, the device comprising:
the starting unit is configured to start the Java virtual machine JVM and load the agent;
the loading unit is configured to load a class file of an application program to be monitored according to a configuration file, wherein the configuration file comprises a class file name and a monitoring logic code to be embedded;
the specified line number determining unit is configured to determine the specified line number of the monitoring logic code to be embedded in the class file;
an embedding unit configured to control the agent to modify the bytecode of the class file to embed the monitoring logic code at a predetermined position of the designated line number;
an execution unit configured to execute the monitoring logic code to obtain monitoring data when the monitored application program is invoked.
8. The apparatus according to claim 7, wherein a Java bytecode manipulation framework (ASM) is deployed on the Java application system;
the embedding unit includes:
an embedding subunit configured to cause the agent to control the Java bytecode manipulation framework ASM to modify the bytecode of the class file to embed the supervisory logic code at a predetermined position of the specified line number.
9. An electronic device comprising a memory and a processor, wherein the memory is configured to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method of any of claims 1-6.
10. A computer-readable storage medium on which computer program instructions are stored, which, when executed by a processor, implement the method of any one of claims 1-6.
CN201910900316.9A 2019-09-23 2019-09-23 Monitoring method and device for Java application system, electronic equipment and storage medium Pending CN111026601A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910900316.9A CN111026601A (en) 2019-09-23 2019-09-23 Monitoring method and device for Java application system, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910900316.9A CN111026601A (en) 2019-09-23 2019-09-23 Monitoring method and device for Java application system, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111026601A true CN111026601A (en) 2020-04-17

Family

ID=70203830

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910900316.9A Pending CN111026601A (en) 2019-09-23 2019-09-23 Monitoring method and device for Java application system, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111026601A (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111625463A (en) * 2020-05-28 2020-09-04 北京达佳互联信息技术有限公司 Program state detection method and device
CN111679984A (en) * 2020-06-08 2020-09-18 中国银行股份有限公司 Performance analysis method and device
CN111797014A (en) * 2020-06-30 2020-10-20 中国工商银行股份有限公司 Cross-application case tracking method and device
CN112100054A (en) * 2020-08-12 2020-12-18 北京大学 Data management and control oriented program static analysis method and system
CN112527638A (en) * 2020-12-01 2021-03-19 北京大米科技有限公司 Program monitoring system, method and computer readable storage medium
CN112860517A (en) * 2021-02-10 2021-05-28 中国工商银行股份有限公司 Performance diagnosis method, device and equipment based on distributed application
CN112988516A (en) * 2021-03-18 2021-06-18 上海新炬网络技术有限公司 Method for realizing global service monitoring based on log enhancement
CN113282495A (en) * 2021-05-27 2021-08-20 东南大学 Java software fault positioning method based on track monitoring
CN113377614A (en) * 2021-06-08 2021-09-10 北京百度网讯科技有限公司 Generation method and device of call chain information, electronic equipment and storage medium
CN113448588A (en) * 2021-07-09 2021-09-28 天津狮拓信息技术有限公司 Data security processing method and device, electronic equipment and storage medium
CN113986736A (en) * 2021-10-29 2022-01-28 重庆富民银行股份有限公司 Slow SQL monitoring system and method based on JAVA proxy and bytecode enhancement

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050028155A1 (en) * 2002-12-02 2005-02-03 Samsung Electronics Co., Ltd. Java execution device and Java execution method
CN102622289A (en) * 2011-01-26 2012-08-01 阿里巴巴集团控股有限公司 Program setting method, program monitoring method, and devices and systems for program setting and monitoring

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050028155A1 (en) * 2002-12-02 2005-02-03 Samsung Electronics Co., Ltd. Java execution device and Java execution method
CN102622289A (en) * 2011-01-26 2012-08-01 阿里巴巴集团控股有限公司 Program setting method, program monitoring method, and devices and systems for program setting and monitoring

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111625463A (en) * 2020-05-28 2020-09-04 北京达佳互联信息技术有限公司 Program state detection method and device
CN111625463B (en) * 2020-05-28 2024-02-13 北京达佳互联信息技术有限公司 Program state detection method and device
CN111679984B (en) * 2020-06-08 2023-09-19 中国银行股份有限公司 Performance analysis method and device
CN111679984A (en) * 2020-06-08 2020-09-18 中国银行股份有限公司 Performance analysis method and device
CN111797014A (en) * 2020-06-30 2020-10-20 中国工商银行股份有限公司 Cross-application case tracking method and device
CN112100054A (en) * 2020-08-12 2020-12-18 北京大学 Data management and control oriented program static analysis method and system
CN112100054B (en) * 2020-08-12 2021-07-20 北京大学 Data management and control oriented program static analysis method and system
CN112527638A (en) * 2020-12-01 2021-03-19 北京大米科技有限公司 Program monitoring system, method and computer readable storage medium
CN112860517A (en) * 2021-02-10 2021-05-28 中国工商银行股份有限公司 Performance diagnosis method, device and equipment based on distributed application
CN112988516A (en) * 2021-03-18 2021-06-18 上海新炬网络技术有限公司 Method for realizing global service monitoring based on log enhancement
CN113282495A (en) * 2021-05-27 2021-08-20 东南大学 Java software fault positioning method based on track monitoring
CN113282495B (en) * 2021-05-27 2024-03-22 东南大学 Java software fault positioning method based on track monitoring
CN113377614B (en) * 2021-06-08 2023-07-25 北京百度网讯科技有限公司 Call chain information generation method and device, electronic equipment and storage medium
CN113377614A (en) * 2021-06-08 2021-09-10 北京百度网讯科技有限公司 Generation method and device of call chain information, electronic equipment and storage medium
CN113448588A (en) * 2021-07-09 2021-09-28 天津狮拓信息技术有限公司 Data security processing method and device, electronic equipment and storage medium
CN113448588B (en) * 2021-07-09 2024-04-16 天津狮拓信息技术有限公司 Data security processing method and device, electronic equipment and storage medium
CN113986736A (en) * 2021-10-29 2022-01-28 重庆富民银行股份有限公司 Slow SQL monitoring system and method based on JAVA proxy and bytecode enhancement

Similar Documents

Publication Publication Date Title
CN111026601A (en) Monitoring method and device for Java application system, electronic equipment and storage medium
US10586053B2 (en) Method for automatically detecting security vulnerability based on hybrid fuzzing, and apparatus thereof
US9940225B2 (en) Automated error checking system for a software application and method therefor
KR101269549B1 (en) System and method for testing software reliability using fault injection
KR100868762B1 (en) Method of error detecting method for embedded sofeware
CN111651366B (en) SDK test method, device, equipment and storage medium
US20110191752A1 (en) Method and System for Debugging of Software on Target Devices
US7900198B2 (en) Method and system for parameter profile compiling
KR101438990B1 (en) System testing method
US8448147B2 (en) Heterogenic Coverage Analysis
CN111382048B (en) Management method and device for mobile equipment on true machine test platform
US7546585B2 (en) Method, system and computer program product for testing computer programs
US11422920B2 (en) Debugging multiple instances of code using thread patterns
CN109255240B (en) Vulnerability processing method and device
US10579513B2 (en) Test run control method and apparatus
CN103186463B (en) Determine the method and system of the test specification of software
US20080127118A1 (en) Method and system for dynamic patching of software
US8533683B2 (en) Stack walking enhancements using sensorpoints
US20080127119A1 (en) Method and system for dynamic debugging of software
JP2010033543A (en) Software operation monitoring system, client computer, server computer thereof, and program thereof
Panigrahi et al. An approach to prioritize the regression test cases of object-oriented programs
CN114297666A (en) Cloud deployment automation vulnerability mining system based on fuzzy test
CN110928777B (en) Test case processing method, device, equipment and storage medium
CN109783284A (en) Information acquisition method, system and server, computer readable storage medium
CN115391228A (en) Precise test method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination