CN109597676A - Monitoring and early warning method, apparatus and storage medium based on JVM - Google Patents
Monitoring and early warning method, apparatus and storage medium based on JVM Download PDFInfo
- Publication number
- CN109597676A CN109597676A CN201811252827.6A CN201811252827A CN109597676A CN 109597676 A CN109597676 A CN 109597676A CN 201811252827 A CN201811252827 A CN 201811252827A CN 109597676 A CN109597676 A CN 109597676A
- Authority
- CN
- China
- Prior art keywords
- early warning
- memory
- program
- jvm
- monitoring
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 70
- 238000012544 monitoring process Methods 0.000 title claims abstract description 69
- 230000008569 process Effects 0.000 claims abstract description 85
- 238000004458 analytical method Methods 0.000 claims abstract description 57
- 230000007246 mechanism Effects 0.000 claims description 24
- 238000003491 array Methods 0.000 claims description 15
- 230000001960 triggered effect Effects 0.000 claims description 14
- 230000009466 transformation Effects 0.000 claims description 10
- 238000013507 mapping Methods 0.000 claims description 5
- 230000002159 abnormal effect Effects 0.000 abstract description 5
- 238000012545 processing Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 239000003795 chemical substances by application Substances 0.000 description 3
- 241000406668 Loxodonta cyclotis Species 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 230000005611 electricity Effects 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 238000010295 mobile communication Methods 0.000 description 2
- 230000002688 persistence Effects 0.000 description 2
- 238000004088 simulation Methods 0.000 description 2
- 238000012360 testing method Methods 0.000 description 2
- 241000219357 Cactaceae Species 0.000 description 1
- 230000005856 abnormality Effects 0.000 description 1
- 239000003990 capacitor Substances 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- YWXYYJSYQOXTPL-SLPGGIOYSA-N isosorbide mononitrate Chemical compound [O-][N+](=O)O[C@@H]1CO[C@@H]2[C@@H](O)CO[C@@H]21 YWXYYJSYQOXTPL-SLPGGIOYSA-N 0.000 description 1
- 230000001314 paroxysmal effect Effects 0.000 description 1
- 238000004064 recycling Methods 0.000 description 1
- 230000008439 repair process Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
- 238000012800 visualization Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3003—Monitoring arrangements specially adapted to the computing system or computing system component being monitored
- G06F11/301—Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is a virtual computing platform, e.g. logically partitioned systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45587—Isolation or security of virtual machine instances
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Software Systems (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Quality & Reliability (AREA)
- Debugging And Monitoring (AREA)
Abstract
The present invention relates to safe practices, disclose a kind of monitoring and early warning method, electronic device and storage medium based on JVM, this method is by receiving program root and process number corresponding to all program process run in JVM.Later, this method is according to described program root and process number, the relevant information of program process in JVM is obtained in real time, further according to the relevant information, early warning analysis is carried out to all program process using preset analysis rule and obtains analysis result, if analysis result meets early-warning conditions, triggers early warning and warning message is shown to user with predetermined manner.Using the present invention, JVM can be monitored, it is automatic to carry out heap dump, quick locating alarming reason when there are abnormal conditions.
Description
Technical field
The present invention relates to field of computer technology more particularly to a kind of monitoring and early warning method, apparatus and calculating based on JVM
Machine readable storage medium storing program for executing.
Background technique
Java Virtual Machine (Java Virtual Machine, JVM) is a kind of for calculating the specification of equipment, it is one
The computer come out is fabricated, is the function of being realized by actual computer come the various program codes of analogue simulation.In emulation mould
In quasi- process, JVM provides memory management and running environment for program code.Currently, existing test environmental monitoring system is only
CPU, memory, IO and the network load that entire physical machine or virtual machine can be monitored, are unable to monitor backstage JVM.Work as analogue simulation
It, can only the use instruction progress of manual entry application server when unusual condition occur in the process causes application server to break down
Monitoring, manual heap dump, but this method efficiency is lower.If be monitored applied host machine using the interface UI, need to shift to an earlier date
It opens firewall and modifies the configuration of server-side, be unfavorable for paroxysmal performance verification.
Summary of the invention
In view of the foregoing, the present invention provides a kind of monitoring and early warning method, apparatus and computer-readable storage based on JVM
Medium, main purpose are quick, timely early warning, reduce loss caused by abnormal conditions.
To achieve the above object, the present invention provides a kind of monitoring and early warning method based on JVM, this method comprises:
Receiving step: program root and process number corresponding to all program process run in JVM are received;
Obtaining step: according to described program root and process number, obtaining the relevant information of program process in JVM in real time,
The relevant information includes memory information and log information;
Analytical procedure: according to the relevant information, early warning is carried out to all program process using preset analysis rule
Analysis obtains analysis result;
Warning step: if analysis result meets early-warning conditions, early warning is triggered, and show and alarm to user with predetermined manner
Information.
Preferably, the memory information include heap area memory information, memory information of new generation, old age for memory information, forever
Long for memory information, the log information includes Garbage Collection Mechanism log information and thread stack log information.
Preferably, the preset analysis rule includes:
Judge whether heap area free memory space is less than preset value, if heap area free memory space is less than preset value, touches
Send out early warning;
If heap area free memory space is greater than or equal to preset value, continue to judge big with the presence or absence of memory accounting in heap area
Early warning is triggered if heap area memory is greater than the object of default accounting value in memory accounting in the object of default accounting value;
If continuing the garbage collection for judging old generation there is no the object that memory accounting is greater than default accounting value in heap area
Whether the frequency of mechanism is greater than predeterminated frequency value, if the frequency of the Garbage Collection Mechanism in old generation is greater than predeterminated frequency value, touches
Send out early warning;
If the frequency of the Garbage Collection Mechanism in old generation is less than or equal to predeterminated frequency value, continue to judge in thread stack
Whether it is greater than preset threshold in the number of the thread of blocked state, if the number of the thread in thread stack in blocked state is greater than
Preset threshold then triggers early warning.
Preferably, the receiving step includes:
According to described program root, using preset transformation rule by described program process and corresponding program root
It is converted to preset format and stores.
Preferably, the preset transformation rule includes:
Described program process and corresponding program root are stored respectively in two different arrays;
The mapping relations of each program process and corresponding program root in two arrays are set;And
Two arrays are subjected to splicing and are converted to preset format.
Preferably, this method further include:
Automatic heap dump parameter is set, and when meeting early-warning conditions, the automatic default early warning reason of heap dump generation that carries out is mentioned
Show that file cocurrent gives user.
In addition, the electronic device includes: memory, processor and display, institute the present invention also provides a kind of electronic device
Storage monitoring and early warning program, the monitoring and early warning program on memory is stated to be executed by the processor, it can be achieved that following steps:
Receiving step: program root and process number corresponding to all program process run in JVM are received;
Obtaining step: according to described program root and process number, obtaining the relevant information of program process in JVM in real time,
The relevant information includes memory information and log information;
Analytical procedure: according to the relevant information, early warning is carried out to all program process using preset analysis rule
Analysis obtains analysis result;
Warning step: if analysis result meets early-warning conditions, early warning is triggered, and show and alarm to user with predetermined manner
Information.
Preferably, the memory information include heap area memory information, memory information of new generation, old age for memory information, forever
Long for memory information, the log information includes Garbage Collection Mechanism log information and thread stack log information.
Preferably, the preset analysis rule includes:
Judge whether heap area free memory space is less than preset value, if heap area free memory space is less than preset value, touches
Send out early warning;
If heap area free memory space is greater than or equal to preset value, continue to judge big with the presence or absence of memory accounting in heap area
Early warning is triggered if heap area memory is greater than the object of default accounting value in memory accounting in the object of default accounting value;
If continuing the garbage collection for judging old generation there is no the object that memory accounting is greater than default accounting value in heap area
Whether the frequency of mechanism is greater than predeterminated frequency value, if the frequency of the Garbage Collection Mechanism in old generation is greater than predeterminated frequency value, touches
Send out early warning;
If the frequency of the Garbage Collection Mechanism in old generation is less than or equal to predeterminated frequency value, continue to judge in thread stack
Whether it is greater than preset threshold in the number of the thread of blocked state, if the number of the thread in thread stack in blocked state is greater than
Preset threshold then triggers early warning.
In addition, to achieve the above object, it is described computer-readable the present invention also provides a kind of computer readable storage medium
It include monitoring and early warning program in storage medium, it can be achieved that being based on as described above when the monitoring and early warning program is executed by processor
Arbitrary steps in the monitoring and early warning method of JVM.
Monitoring and early warning method, apparatus and computer readable storage medium proposed by the present invention based on JVM is connect by basis
The relevant information that the program root and process number received obtains program process in JVM utilizes preset analysis rule pair later
All program process carries out early warning analysis and is analyzed as a result, triggering early warning if analysis result meets condition and to user's exhibition
Show warning information, to solve the problems, such as to be abnormal hand monitor JVM bring inefficiency when situation, improves monitoring and early warning
Timeliness is reduced and is lost caused by unusual condition.
Detailed description of the invention
Fig. 1 is that the present invention is based on the running environment figures of the monitoring early-warning system of JVM;
Fig. 2 is the schematic diagram of electronic device preferred embodiment of the present invention;
Fig. 3 is the module diagram of monitoring and early warning program preferred embodiment in Fig. 2;
Fig. 4 is that the present invention is based on the flow charts of the monitoring and early warning method preferred embodiment of JVM;
Fig. 5 is that the present invention is based on the early warning analysis flow charts of the monitoring and early warning method of JVM.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be appreciated that described herein, specific examples are only used to explain the present invention, is not intended to limit the present invention.
As shown in Figure 1, being the running environment figure of the monitoring early-warning system the present invention is based on JVM.
In the present embodiment, the present invention provides a kind of monitoring early-warning system based on JVM, JVM can be monitored,
When occurring abnormal where quick positioning question, developer is assisted to repair faster.The monitoring early-warning system includes monitoring clothes
Business device (i.e. electronic device 1), application server 2 (JVM comprising backstage) and monitoring data library 3.The electronic device 1 and application
Server 2 distinguish the installation and deployment server-side 21 of monitoring and early warning tool (such as: Nagios, Cacti, Zabbix, Monit) and
Client 22.The client 22 of monitoring and early warning tool is mounted on application server 2 and is used for that is, on monitored destination server
Acquisition crawl to the monitoring data of monitored destination server.The server-side 21 of monitoring and early warning tool is pre- by receiving monitoring
The monitoring data that alert instrument client terminal 21 acquires is analyzed, and early warning is carried out when noting abnormalities, to reach to destination server
Monitoring.The monitoring data library 3 is used for the received monitoring data of storage electronics 1.For example, zabbix monitoring and early warning tool
Including zabbix server and zabbix agent, zabbix agent is mounted on monitored destination server, main complete
The acquisition of pairs of monitoring data, zabbix server is analyzed by receiving the monitoring data that zabbix agent is acquired, right
Destination server remotely monitored, early warning.Wherein, the monitoring data library 3 can in the memory 11 of electronic device 1,
It can also be separated with 1 phase of electronic device.For example, monitoring data library 3 is mutually separated with monitoring server, using special mysql
Server stores monitoring data as monitoring data library 3.
As shown in Fig. 2, being the schematic diagram of 1 preferred embodiment of electronic device of the present invention.
In the present embodiment, the electronic device 1 can be rack-mount server, blade server, tower server or
Cabinet-type server etc. calculates equipment, which can be independent server, be also possible to multiple servers and formed
Server cluster.
The electronic device 1 includes but is not limited to: memory 11, processor 12, display 13 and network interface 14.The electricity
Sub-device 1 connects network by network interface 14, obtains initial data.Wherein, the network can be intranet
(Intranet), internet (Internet), global system for mobile communications (Global System of Mobile
Communication, GSM), wideband code division multiple access (Wideband Code Division Multiple Access,
WCDMA), the wirelessly or non-wirelessly network such as 4G network, 5G network, bluetooth (Bluetooth), Wi-Fi, speech path network.
The memory 11 include at least a type of readable storage medium storing program for executing, the readable storage medium storing program for executing include flash memory,
Hard disk, multimedia card, card-type memory (for example, SD or DX memory etc.), random access storage device (RAM), static random are visited
It asks memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), may be programmed read-only deposit
Reservoir (PROM), magnetic storage, disk, CD etc..In some embodiments, the memory 11 can be the electronics dress
Set 1 internal storage unit, such as the hard disk or memory of the electronic device 1.In further embodiments, the memory 11
It can be the External memory equipment of the electronic device 1, such as the plug-in type hard disk that the electronic device 1 is equipped with, intelligent memory card
(Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash Card) etc..When
So, the memory 11 can also both including the electronic device 1 internal storage unit and also including its External memory equipment.This
In embodiment, the memory 11 is installed on the operating system and types of applications software of the electronic device 1 commonly used in storage,
Such as program code of monitoring and early warning program 10 etc..In addition, the memory 11 can be also used for temporarily storing and export
Or the Various types of data that will be exported.For example, storage program process and program root are converted to the data after preset format.
The processor 12 can be in some embodiments central processing unit (Central Processing Unit,
CPU), controller, microcontroller, microprocessor or other data processing chips.The processor 12 is commonly used in the control electricity
The overall operation of sub-device 1, such as execute data interaction or the relevant control of communication and processing etc..It is described in the present embodiment
Processor 12 is for running the program code stored in the memory 11 or processing data, such as operation monitoring and early warning program
10 program code etc..
The display 13 is properly termed as display screen or display unit.Display 13 can be LED in some embodiments
Display, liquid crystal display, touch-control liquid crystal display and Organic Light Emitting Diode (Organic Light-Emitting
Diode, OLED) touch device etc..Display 13 is for showing the information handled in the electronic apparatus 1 and for showing visualization
Working interface, for example, when meeting early-warning conditions, display alarm information.
Network interface 14 optionally may include standard wireline interface and wireless interface (such as WI-FI interface), which connects
Mouth 14 communicates to connect commonly used in establishing between the electronic device 1 and other electronic equipments.
Fig. 2 is illustrated only with component 11-14 and the electronic device of monitoring and early warning program 10 1, it should be understood that
It is not required for implementing all components shown, the implementation that can be substituted is more or less component.
Optionally, which can also include user interface, and user interface may include input unit such as keyboard
(Keyboard), instantaneous speech power such as sound equipment, earphone etc., optionally user interface can also include that the wired of standard connects
Mouth, wireless interface.
Optionally, which further includes touch sensor.It is touched provided by the touch sensor for user
The region for touching operation is known as touch area.In addition, touch sensor described here can be resistive touch sensor, capacitor
Formula touch sensor etc..Moreover, the touch sensor not only includes the touch sensor of contact, proximity may also comprise
Touch sensor etc..In addition, the touch sensor can be single sensor, or such as multiple biographies of array arrangement
Sensor.User can start monitoring and early warning program 10 by touching the touch area.
It, can also be in addition, the area of the display 13 of the electronic device 1 can be identical as the area of the touch sensor
It is different.Optionally, display 13 and touch sensor stacking are arranged, to form touch display screen.1 base of electronic device
In the touch control operation of touch display screen detecting user's triggering.
The electronic device 1 can also include radio frequency (Radio Frequency, RF) circuit, sensor and voicefrequency circuit etc.
Deng details are not described herein.
As shown in figure 3, being the module diagram of 10 preferred embodiment of monitoring and early warning program in Fig. 2.The so-called mould of the present invention
Block is the series of computation machine program instruction section for referring to complete specific function.
In the present embodiment, monitoring and early warning program 10 include: receiving module 110, obtain module 120, analysis module 130 and
Warning module 140, steps are as follows for the functions or operations that the module 110-140 is realized:
Receiving module 110, for receiving program root and process corresponding to all program process run in JVM
Number.Wherein, described program process refers to the java process run in JVM, and described program root refers to monitored program
The storing directory of file is executed where process.The process number, i.e. PID are a numerical value for unique identification program process.
Specifically, the process number can be instructed by jps and be inquired.For example, input jps order, display currently all programs into
The process number of journey.
Further, the receiving module 110 further include: according to described program root, utilize preset transformation rule
Described program process and corresponding program root are converted to preset format and stored.Wherein, the preset transformation rule
It include: that described program process and corresponding program root are stored respectively in two different arrays, and two arrays are set
In the mapping relations of each program process and corresponding program root, finally, by two arrays carry out splicing be converted to it is default
Format.For example, the program process that will acquire is saved in an array, corresponding program root is saved in another number
Then the two numbers spelling is dressed up the serializing string of json format and is stored in monitoring data library 3 by group.
Module 120 is obtained, for obtaining the phase of program process in JVM in real time according to described program root and process number
Close information.Wherein, the relevant information includes memory information and log information, the memory information include heap area memory information,
Memory information of new generation, old age are for memory information, permanently for memory information.The Cenozoic is mainly used for storing pair newly constructed
As.In the old generation, is mainly used for storing the object still survived after multiple garbage reclamation, and such as storage is returned by 15 rubbish
The object still survived after receipts.In the permanent generation, is mainly used for storing the object of persistence, such as class (class) or metadata
(meta).The memory information includes that memory headroom size (i.e. total memory headroom size) and occupied space size (have used sky
Between size).In the Cenozoic, old generation and permanent generation, are in heap area, and the area Ji Dui occupied space size=Cenozoic occupies
Space size+old age is for occupied space size+permanently for occupied space size.The log information includes Garbage Collection Mechanism
(Garbage Collection, GC) log information and thread stack log information.Wherein, the GC log information includes GC frequency
And GC is time-consuming, the thread stack information includes being in blocked state, i.e. blocked state, thread number and be equivalent to total
The accounting of amount.
Analysis module 130, for according to the relevant information, using preset analysis rule to all program process into
Row early warning analysis obtains analysis result.The preset analysis rule includes:
Judge whether heap area free memory space is less than preset value, if heap area free memory space is less than preset value, touches
Send out early warning.For example, heap area free memory space is less than the 10% of heap area memory headroom, then early warning is triggered.If heap area free memory
Space is greater than or equal to preset value, then continues to judge the object for being greater than default accounting value in heap area with the presence or absence of memory accounting, if
Heap area memory is greater than the object of default accounting value in memory accounting, then triggers early warning.For example, that there are certain in the old generation in heap area is right
The memory headroom of elephant is greater than 50% for memory headroom than old, then triggers early warning.If there is no memory accountings to be greater than in advance in heap area
If the object of accounting value, then continue to judge whether the frequency of the Garbage Collection Mechanism in old generation is greater than predeterminated frequency value, if old
The GC frequency in generation is greater than predeterminated frequency value, then triggers early warning.For example, the GC frequency in old generation is excessively frequent, it is greater than predeterminated frequency
Value, then trigger early warning.If the GC frequency in old generation is less than or equal to predeterminated frequency value, continue to judge to be in thread stack
Whether the number of the thread of blocked state is greater than preset threshold, if the number of the thread in thread stack in blocked state
Greater than preset threshold, then early warning is triggered, if the number of the thread in thread stack in blocked state is less than or equal to default threshold
Value, then process terminates.For example, triggering early warning if 20 threads are in blocked state.It will be appreciated that above-mentioned says
Bright is only a preferred embodiment of analysis rule of the invention, and the judgment step in the analysis rule can also will be preset
Value changes accounting value into.For example, by " judging whether the number of the thread in thread stack in blocked state is greater than preset threshold "
Change into " judge in thread stack in blocked state thread number account for total number of threads ratio whether be greater than it is predetermined
Accounting value ".
Warning module 140 triggers early warning and with predetermined manner to user's exhibition if meeting early-warning conditions for analyzing result
Show warning message.Further, automatic heap dump parameter can also be set, and when meeting early-warning conditions, automatic heap dump is generated
Preset early warning reason prompt file cocurrent gives user.For example, addition-the XX:+ in middleware
HeapDumpOnOutOfMemoryError parameter, when there is OOM automatic heap dump generate heap memory snapshot (Heap Dump,
HD operation, developer), and in a manner of mail are notified, operation, developer can be realized problem according to heap memory snapshot
Quickly positioning.
As shown in figure 4, being the flow chart of the monitoring and early warning method preferred embodiment the present invention is based on JVM.
In the present embodiment, when processor 12 executes the computer program of the monitoring and early warning program 10 stored in memory 11
The monitoring and early warning method based on JVM of realization includes: step S10- step S40.
Step S10, receiving module 110 receive program root corresponding to all program process run in JVM and
Process number.Wherein, described program process refers to the java process run in JVM, and described program root refers to monitored
The storing directory of file is executed where program process.The process number, i.e. PID are one for unique identification program process
Numerical value.Specifically, the process number can be instructed by jps and be inquired.For example, input jps order, shows current all journeys
The process number of sequence process.
Further, the step S10 further include: according to described program root, using preset transformation rule by institute
It states program process and corresponding program root is converted to preset format and stores.Wherein, the preset transformation rule includes:
Described program process and corresponding program root are stored respectively in two different arrays, and are arranged each in two arrays
The mapping relations of program process and corresponding program root, finally, two arrays, which are carried out splicing, is converted to preset format.Example
Such as, the program process that will acquire is saved in an array, and corresponding program root is saved in another array, then will
The two numbers spelling is dressed up the serializing string of json format and is stored in monitoring data library 3.
Step S20 obtains module 120 and obtains program process in JVM in real time according to described program root and process number
Relevant information.Wherein, the relevant information includes memory information and log information, and the memory information includes heap area memory letter
Breath, memory information of new generation, old age are for memory information, permanently for memory information.The Cenozoic is mainly used for storing new building
Object.In the old generation, is mainly used for storing the object still survived after multiple garbage reclamation, and 15 rubbish are passed through in such as storage
The object still survived after rubbish recycling.In the permanent generation, is mainly used for storing the object of persistence, such as class (class) or first number
According to (meta).The memory information includes that memory headroom size (i.e. total memory headroom size) and occupied space size (have been used
Space size).In the Cenozoic, old generation and permanent generation, are in heap area, and the area Ji Dui occupied space size=Cenozoic accounts for
With space size+old age for occupied space size+permanently for occupied space size.The log information includes Garbage Collection Mechanism
(Garbage Collection, GC) log information and thread stack log information.Wherein, the GC log information includes GC frequency
And GC is time-consuming, the thread stack information includes being in blocked state, i.e. blocked state, thread number and be equivalent to total
The accounting of amount.
Step S30, according to the relevant information, analysis module 130 using preset analysis rule to all programs into
Cheng Jinhang early warning analysis obtains analysis result.As shown in figure 5, being the early warning analysis flow chart of the monitoring and early warning method based on JVM.
The preset analysis rule includes:
Judge whether heap area free memory space is less than preset value, if heap area free memory space is less than preset value, touches
Send out early warning.For example, heap area free memory space is less than the 10% of heap area memory headroom, then early warning is triggered.If heap area free memory
Space is greater than or equal to preset value, then continues to judge the object for being greater than default accounting value in heap area with the presence or absence of memory accounting, if
Heap area memory is greater than the object of default accounting value in memory accounting, then triggers early warning.For example, that there are certain in the old generation in heap area is right
The memory headroom of elephant is greater than 50% for memory headroom than old, then triggers early warning.If there is no memory accountings to be greater than in advance in heap area
If the object of accounting value, then continue to judge whether the frequency of the Garbage Collection Mechanism in old generation is greater than predeterminated frequency value, if old
The GC frequency in generation is greater than predeterminated frequency value, then triggers early warning.For example, the GC frequency in old generation is excessively frequent, it is greater than predeterminated frequency
Value, then trigger early warning.If the GC frequency in old generation is less than or equal to predeterminated frequency value, continue to judge to be in thread stack
Whether the number of the thread of blocked state is greater than preset threshold, if the number of the thread in thread stack in blocked state
Greater than preset threshold, then early warning is triggered, if the number of the thread in thread stack in blocked state is less than or equal to default threshold
Value, then process terminates.For example, triggering early warning if 20 threads are in blocked state.It will be appreciated that above-mentioned says
Bright is only a preferred embodiment of analysis rule of the invention, and the judgment step in the analysis rule can also will be preset
Value changes accounting value into.For example, by " judging whether the number of the thread in thread stack in blocked state is greater than preset threshold "
Change into " judge in thread stack in blocked state thread number account for total number of threads ratio whether be greater than it is predetermined
Accounting value ".
Step S40 triggers early warning if analysis result meets early-warning conditions, and warning module 140 is with predetermined manner to user
Show warning message.Further, automatic heap dump parameter can also be set, and when meeting early-warning conditions, automatic heap dump is raw
User is given at preset early warning reason prompt file cocurrent.For example, addition-the XX:+ in middleware
HeapDumpOnOutOfMemoryError parameter, when there is OOM automatic heap dump generate heap memory snapshot (Heap Dump,
HD operation, developer), and in a manner of mail are notified, operation, developer can be realized problem according to heap memory snapshot
Quickly positioning.
The monitoring and early warning method based on JVM that above-described embodiment proposes, by receiving all program process for running on JVM
Corresponding program root and program number obtains the relevant information in program process, utilizes preset point according to relevant information
Analysis rule carries out early warning analysis to all program process, and reach early-warning conditions shows warning message to user, to realize
The automatic monitoring of test system environment, quick positioning question place, avoids the loss as caused by abnormal conditions.
In addition, the embodiment of the present invention also proposes a kind of computer readable storage medium, the computer readable storage medium
In include monitoring and early warning program 10, following operation is realized when the monitoring and early warning program 10 is executed by processor:
Receiving step: program root and process number corresponding to all program process run in JVM are received;
Obtaining step: according to described program root and process number, obtaining the relevant information of program process in JVM in real time,
The relevant information includes memory information and log information;
Analytical procedure: according to the relevant information, early warning is carried out to all program process using preset analysis rule
Analysis obtains analysis result;
Warning step: if analysis result meets early-warning conditions, early warning is triggered, and show and alarm to user with predetermined manner
Information.
Preferably, the memory information include heap area memory information, memory information of new generation, old age for memory information, forever
Long for memory information, the log information includes Garbage Collection Mechanism log information and thread stack log information.
Preferably, the preset analysis rule includes:
Judge whether heap area free memory space is less than preset value, if heap area free memory space is less than preset value, touches
Send out early warning;
If heap area free memory space is greater than or equal to preset value, continue to judge big with the presence or absence of memory accounting in heap area
Early warning is triggered if heap area memory is greater than the object of default accounting value in memory accounting in the object of default accounting value;
If continuing the garbage collection for judging old generation there is no the object that memory accounting is greater than default accounting value in heap area
Whether the frequency of mechanism is greater than predeterminated frequency value, if the frequency of the Garbage Collection Mechanism in old generation is greater than predeterminated frequency value, touches
Send out early warning;
If the frequency of the Garbage Collection Mechanism in old generation is less than or equal to predeterminated frequency value, continue to judge in thread stack
Whether it is greater than preset threshold in the number of the thread of blocked state, if the number of the thread in thread stack in blocked state is greater than
Preset threshold then triggers early warning.
Preferably, the receiving step includes:
According to described program root, using preset transformation rule by described program process and corresponding program root
It is converted to preset format and stores.
Preferably, the preset transformation rule includes:
Described program process and corresponding program root are stored respectively in two different arrays;
The mapping relations of each program process and corresponding program root in two arrays are set;And
Two arrays are subjected to splicing and are converted to preset format.
Preferably, this method further include:
Automatic heap dump parameter is set, and when meeting early-warning conditions, the automatic default early warning reason of heap dump generation that carries out is mentioned
Show that file cocurrent gives user.
The specific embodiment of the computer readable storage medium of the present invention and the above-mentioned monitoring and early warning method based on JVM
Specific embodiment is roughly the same, and details are not described herein.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row
His property includes, so that the process, device, article or the method that include a series of elements not only include those elements, and
And further include other elements that are not explicitly listed, or further include for this process, device, article or method institute it is intrinsic
Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to do
There is also other identical elements in the process, device of element, article or method.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side
Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases
The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art
The part contributed out can be embodied in the form of software products, which is stored in one as described above
In storage medium (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that terminal device (it can be mobile phone,
Computer, server or network equipment etc.) execute method described in each embodiment of the present invention.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field, is included within the scope of the present invention.
Claims (10)
1. a kind of monitoring and early warning method based on JVM is applied to electronic device, which is characterized in that the described method includes:
Receiving step: program root and process number corresponding to all program process run in JVM are received;
Obtaining step: according to described program root and process number, obtaining the relevant information of program process in JVM in real time, described
Relevant information includes memory information and log information;
Analytical procedure: according to the relevant information, early warning analysis is carried out to all program process using preset analysis rule
Obtain analysis result;
Warning step: if analysis result meets early-warning conditions, early warning is triggered, and alarm signal is shown to user with predetermined manner
Breath.
2. the monitoring and early warning method according to claim 1 based on JVM, which is characterized in that the memory information includes heap
Area's memory information, memory information of new generation, old age, the log information included rubbish for memory information, permanently for memory information
Collection mechanism log information and thread stack log information.
3. the monitoring and early warning method according to claim 1 or 2 based on JVM, which is characterized in that the preset analysis rule
Then include:
Judge whether heap area free memory space is less than preset value, if heap area free memory space is less than preset value, triggering is pre-
It is alert;
If heap area free memory space is greater than or equal to preset value, continue to judge to be greater than in advance in heap area with the presence or absence of memory accounting
If the object of accounting value, if heap area memory is greater than the object of default accounting value in memory accounting, early warning is triggered;
If continuing the Garbage Collection Mechanism for judging old generation there is no the object that memory accounting is greater than default accounting value in heap area
Frequency whether be greater than predeterminated frequency value, if the frequency of the Garbage Collection Mechanism in old generation is greater than predeterminated frequency value, triggering is pre-
It is alert;
If the frequency of the Garbage Collection Mechanism in old generation is less than or equal to predeterminated frequency value, continue to judge in thread stack in stifled
Whether the number of the thread of plug-like state is greater than preset threshold, presets if the number of the thread in thread stack in blocked state is greater than
Threshold value then triggers early warning.
4. the monitoring and early warning method according to claim 1 based on JVM, which is characterized in that the receiving step includes:
According to described program root, described program process and corresponding program root are converted using preset transformation rule
At preset format and store.
5. the monitoring and early warning method according to claim 4 based on JVM, which is characterized in that the preset transformation rule
Include:
Described program process and corresponding program root are stored respectively in two different arrays;
The mapping relations of each program process and corresponding program root in two arrays are set;And
Two arrays are subjected to splicing and are converted to preset format.
6. the monitoring and early warning method according to claim 1 based on JVM, which is characterized in that this method further include:
Automatic heap dump parameter is set, it is automatic to carry out the default early warning reason prompt text of heap dump generation when meeting early-warning conditions
Part is simultaneously sent to user.
7. a kind of electronic device, which is characterized in that the electronic device includes: memory, processor and display, the storage
Monitoring and early warning program is stored on device, the monitoring and early warning program is executed by the processor, it can be achieved that following steps:
Receiving step: program root and process number corresponding to all program process run in JVM are received;
Obtaining step: according to described program root and process number, obtaining the relevant information of program process in JVM in real time, described
Relevant information includes memory information and log information;
Analytical procedure: according to the relevant information, early warning analysis is carried out to all program process using preset analysis rule
Obtain analysis result;
Warning step: if analysis result meets early-warning conditions, early warning is triggered, and alarm signal is shown to user with predetermined manner
Breath.
8. electronic device according to claim 7, which is characterized in that the memory information includes heap area memory information, new
For memory information, old age for memory information, permanently for memory information, the log information includes Garbage Collection Mechanism log letter for life
Breath and thread stack log information.
9. electronic device according to claim 7 or 8, which is characterized in that the preset analysis rule includes:
Judge whether heap area free memory space is less than preset value, if heap area free memory space is less than preset value, triggering is pre-
It is alert;
If heap area free memory space is greater than or equal to preset value, continue to judge to be greater than in advance in heap area with the presence or absence of memory accounting
If the object of accounting value, if heap area memory is greater than the object of default accounting value in memory accounting, early warning is triggered;
If continuing the Garbage Collection Mechanism for judging old generation there is no the object that memory accounting is greater than default accounting value in heap area
Frequency whether be greater than predeterminated frequency value, if the frequency of the Garbage Collection Mechanism in old generation is greater than predeterminated frequency value, triggering is pre-
It is alert;
If the frequency of the Garbage Collection Mechanism in old generation is less than or equal to predeterminated frequency value, continue to judge in thread stack in stifled
Whether the number of the thread of plug-like state is greater than preset threshold, presets if the number of the thread in thread stack in blocked state is greater than
Threshold value then triggers early warning.
10. a kind of computer readable storage medium, which is characterized in that include monitoring and early warning in the computer readable storage medium
Program, it can be achieved that based on JVM as described in any one of claims 1 to 6 when the monitoring and early warning program is executed by processor
The step of monitoring and early warning method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811252827.6A CN109597676A (en) | 2018-10-25 | 2018-10-25 | Monitoring and early warning method, apparatus and storage medium based on JVM |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811252827.6A CN109597676A (en) | 2018-10-25 | 2018-10-25 | Monitoring and early warning method, apparatus and storage medium based on JVM |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109597676A true CN109597676A (en) | 2019-04-09 |
Family
ID=65957537
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811252827.6A Pending CN109597676A (en) | 2018-10-25 | 2018-10-25 | Monitoring and early warning method, apparatus and storage medium based on JVM |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109597676A (en) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110784352A (en) * | 2019-10-30 | 2020-02-11 | 国网山东省电力公司信息通信公司 | A method and device for data synchronization monitoring and alarming based on Oracle Goldengate |
CN111162965A (en) * | 2019-12-17 | 2020-05-15 | 杭州迪普科技股份有限公司 | Method and device for monitoring Buffer |
CN111414253A (en) * | 2020-03-19 | 2020-07-14 | 北京奇艺世纪科技有限公司 | Garbage collection GC information processing method, Java virtual machine and computer storage medium |
CN111782471A (en) * | 2020-06-30 | 2020-10-16 | 中国工商银行股份有限公司 | Method and system for monitoring memory overflow of JVM (JAVA virtual machine) of cloud system JAVA container |
CN111831467A (en) * | 2020-07-21 | 2020-10-27 | 北京思特奇信息技术股份有限公司 | Method, system and electronic equipment for java process memory overflow self-fusing |
CN111949490A (en) * | 2020-08-14 | 2020-11-17 | 中国工商银行股份有限公司 | JVM process monitoring method and device |
CN111427667B (en) * | 2020-04-03 | 2021-03-26 | 帆软软件有限公司 | JVM load quantification and optimization method |
CN112948223A (en) * | 2019-11-26 | 2021-06-11 | 北京沃东天骏信息技术有限公司 | Method and device for monitoring operation condition |
CN113778609A (en) * | 2020-06-22 | 2021-12-10 | 北京沃东天骏信息技术有限公司 | Information monitoring method, device and equipment for heap memory and storage medium |
CN114281483A (en) * | 2021-12-28 | 2022-04-05 | 中国电信股份有限公司 | Memory area tuning method and device, storage medium and processor |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5432932A (en) * | 1992-10-23 | 1995-07-11 | International Business Machines Corporation | System and method for dynamically controlling remote processes from a performance monitor |
CN102521099A (en) * | 2011-11-24 | 2012-06-27 | 深圳市同洲视讯传媒有限公司 | Process monitoring method and process monitoring system |
CN104346255A (en) * | 2014-10-21 | 2015-02-11 | 浪潮集团有限公司 | Method for automatically monitoring service conditions of process memories in cloud computation |
CN104503891A (en) * | 2014-12-10 | 2015-04-08 | 北京京东尚科信息技术有限公司 | Method and device for online monitoring JVM (Java Virtual Machine) thread |
CN107766123A (en) * | 2017-10-11 | 2018-03-06 | 郑州云海信息技术有限公司 | A JVM Tuning Method |
CN107797901A (en) * | 2017-10-25 | 2018-03-13 | 四川长虹电器股份有限公司 | A kind of storehouse analysis and the implementation method of mail Realtime Alerts |
CN107861797A (en) * | 2017-12-04 | 2018-03-30 | 北京奇艺世纪科技有限公司 | A kind of method for early warning and device based on JVM |
-
2018
- 2018-10-25 CN CN201811252827.6A patent/CN109597676A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5432932A (en) * | 1992-10-23 | 1995-07-11 | International Business Machines Corporation | System and method for dynamically controlling remote processes from a performance monitor |
CN102521099A (en) * | 2011-11-24 | 2012-06-27 | 深圳市同洲视讯传媒有限公司 | Process monitoring method and process monitoring system |
CN104346255A (en) * | 2014-10-21 | 2015-02-11 | 浪潮集团有限公司 | Method for automatically monitoring service conditions of process memories in cloud computation |
CN104503891A (en) * | 2014-12-10 | 2015-04-08 | 北京京东尚科信息技术有限公司 | Method and device for online monitoring JVM (Java Virtual Machine) thread |
CN107766123A (en) * | 2017-10-11 | 2018-03-06 | 郑州云海信息技术有限公司 | A JVM Tuning Method |
CN107797901A (en) * | 2017-10-25 | 2018-03-13 | 四川长虹电器股份有限公司 | A kind of storehouse analysis and the implementation method of mail Realtime Alerts |
CN107861797A (en) * | 2017-12-04 | 2018-03-30 | 北京奇艺世纪科技有限公司 | A kind of method for early warning and device based on JVM |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110784352A (en) * | 2019-10-30 | 2020-02-11 | 国网山东省电力公司信息通信公司 | A method and device for data synchronization monitoring and alarming based on Oracle Goldengate |
CN110784352B (en) * | 2019-10-30 | 2022-04-01 | 国网山东省电力公司信息通信公司 | Data synchronous monitoring and alarming method and device based on Oracle golden gate |
CN112948223A (en) * | 2019-11-26 | 2021-06-11 | 北京沃东天骏信息技术有限公司 | Method and device for monitoring operation condition |
CN111162965A (en) * | 2019-12-17 | 2020-05-15 | 杭州迪普科技股份有限公司 | Method and device for monitoring Buffer |
CN111414253A (en) * | 2020-03-19 | 2020-07-14 | 北京奇艺世纪科技有限公司 | Garbage collection GC information processing method, Java virtual machine and computer storage medium |
CN111427667B (en) * | 2020-04-03 | 2021-03-26 | 帆软软件有限公司 | JVM load quantification and optimization method |
CN113778609A (en) * | 2020-06-22 | 2021-12-10 | 北京沃东天骏信息技术有限公司 | Information monitoring method, device and equipment for heap memory and storage medium |
CN111782471A (en) * | 2020-06-30 | 2020-10-16 | 中国工商银行股份有限公司 | Method and system for monitoring memory overflow of JVM (JAVA virtual machine) of cloud system JAVA container |
CN111782471B (en) * | 2020-06-30 | 2023-10-13 | 中国工商银行股份有限公司 | Monitoring method and system for cloud system JAVA container JVM memory overflow |
CN111831467A (en) * | 2020-07-21 | 2020-10-27 | 北京思特奇信息技术股份有限公司 | Method, system and electronic equipment for java process memory overflow self-fusing |
CN111949490A (en) * | 2020-08-14 | 2020-11-17 | 中国工商银行股份有限公司 | JVM process monitoring method and device |
CN111949490B (en) * | 2020-08-14 | 2024-04-19 | 中国工商银行股份有限公司 | JVM process monitoring method and device |
CN114281483A (en) * | 2021-12-28 | 2022-04-05 | 中国电信股份有限公司 | Memory area tuning method and device, storage medium and processor |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109597676A (en) | Monitoring and early warning method, apparatus and storage medium based on JVM | |
CN110908879B (en) | Reporting method, reporting device, reporting terminal and recording medium of buried point data | |
CN112491602B (en) | Behavior data monitoring method and device, computer equipment and medium | |
CN108874624B (en) | Server, method for monitoring Java process and storage medium | |
CN113326209B (en) | Hierarchical segmentation monitoring and intervention method for large-scale parallel test task | |
CN101206569A (en) | Method, system and program product for dynamically identifying components contributing to service degradation | |
CN112149329A (en) | State rehearsal method, system, equipment and storage medium of key equipment of nuclear power plant | |
CN107273145A (en) | A kind of method of managing software and device, terminal | |
CN112506757A (en) | Automatic test method, system, computer device and medium thereof | |
CN102112940A (en) | Method and apparatus for monitoring performance of power delivery control system | |
EP2933726B1 (en) | Apparatus, system and method for application log data processing | |
CN111459692A (en) | Method, apparatus and computer program product for predicting drive failure | |
CN109358934A (en) | A kind of application program page jump method and system | |
CN103095821A (en) | Continuous auditing system based on virtual machine migration recognition | |
CN111680104A (en) | Data synchronization method and device, computer equipment and readable storage medium | |
CN114595987A (en) | Multi-device centralized management method, device, system, electronic device and storage medium | |
CN110069925A (en) | Software monitors method, system and computer readable storage medium | |
CN109783284A (en) | Information acquisition method, system and server, computer readable storage medium | |
CN112558982B (en) | Code detection method and device and computer equipment | |
CN116541261B (en) | Resource management method and system based on cloud resource monitoring | |
CN111737082A (en) | Container and monitoring method, device, equipment and medium for container application | |
CN114257491B (en) | Virtualization system VR alarm processing method, device, equipment, storage medium | |
CN113656044B (en) | Android installation package compression method and device, computer equipment and storage medium | |
CN111061795B (en) | Data processing method and device, intelligent terminal and storage medium | |
US20090193429A1 (en) | Method to identify unique host applications running within a storage controller |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190409 |
|
RJ01 | Rejection of invention patent application after publication |