CN108874624B - Server, method for monitoring Java process and storage medium - Google Patents

Server, method for monitoring Java process and storage medium Download PDF

Info

Publication number
CN108874624B
CN108874624B CN201810550030.8A CN201810550030A CN108874624B CN 108874624 B CN108874624 B CN 108874624B CN 201810550030 A CN201810550030 A CN 201810550030A CN 108874624 B CN108874624 B CN 108874624B
Authority
CN
China
Prior art keywords
java
information
java process
virtual machine
server
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.)
Active
Application number
CN201810550030.8A
Other languages
Chinese (zh)
Other versions
CN108874624A (en
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.)
Kangjian Information Technology Shenzhen Co Ltd
Original Assignee
Kangjian Information Technology Shenzhen 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 Kangjian Information Technology Shenzhen Co Ltd filed Critical Kangjian Information Technology Shenzhen Co Ltd
Priority to CN201810550030.8A priority Critical patent/CN108874624B/en
Publication of CN108874624A publication Critical patent/CN108874624A/en
Application granted granted Critical
Publication of CN108874624B publication Critical patent/CN108874624B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Abstract

The invention relates to a server, a method for monitoring Java process and a storage medium, wherein the method comprises the following steps: after an agent program deployed in a server registers in the server, when a monitoring starting instruction is received, acquiring a current Java process list of the server by using a preset command based on the instruction; filtering each Java process in the Java process list to obtain an active Java process obtained after filtering in the Java process list; and collecting load information and virtual machine information corresponding to each active Java process based on a plurality of preset commands in the shell script of the Linux, and sorting and reporting the load information and the virtual machine information of each active Java process according to a process number corresponding to each active Java process in the Java process list. The invention can realize the monitoring of the running state of the non-invasive Java program, does not need to embed monitoring codes, does not expose redundant interfaces and reduces the risk of being invaded.

Description

Server, method for monitoring Java process and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a server, a method for monitoring Java processes, and a storage medium.
Background
At present, a Java process is monitored when a performance pressure test is carried out on a server, and the monitoring of the traditional Java process has two modes, wherein the first mode is to embed a monitoring code in the Java process for monitoring; and the second method is that the remote monitoring port RMI is opened in the Java program to be monitored for monitoring. The first mode not only destroys the integrity of the tested program, but also increases the risk of being invaded; in the second mode, because the monitoring port RMI is opened, the performance of the tested code is greatly influenced, and the port is exposed, so that the risk of intrusion is increased. No matter which mode is adopted, the difference between the Java program to be tested and the real running environment is too large, and the test cannot reflect the real situation.
Disclosure of Invention
The invention aims to provide a server, a method for monitoring Java processes and a storage medium, and aims to realize the monitoring of the running state of a non-intrusive Java program.
In order to achieve the above object, the present invention provides a server, which includes a memory and a processor connected to the memory, wherein the memory stores a processing system capable of running on the processor, and when the processing system is executed by the processor, the following steps are implemented:
after an agent program deployed in a server registers in the server, when a monitoring starting instruction is received, acquiring a current Java process list of the server based on the monitoring starting instruction by using a preset command;
filtering each Java process in the Java process list based on a preset filtering rule, and acquiring an active Java process obtained after filtering in the Java process list;
the method comprises the steps that load information and virtual machine information corresponding to each active Java process are collected based on a plurality of preset commands in a shell script of Linux, the load information and the virtual machine information of each active Java process are sorted according to a process number corresponding to each active Java process in a Java process list and reported to a controller, the controller collects the load information and the virtual machine information as a main key according to an IP address and a process number of a server, and the load information and the virtual machine information are stored in a database for performance pressure measurement.
Preferably, the step of filtering each Java process in the Java process list based on a preset filtering rule to obtain an active Java process obtained after filtering in the Java process list specifically includes:
acquiring the process name of each Java process in the Java process list, and performing first filtering on each process name based on a preset key character so as to filter the non-service related Java processes to obtain service related Java processes;
analyzing whether the Java process related to each service is the Java process used in the pressure measurement process or not, and analyzing whether the Java process related to each service is the Java process in a silent state or not;
and if the Java process related to the service is a Java process which is not used in the pressure measurement process and the Java process related to the service is a Java process in a silent state, performing secondary filtering to filter the Java process which is not used in the pressure measurement process and is in the silent state to obtain an active Java process.
Preferably, the load information includes CPU usage information, memory usage information, network traffic information, and disk read-write information, the virtual machine information includes old-generation memory garbage collection information, young-generation memory garbage collection information, and thread abnormal state information, and when the processing system is executed by the processor, the following steps are also implemented:
and generating capacity planning information based on the current load information and the virtual machine information, and displaying or sending the capacity planning information to a preset terminal.
Preferably, the processing system, when executed by the processor, further performs the steps of: and generating a monitoring chart corresponding to each current load information and virtual machine information, analyzing whether each current load information and virtual machine information has an abnormal condition, and performing alarm processing when the load information or the virtual machine information has the abnormal condition.
In order to achieve the above object, the present invention further provides a method for monitoring a Java process, where the method for monitoring a Java process includes:
s1, after an agent program deployed in a server registers to the server, when a monitoring starting instruction is received, acquiring a current Java process list of the server based on the monitoring starting instruction by using a preset command;
s2, filtering each Java process in the Java process list based on a preset filtering rule, and acquiring an active Java process obtained after filtering in the Java process list;
and S3, collecting load information and virtual machine information corresponding to each active Java process based on a plurality of preset commands in the shell script of the Linux, sorting the load information and the virtual machine information of each active Java process according to the process number corresponding to each active Java process in the Java process list, reporting the load information and the virtual machine information to a controller, summarizing the load information and the virtual machine information by using the controller as a main key according to the IP address and the process number of the server, and storing the load information and the virtual machine information in a database for performance pressure test.
Preferably, the step S2 specifically includes:
acquiring the process name of each Java process in the Java process list, and performing first filtering on each process name based on a preset key character so as to filter the non-service related Java process and obtain the service related Java process;
analyzing whether the Java process related to each service is the Java process used in the pressure measurement process or not, and analyzing whether the Java process related to each service is the Java process in a silent state or not;
and if the Java process related to the service is a Java process which is not used in the pressure measurement process and the Java process related to the service is a Java process in a silent state, performing secondary filtering to filter the Java process which is not used in the pressure measurement process and is in the silent state to obtain an active Java process.
Preferably, the load information includes CPU usage information, memory usage information, network traffic information, and disk read-write information, and the virtual machine information includes old memory garbage collection information, young memory garbage collection information, and thread abnormal state information, and the method further includes:
and generating capacity planning information based on the current load information and the virtual machine information, and displaying or sending the capacity planning information to a preset terminal.
Preferably, the method further comprises:
and generating a monitoring chart corresponding to each current load information and virtual machine information, analyzing whether each current load information and virtual machine information are in an abnormal condition, and performing alarm processing when load information or virtual machine information is in an abnormal condition.
Preferably, the predetermined command for collecting the load information includes a dstat command, an iostat command, and a free command, and the command for collecting the virtual machine information includes a jstat command and a jstack command.
The present invention also provides a computer readable storage medium having stored thereon a processing system, which when executed by a processor implements the steps of the above-described method of monitoring a Java process.
The invention has the beneficial effects that: according to the method and the system, the agent program is deployed in the server to be tested, the agent program is used for monitoring the Java processes, the Java processes in the Java process list are filtered to obtain the active Java processes, the load information and the virtual machine information of the active Java processes are collected, the collected load information and the virtual machine information are collected, sorted and reported, the non-invasive Java program running state is monitored, monitoring codes do not need to be embedded, the Java process data can be monitored without changing the codes and the running environment of the system to be tested, meanwhile, redundant interfaces are not exposed, and the risk of invasion is reduced.
Drawings
FIG. 1 is a diagram illustrating a hardware architecture of a server according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a first embodiment of a method for monitoring a Java process according to the present invention;
FIG. 3 is a flowchart illustrating a second embodiment of a method for monitoring a Java process according to the present invention;
FIG. 4 is a flowchart illustrating a method for monitoring a Java process according to a third embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
It should be noted that the description relating to "first", "second", etc. in the present invention is for descriptive purposes only and is not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present invention.
Fig. 1 is a schematic diagram of a hardware architecture of a server according to an embodiment of the present invention. The server 1 is a device capable of automatically performing numerical calculation and/or information processing in accordance with a command set in advance or stored. The server 1 may be a computer, or a single network server, a server group composed of a plurality of network servers, or a cloud composed of a large number of hosts or network servers based on cloud computing, where the cloud computing is one of distributed computing, and is a super virtual computer composed of a group of loosely coupled computers.
In the present embodiment, the server 1 may include, but is not limited to, a memory 11, a processor 12, and a network interface 13, which may be communicatively connected to each other through a system bus, wherein the memory 11 stores a processing system operable on the processor 12. It is noted that fig. 1 only shows the server 1 with components 11-13, but it is to be understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead.
The storage 11 includes a memory and at least one type of readable storage medium. The memory provides cache for the operation of the server 1; the readable storage medium may be a non-volatile storage medium such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the readable storage medium may be an internal storage unit of the server 1, such as a hard disk of the server 1; in other embodiments, the non-volatile storage medium may be an external storage device of the server 1, such as a plug-in hard disk provided on the server 1, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like. In this embodiment, the readable storage medium of the memory 11 is generally used for storing an operating system installed in the server 1 and various types of application software, for example, program codes (i.e., agent programs) of a processing system in an embodiment of the present invention. Further, the memory 11 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 12 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 12 is generally used for controlling the overall operation of the server 1, such as performing control and processing related to data interaction or communication with other devices. In this embodiment, the processor 12 is configured to run the program code stored in the memory 11 or process data, for example, run a processing system.
The network interface 13 may comprise a wireless network interface or a wired network interface, and the network interface 13 is generally used for establishing communication connection between the server 1 and other electronic devices.
The processing system is stored in the memory 11 and includes at least one computer-readable instruction (i.e., an agent deployed on a server) stored in the memory 11, the at least one computer-readable instruction being executable by the processor 12 to implement the methods of the embodiments of the present application; and the at least one computer readable instruction may be divided into different logic modules depending on the functions implemented by the respective portions.
In one embodiment, the processing system when executed by the processor 12 implements the steps of:
after an agent program deployed in a server registers in the server, when a monitoring starting instruction is received, acquiring a current Java process list of the server based on the monitoring starting instruction and by using a preset command;
the agent program is deployed on a server needing monitoring, the agent program can be registered on the server by using the RPC communication function of the agent program when being started, and after a monitoring starting instruction is received, a Java process list running on the server can be obtained based on a jss command carried by a Java language software development kit JDK. The Java process list includes the process number PID of each Java process and the process name of the Java process.
Filtering each Java process in the Java process list based on a preset filtering rule, and acquiring an active Java process obtained after filtering in the Java process list;
since only the active Java process needs to be monitored, the active Java process is obtained by filtering the Java process in this embodiment, and processes other than the active Java process do not need to be monitored.
In a preferred embodiment, filtering each Java process in the Java process list based on a preset filtering rule to obtain an active Java process obtained after filtering in the Java process list includes:
acquiring the process name of each Java process in the Java process list, and performing first filtering on each process name based on a preset key character so as to filter the non-service related Java process and obtain the service related Java process; analyzing whether the Java process related to each service is the Java process used in the pressure measurement process or not, and analyzing whether the Java process related to each service is the Java process in a silent state or not; and if the Java process related to the service is a Java process which is not used in the pressure measurement process and the Java process related to the service is a Java process in a silent state, performing secondary filtering to filter the Java process which is not used in the pressure measurement process and is in the silent state to obtain an active Java process.
The predetermined key characters are, for example, service, main, manager, etc., and the process names are first filtered through the key characters to filter the non-Service-related Java processes, for example, some Java processes including the key character Service do not belong to a Java process, such as: monitoring processes, middleware and the like, and filtering the processes, the middleware and the like to obtain the Java processes related to the service finally.
Because part of Java processes can not be called during pressure measurement, and some Java processes are in a silent state and do not need to be monitored, whether the Java processes related to each service are the Java processes used in the pressure measurement process or not is analyzed, whether the Java processes related to each service are the Java processes in the silent state or not is analyzed, and if the Java processes are the Java processes which are not used in the pressure measurement process and are in the silent state, secondary filtering is performed so as to filter the Java processes which are not used and are in the silent state, and active Java processes are obtained.
The method comprises the steps that load information and virtual machine information corresponding to each active Java process are collected based on a plurality of preset commands in a shell script of Linux, the load information and the virtual machine information of each active Java process are sorted according to a process number corresponding to each active Java process in a Java process list and reported to a controller, the controller collects the load information and the virtual machine information as a main key according to an IP address and a process number of a server, and the load information and the virtual machine information are stored in a database.
The preset command for collecting the load information comprises a dstat command, an iostat command and a free command: the dstat command is used for acquiring the use conditions of cpu, disk, network, IO, memory and the like; the iostat command can check the use condition of a CPU, network card information, the use condition of a disk and the like; the free command can display the number of unused and used memories of the current system and can also display the memory buffer area used by the kernel; the commands for collecting the virtual machine information comprise a jstat command and a jstack command: a jstat command (a virtual machine statistical information monitoring tool) for monitoring the resource and performance of a Java application program in real time by using an instruction built in a JAVA virtual machine, wherein the command comprises monitoring the memory and garbage collection condition of the Heap size virtual machine; the jstack command is used to print out a given Java process ID or core file or Java stack information of a remote debugging service, etc.
In this embodiment, the load information includes CPU usage information (percentage of usage, CPU wait, CPU load), memory usage information (usage, remaining amount, virtual memory swap space), network traffic information (transmission amount, reception amount), and disk read-write information (write speed, read speed), and the virtual machine information includes old memory garbage collection information, young memory garbage collection information, and thread abnormal state information.
After collecting load information and virtual machine information, arranging the load information and the virtual machine information of each active Java process according to the process number corresponding to each active Java process in the Java process list and reporting the load information and the virtual machine information to a controller, uniformly collecting and arranging the load information and the virtual machine information by using the controller as a main key according to the IP address and the process number of the server, and storing the load information and the virtual machine information in a database for performance pressure test.
Compared with the prior art, the agent program is deployed in the server to be tested, the agent program is used for monitoring the plurality of Java processes, the Java processes in the Java process list are filtered to obtain the active Java processes, the load information and the virtual machine information of the plurality of active Java processes are collected, the collected load information and the collected virtual machine information are collected, sorted and reported, the running state of the non-invasive Java program is monitored, monitoring codes do not need to be embedded, the data of the Java processes can be monitored without changing the codes and the running environment of the system to be tested, meanwhile, redundant interfaces are not exposed, and the risk of being invaded is reduced.
In a preferred embodiment, on the basis of the above embodiment, when the processing system is executed by the processor, the following steps are further implemented: and generating capacity planning information based on the current load information and the virtual machine information, and displaying or sending the capacity planning information to a preset terminal.
In this embodiment, capacity planning information is generated based on current load information and virtual machine information: according to the collected load information and virtual machine information, automatically calculating the number of files written into the hard disk, the number of CPU consumed, whether the memory is enough and the like when the server is under the pressure; when the pressure exceeds a certain threshold, the response time of the system is slowed, the capacity expansion of server resources is needed, and the like; subtracting the maximum and minimum values of the hard disk usage to obtain the growth amount of the period, and dividing the growth amount by the test duration to obtain the growth rate of the hard disk usage and the like; in the case of the reference line, it is possible to obtain: what the disk growth amount per day of the online server is when the system pressure is kept current; when the number of transactions processed per second reaches a certain point, the number of cpus of the server needs to be expanded, and the like. And finally, displaying the capacity planning information or sending the capacity planning information to a preset terminal for reference of a tester.
In a preferred embodiment, on the basis of the above embodiment, when the processing system is executed by the processor, the following steps are further implemented: and generating a monitoring chart corresponding to each current load information and virtual machine information, analyzing whether each current load information and virtual machine information has an abnormal condition, and performing alarm processing when the load information or the virtual machine information has the abnormal condition.
The monitoring chart corresponding to each item of current load information and virtual machine information can be generated, for example, the monitoring chart is converted into a graphical form, such as a graph, and data can be displayed more intuitively.
When an abnormal condition is found, automatic alarm is given, for example, the utilization rate of a CPU is too high, an OS uses an SWAP memory, the amount of data written into a hard disk is too large, the network flow exceeds a threshold value, a large number of Blocked states occur in Java threads, and the like.
Specifically, an upper limit value of each monitored information can be preset, the problem location and the system performance can be determined and optimized through the expandability and performance of the metric system under the performance pressure, and the system can be better configured through acquiring the bearing limit of each monitored information. For example, for a server, setting the CPU utilization rate to be 80%, the memory consumption to be 85%, the disk utilization rate to be 50%, and the like, when the CPU utilization rate reaches 80%, or the memory consumption reaches 85%, or the disk utilization rate reaches 50%, analyzing whether an abnormal condition occurs at present due to the CPU utilization rate, the memory consumption, or the disk utilization rate, and if no abnormal condition occurs, further adjusting the upper limit values of the state information, for example, adjusting the CPU utilization rate to be 85%, the memory consumption to be 90%, the disk utilization rate to be 60%, and the like, and taking the adjusted upper limit values as a performance bottleneck value for giving an early warning when the performance bottleneck value is reached next time; if the abnormal condition occurs, the upper limit values of the state information can be further adjusted downwards, for example, the CPU utilization rate is adjusted to be 75%, the memory consumption is 80%, the disk utilization rate is 45%, and the like, and the adjusted upper limit value is used as a performance bottleneck value for giving an early warning when the performance bottleneck value is reached next time.
As shown in fig. 2, fig. 2 is a schematic flowchart of an embodiment of a method for monitoring a Java process according to the present invention, where the method for monitoring a Java process includes the following steps:
step S1, after an agent program deployed in a server registers to the server, when a monitoring starting instruction is received, acquiring a current Java process list of the server based on the monitoring starting instruction and by using a preset command;
the agent program is deployed on a server needing monitoring, the agent program can be registered on the server by using the RPC communication function of the agent program when being started, and after a monitoring starting instruction is received, a Java process list running on the server can be obtained based on a jss command carried by a Java language software development kit JDK. The Java process list includes the process number PID of each Java process and the process name of the Java process.
S2, filtering each Java process in the Java process list based on a preset filtering rule, and acquiring an active Java process obtained after filtering in the Java process list;
since only the active Java process needs to be monitored, the active Java process is obtained by filtering the Java process in the present embodiment, and processes other than the active Java process do not need to be monitored.
In a preferred embodiment, filtering each Java process in the Java process list based on a preset filtering rule, and acquiring an active Java process obtained after filtering in the Java process list, includes:
acquiring the process name of each Java process in the Java process list, and performing first filtering on each process name based on a preset key character so as to filter the non-service related Java processes to obtain service related Java processes; analyzing whether the Java process related to each service is the Java process used in the pressure measurement process or not, and analyzing whether the Java process related to each service is the Java process in a silent state or not; and if the Java process related to the service is a Java process which is not used in the pressure measurement process and the Java process related to the service is a Java process in a silent state, performing secondary filtering to filter the Java process which is not used in the pressure measurement process and is in the silent state to obtain an active Java process.
The predetermined key characters are, for example, service, main, manager, etc., and the process names are first filtered through the key characters to filter the non-Service-related Java processes, for example, some Java processes including the key character Service do not belong to a Java process, such as: monitoring processes, middleware and the like, and filtering the processes, the middleware and the like to obtain the Java processes related to the service finally.
Because part of Java processes can not be called during the pressure measurement, and some Java processes are in a silent state and do not need to be monitored, whether the Java processes related to each service are the Java processes used in the pressure measurement process or not is analyzed, whether the Java processes related to each service are the Java processes in the silent state or not is analyzed, if the Java processes not used in the pressure measurement process and the Java processes in the silent state are the Java processes in the pressure measurement process, secondary filtering is carried out, so that the Java processes not used and in the silent state are filtered, and active Java processes are obtained.
And S3, acquiring load information and virtual machine information corresponding to each active Java process based on a plurality of preset commands in the shell script of Linux, sorting the load information and the virtual machine information of each active Java process according to the process number corresponding to each active Java process in the Java process list, reporting the load information and the virtual machine information to a controller, summarizing the load information and the virtual machine information by using the controller as a main key according to the IP address and the process number of the server, and storing the load information and the virtual machine information in a database for performance pressure measurement.
The preset command for collecting the load information comprises a dstat command, an iostat command and a free command: the dstat command is used for acquiring the use conditions of cpu, disk, network, IO, memory and the like; the iostat command can check the use condition of a CPU, network card information, the use condition of a disk and the like; the free command can display the number of unused and used memories of the current system and can also display a memory buffer used by the kernel; the commands for collecting the virtual machine information comprise a jstat command and a jstack command: a jstat command (a virtual machine statistical information monitoring tool) is used for monitoring the resources and the performance of a Java application program in real time by using instructions built in a JAVA virtual machine, and comprises monitoring the memory and the garbage recycling condition of the Heap size virtual machine; the jstack command is used to print out a given Java process ID or core file or Java stack information of a remote debugging service, etc.
In this embodiment, the load information includes CPU usage information (percentage of usage, CPU wait, CPU load), memory usage information (usage, remaining amount, virtual memory swap space), network traffic information (transmission amount, reception amount), and disk read/write information (write speed, read speed), and the virtual machine information includes old memory garbage collection information, young memory garbage collection information, and thread exception status information.
After the load information and the virtual machine information are collected, the load information and the virtual machine information of each active Java process are sorted according to the process number corresponding to each active Java process in the Java process list and reported to a controller, the controller is used for performing unified gathering and sorting by taking the IP address and the process number of the server as main keys, and the load information and the virtual machine information are gathered and stored in a database.
Compared with the prior art, the agent program is deployed in the server to be tested, the agent program is used for monitoring the plurality of Java processes, the Java processes in the Java process list are filtered to obtain the active Java processes, the load information and the virtual machine information of the plurality of active Java processes are collected, the collected load information and the collected virtual machine information are collected, sorted and reported, the running state of the non-invasive Java program is monitored, monitoring codes do not need to be embedded, the data of the Java processes can be monitored without changing the codes and the running environment of the system to be tested, meanwhile, redundant interfaces are not exposed, and the risk of being invaded is reduced.
In a preferred embodiment, on the basis of the above embodiment, as shown in fig. 3, the method further includes: and S4, generating capacity planning information based on the current load information and the virtual machine information, and displaying or sending the capacity planning information to a preset terminal.
In this embodiment, capacity planning information is generated based on current various pieces of load information and virtual machine information: according to the collected load information and virtual machine information, automatically calculating the number of files written into the hard disk, the number of CPU consumed, whether the memory is enough and the like when the server is under the pressure; when the pressure exceeds a certain threshold, the response time of the system is slowed, the capacity expansion of server resources is needed, and the like; subtracting the maximum value and the minimum value of the hard disk usage amount to obtain the growth amount of the period, and dividing the growth amount by the test duration to obtain the growth rate of the hard disk usage amount and the like; in the case of the reference line, it is possible to obtain: what the disk growth amount per day of the online server is when the system pressure is kept current; when the number of transactions processed per second reaches a certain point, the number of cpus of the server needs to be expanded, and the like. And finally, displaying the capacity planning information or sending the capacity planning information to a preset terminal for reference of a tester.
In a preferred embodiment, on the basis of the above embodiment, as shown in fig. 4, the method further includes: and S5, generating a monitoring chart corresponding to each piece of current load information and virtual machine information, analyzing whether each piece of current load information and virtual machine information is in an abnormal condition, and performing alarm processing when load information or virtual machine information is in an abnormal condition.
The monitoring chart corresponding to each item of current load information and virtual machine information can be generated, for example, the monitoring chart is converted into a graphical form, such as a graph, and data can be displayed more intuitively.
When an abnormal condition is found, automatic alarm is given, for example, the utilization rate of a CPU is too high, an OS uses an SWAP memory, the amount of data written into a hard disk is too large, the network flow exceeds a threshold value, a large number of Blocked states occur in Java threads, and the like.
Specifically, an upper limit value of each monitored information can be preset, the problem location and the system performance can be determined and optimized through the expandability and performance of the metric system under the performance pressure, and the system can be better configured through acquiring the bearing limit of each monitored information. For example, for a server, setting the CPU utilization rate to be 80%, the memory consumption to be 85%, the disk utilization rate to be 50%, and the like, when the CPU utilization rate reaches 80%, or the memory consumption to reach 85%, or the disk utilization rate to reach 50%, analyzing whether an abnormal condition occurs at present due to the CPU utilization rate, the memory consumption, or the disk utilization rate, and if no abnormal condition occurs, further adjusting the upper limit values of the state information, for example, adjusting the CPU utilization rate to be 85%, the memory consumption to be 90%, the disk utilization rate to be 60%, and the like, and using the adjusted upper limit values as performance bottleneck values for giving an early warning when the performance bottleneck values are reached next time; if the abnormal condition occurs, the upper limit values of the state information can be further adjusted downwards, for example, the CPU utilization rate is adjusted to be 75%, the memory consumption is 80%, the disk utilization rate is 45%, and the like, and the adjusted upper limit value is used as a performance bottleneck value for giving an early warning when the performance bottleneck value is reached next time.
The present invention also provides a computer readable storage medium having stored thereon a processing system, which when executed by a processor, performs the steps of the above method of monitoring a Java process.
The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages and disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A server, comprising a memory and a processor coupled to the memory, the memory having stored therein a processing system operable on the processor, the processing system when executed by the processor performing the steps of:
after an agent program deployed in a server registers in the server, when a monitoring starting instruction is received, acquiring a current Java process list of the server based on the monitoring starting instruction by using a preset command;
filtering each Java process in the Java process list based on a preset filtering rule, and acquiring an active Java process obtained after filtering in the Java process list;
the method comprises the steps that load information and virtual machine information corresponding to each active Java process are collected based on a plurality of preset commands in a shell script of Linux, the load information and the virtual machine information of each active Java process are sorted according to process numbers corresponding to the active Java processes in a Java process list and reported to a controller, the controller collects the load information and the virtual machine information as main keys according to an IP address and the process numbers of a server, and the load information and the virtual machine information are stored in a database for performance pressure testing.
2. The server according to claim 1, wherein the step of filtering each Java process in the Java process list based on a preset filtering rule to obtain an active Java process obtained after filtering in the Java process list specifically includes:
acquiring the process name of each Java process in the Java process list, and performing first filtering on each process name based on a preset key character so as to filter the non-service related Java process and obtain the service related Java process;
analyzing whether the Java process related to each service is the Java process used in the pressure measurement process or not, and analyzing whether the Java process related to each service is the Java process in a silent state or not;
and if the Java process related to the service is a Java process which is not used in the pressure measurement process and the Java process related to the service is a Java process in a silent state, performing secondary filtering to filter the Java process which is not used in the pressure measurement process and is in the silent state to obtain an active Java process.
3. The server according to claim 1 or 2, wherein the load information includes CPU usage information, memory usage information, network traffic information, and disk read-write information, the virtual machine information includes older memory garbage collection information, younger memory garbage collection information, and thread exception status information, and when the processing system is executed by the processor, the following steps are further implemented:
and generating capacity planning information based on the current load information and the virtual machine information, and displaying or sending the capacity planning information to a preset terminal.
4. The server of claim 3, wherein the processing system, when executed by the processor, further performs the steps of: and generating a monitoring chart corresponding to each current load information and virtual machine information, analyzing whether each current load information and virtual machine information has an abnormal condition, and performing alarm processing when the load information or the virtual machine information has the abnormal condition.
5. A method for monitoring a Java process, the method comprising:
s1, after an agent program deployed in a server registers to the server, when a monitoring starting instruction is received, acquiring a current Java process list of the server based on the monitoring starting instruction by using a preset command;
s2, filtering each Java process in the Java process list based on a preset filtering rule, and acquiring an active Java process obtained after filtering in the Java process list;
and S3, acquiring load information and virtual machine information corresponding to each active Java process based on a plurality of preset commands in the shell script of Linux, sorting the load information and the virtual machine information of each active Java process according to a process number corresponding to each active Java process in the Java process list, reporting the load information and the virtual machine information to a controller, summarizing the load information and the virtual machine information by using the controller as a main key according to the IP address and the process number of the server, and storing the load information and the virtual machine information in a database for performance pressure measurement.
6. The method for monitoring a Java process according to claim 5, wherein the step S2 specifically includes:
acquiring the process name of each Java process in the Java process list, and performing first filtering on each process name based on a preset key character so as to filter the non-service related Java processes to obtain service related Java processes;
analyzing whether the Java process related to each service is the Java process used in the pressure measurement process or not, and analyzing whether the Java process related to each service is the Java process in a silent state or not;
and if the Java process related to the service is a Java process which is not used in the pressure measurement process and the Java process related to the service is a Java process in a silent state, performing secondary filtering to filter the Java process which is not used in the pressure measurement process and is in the silent state to obtain an active Java process.
7. The method for monitoring the Java process according to claim 5 or 6, wherein the load information comprises CPU usage information, memory usage information, network traffic information and disk read-write information, the virtual machine information comprises older memory garbage collection information, younger memory garbage collection information and thread exception status information, the method further comprising:
and generating capacity planning information based on the current load information and virtual machine information, and displaying or sending the capacity planning information to a preset terminal.
8. A method for monitoring Java processes as recited in claim 7, further comprising:
and generating a monitoring chart corresponding to each current load information and virtual machine information, analyzing whether each current load information and virtual machine information has an abnormal condition, and performing alarm processing when the load information or the virtual machine information has the abnormal condition.
9. The method of monitoring a Java process according to claim 7, wherein the predetermined command to collect load information includes a dstat command, an iostat command, and a free command, and the command to collect virtual machine information includes a jstat command and a jstack command.
10. A computer readable storage medium, having stored thereon a processing system which, when executed by a processor, carries out the steps of the method of monitoring a Java process as claimed in any of claims 5 to 9.
CN201810550030.8A 2018-05-31 2018-05-31 Server, method for monitoring Java process and storage medium Active CN108874624B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810550030.8A CN108874624B (en) 2018-05-31 2018-05-31 Server, method for monitoring Java process and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810550030.8A CN108874624B (en) 2018-05-31 2018-05-31 Server, method for monitoring Java process and storage medium

Publications (2)

Publication Number Publication Date
CN108874624A CN108874624A (en) 2018-11-23
CN108874624B true CN108874624B (en) 2023-03-28

Family

ID=64335163

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810550030.8A Active CN108874624B (en) 2018-05-31 2018-05-31 Server, method for monitoring Java process and storage medium

Country Status (1)

Country Link
CN (1) CN108874624B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109840179B (en) * 2018-12-15 2023-04-11 中国平安人寿保险股份有限公司 RocktMQ thread number monitoring method and device, electronic equipment and storage medium
CN109800124B (en) * 2018-12-15 2023-04-11 中国平安人寿保险股份有限公司 CPU utilization monitoring method and device, electronic equipment and storage medium
CN109828885B (en) * 2018-12-15 2023-02-07 中国平安人寿保险股份有限公司 RocketMQ memory monitoring method and device, electronic equipment and storage medium
CN109726078B (en) * 2018-12-28 2022-12-06 广东亿迅科技有限公司 Method and device for non-invasive JVM thread stack acquisition
CN109726082A (en) * 2019-01-03 2019-05-07 中国银行股份有限公司 A kind of early-warning processing method and system
CN109918305A (en) * 2019-03-07 2019-06-21 北京奇艺世纪科技有限公司 A kind of online service monitoring system and method
CN110990173A (en) * 2019-12-18 2020-04-10 北京三快在线科技有限公司 Method, device, equipment and storage medium for calling service
CN111355795B (en) * 2020-02-26 2023-03-21 北京思特奇信息技术股份有限公司 Method, system, medium and device for remotely acquiring Linux host data
CN111625428A (en) * 2020-04-20 2020-09-04 中国建设银行股份有限公司 Method, system, device and storage medium for monitoring running state of Java application program
CN111625463B (en) * 2020-05-28 2024-02-13 北京达佳互联信息技术有限公司 Program state detection method and device
CN112486765B (en) * 2020-11-25 2022-11-11 山东中创软件商用中间件股份有限公司 Java application interface management method, system and device and computer readable storage medium
CN112948127B (en) * 2021-03-30 2023-11-10 北京滴普科技有限公司 Cloud platform container average load monitoring method, terminal equipment and readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6457142B1 (en) * 1999-10-29 2002-09-24 Lucent Technologies Inc. Method and apparatus for target application program supervision
CN103440161A (en) * 2013-08-15 2013-12-11 北京京东尚科信息技术有限公司 Java virtual machine internal object monitoring method, device and system
CN106776212A (en) * 2016-12-09 2017-05-31 中电科华云信息技术有限公司 The supervisory systems and method of container clustered deploy(ment) multi-process application

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6457142B1 (en) * 1999-10-29 2002-09-24 Lucent Technologies Inc. Method and apparatus for target application program supervision
CN103440161A (en) * 2013-08-15 2013-12-11 北京京东尚科信息技术有限公司 Java virtual machine internal object monitoring method, device and system
CN106776212A (en) * 2016-12-09 2017-05-31 中电科华云信息技术有限公司 The supervisory systems and method of container clustered deploy(ment) multi-process application

Also Published As

Publication number Publication date
CN108874624A (en) 2018-11-23

Similar Documents

Publication Publication Date Title
CN108874624B (en) Server, method for monitoring Java process and storage medium
US9274798B2 (en) Multi-threaded logging
EP2324406B1 (en) Method and apparatus for monitoring the performance of a power delivery control system
EP3591485B1 (en) Method and device for monitoring for equipment failure
WO2023115999A1 (en) Device state monitoring method, apparatus, and device, and computer-readable storage medium
CN104077328B (en) The operation diagnostic method and equipment of MapReduce distributed system
CN110457907B (en) Firmware program detection method and device
CN109933504B (en) Hard disk delay test method, device, terminal and storage medium
US11860718B2 (en) Register reading method and apparatus, device, and medium
CN110290190A (en) A kind of method, monitored device and monitoring server acquiring data
CN106021054A (en) Method and apparatus for testing upgrading and downgrading stability of BMC
CN112214388A (en) Memory monitoring method, device, equipment and computer readable storage medium
CN115407943A (en) Memory dump file generation method, device and equipment and readable storage medium
CN114546590B (en) Java virtual machine heap memory set object monitoring method and memory overflow analysis method
CN112202628A (en) WiFi module serial port protocol automatic test system and method
CN116340053A (en) Log processing method, device, computer equipment and medium for system crash
CN103778024A (en) Server system and message processing method thereof
CN108427634A (en) Electronic device, the method for test and computer readable storage medium
CN109359092B (en) File management method, desktop display method, device, terminal and medium
CN113568878A (en) Method and device for collecting and exporting system logs and vehicle
CN110221932A (en) Computer and its control method
US8312433B2 (en) Operating system aided code coverage
CN109992476A (en) A kind of analysis method of log, server and storage medium
CN114722927A (en) Collapse clustering method and device, electronic equipment and storage medium
CN114741218A (en) Method, device, equipment, system and medium for extracting abnormal index of operating system

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
GR01 Patent grant
GR01 Patent grant