Monitoring and early warning method and device, equipment and storage medium

By monitoring the running status of the thread pool and extracting relevant information, the warning messages of the thread pool are automatically determined, which solves the problem of cumbersome acquisition of thread pool warning information in the existing technology, and improves the acquisition efficiency and stability.

CN119557167APending Publication Date: 2025-03-04PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411764486.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

In the prior art, the acquisition process of early warning information of thread pools is cumbersome, and it consumes a lot of manpower and time, resulting in inefficient acquisition.

Method used

By obtaining the target task and submitting it to the thread pool, monitoring the running status of the thread pool, sampling and monitoring data, extracting lock information, call stack information, task completion time and CPU usage, and determining the warning message of the thread pool based on this information.

Benefits of technology

There is no need to manually obtain early warning information, which reduces the time to obtain early warning information, improves the acquisition efficiency, and improves the stability of early warning messages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119557167A_ABST
    Figure CN119557167A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of big data, can be applied to the field of financial science and technology, and discloses a monitoring and early warning method, device and equipment and a storage medium, and the method comprises the steps: obtaining a target task, and submitting the target task to a thread pool of a system; executing the target task through the thread of the thread pool; in the execution period of the target task, obtaining monitoring data of the thread pool; sampling the monitoring data of the thread pool to obtain a log file of the monitoring data; performing information extraction on the log file to obtain lock information, call stack information, task completion time and CPU utilization rate in the thread pool; and determining an early warning message of the thread pool based on the lock information, the call stack information, the task completion time and the CPU utilization rate. According to the invention, the acquisition efficiency of the early warning information is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of big data technology and can be applied to the field of financial technology. In particular, the present invention relates to monitoring and early warning methods, devices, equipment and storage media. Background Art

[0002] In today's context of rapid development of informatization, thread pool early warning information is particularly important, because thread pool early warning information can not only reveal potential risk points in advance, but also provide clues and basis for solving problems.

[0003] However, the existing technology mainly adopts manual acquisition method to obtain the warning information of the thread pool, and the manual acquisition method consumes a lot of human resources and time resources, and increases the acquisition time of the warning information of the thread pool. Therefore, the acquisition process of the warning information of the existing thread pool is cumbersome, which is not conducive to improving the efficiency of obtaining the warning information. Summary of the invention

[0004] The present invention provides a monitoring and early warning method, device, computer equipment and storage medium to solve the technical problem that the acquisition process of early warning information of the existing thread pool is cumbersome and is not conducive to improving the efficiency of obtaining the early warning information.

[0005] In a first aspect, a monitoring and early warning method is provided, comprising:

[0006] Obtain a target task, and submit the target task to a thread pool of the system;

[0007] Execute the target task through the threads of the thread pool;

[0008] During the execution of the target task, obtaining monitoring data of the thread pool;

[0009] Sampling the monitoring data of the thread pool to obtain a log file of the monitoring data;

[0010] Extract information from the log file to obtain lock information, call stack information, task completion time and CPU usage rate in the thread pool;

[0011] Based on the lock information, the call stack information, the task completion time and the CPU usage rate, a warning message of the thread pool is determined.

[0012] Furthermore, executing the target task through the thread of the thread pool includes:

[0013] Obtain the current state of the thread of the thread pool, and determine whether the current state is an idle state;

[0014] When the current state is the idle state, the target task is executed by the thread.

[0015] Furthermore, during the execution of the target task, obtaining monitoring data of the thread pool includes:

[0016] During the execution of the target task, reading the monitoring instruction according to the preset path;

[0017] By executing the monitoring instruction, the thread pool is monitored to obtain monitoring data of the thread pool.

[0018] Furthermore, the sampling of the monitoring data of the thread pool to obtain a log file of the monitoring data includes:

[0019] Read the sampling frequency in the preset file;

[0020] During the execution of the target task, the monitoring data of the thread pool is sampled according to the sampling frequency to obtain the sampled data, and the sampled data is recorded to obtain a log file of the monitoring data.

[0021] Furthermore, the extracting of information from the log file to obtain lock information, call stack information, task completion time and CPU usage in the thread pool includes:

[0022] Obtaining text data in the log file;

[0023] Information is extracted from the text data to obtain lock information, call stack information, task completion time and CPU usage in the thread pool.

[0024] Further, determining the warning message of the thread pool based on the lock information, the call stack information, the task completion time and the CPU usage rate includes:

[0025] Detect whether there is a deadlock in the lock information, detect whether the current execution time of each function in the call stack information exceeds the preset execution time, detect whether the task completion time exceeds the preset completion time, and detect whether the CPU usage rate is greater than the preset usage rate;

[0026] When the lock information is deadlocked, a first warning instruction is generated for the target task; when the current execution time exceeds the preset execution time, a second warning instruction is generated; when the task completion time exceeds the preset completion time, a third warning instruction is generated; when the CPU usage rate is greater than the preset usage rate, a fourth warning instruction is generated; the first warning instruction, the second warning instruction, the third warning instruction, and the fourth warning instruction constitute a warning message of the thread pool.

[0027] Further, after determining the warning message of the thread pool based on the lock information, the call stack information, the task completion time and the CPU usage rate, the monitoring and warning method includes:

[0028] Obtain a rollback algorithm corresponding to the warning message, and use the rollback algorithm to roll back the running state of the thread pool to a target state.

[0029] In a second aspect, a monitoring and early warning device is provided, comprising:

[0030] A first acquisition module is used to acquire a target task and submit the target task to a thread pool of the system;

[0031] An execution module, used for executing the target task through the threads of the thread pool;

[0032] A second acquisition module, used for acquiring monitoring data of the thread pool during the execution of the target task;

[0033] A third acquisition module is used to sample the monitoring data of the thread pool to obtain a log file of the monitoring data;

[0034] An extraction module is used to extract information from the log file to obtain lock information, call stack information, task completion time and CPU usage rate in the thread pool;

[0035] An early warning module is used to determine an early warning message of the thread pool based on the lock information, the call stack information, the task completion time and the CPU usage rate.

[0036] In a third aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned monitoring and early warning method when executing the computer program.

[0037] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned monitoring and early warning method are implemented.

[0038] The present application provides a monitoring and early warning method, apparatus, computer equipment and storage medium, which obtain a target task and submit the target task to a thread pool of a system; execute the target task through the thread pool thread; obtain monitoring data of the thread pool during the execution of the target task; sample the monitoring data of the thread pool to obtain a log file of the monitoring data; extract information from the log file to obtain lock information, call stack information, task completion time and CPU usage rate in the thread pool; determine an early warning message of the thread pool based on the lock information, the call stack information, the task completion time and the CPU usage rate, and the beneficial effects are in two aspects. On the one hand, the early warning message of the thread pool is determined based on the lock information, the call stack information, the task completion time and the CPU usage rate. Since manual acquisition is not required, the acquisition time of the early warning information is reduced, which is beneficial to improving the acquisition efficiency of the early warning information; on the other hand, it will not be affected by manual operation, which is beneficial to improving the stability of the acquired early warning message of the thread pool. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0040] Figure 1 This is a schematic diagram of an application environment of a monitoring and early warning method in one embodiment of the present invention;

[0041] Figure 2 A schematic diagram of a flow chart of a monitoring and early warning method provided by an embodiment of the present invention;

[0042] Figure 3 yes Figure 1 A schematic flow chart of a specific implementation of step S23;

[0043] Figure 4 yes Figure 1 A schematic flow chart of a specific implementation of step S25;

[0044] Figure 5 yes Figure 1 A schematic flow chart of a specific implementation of step S26;

[0045] Figure 6 It is a structural schematic diagram of a monitoring and early warning device in one embodiment of the present invention;

[0046] Figure 7is a schematic diagram of a structure of a computer device in one embodiment of the present invention;

[0047] Figure 8 It is another structural schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION

[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0049] See also Figure 1 , Figure 1 FIG. 1 is a schematic diagram of an application environment of a monitoring and early warning method according to an embodiment of the present invention. The monitoring and early warning method provided by the embodiment of the present invention can be applied in the following embodiments: Figure 1 In an application environment, a client communicates with a server through a network.

[0050] The server obtains the target task through the client and submits the target task to the thread pool of the system;

[0051] Execute the target task through the threads of the thread pool;

[0052] During the execution of the target task, obtaining monitoring data of the thread pool;

[0053] Sampling the monitoring data of the thread pool to obtain a log file of the monitoring data;

[0054] Extract information from the log file to obtain lock information, call stack information, task completion time and CPU usage rate in the thread pool;

[0055] Based on the lock information, the call stack information, the task completion time and the CPU usage rate, a warning message of the thread pool is determined.

[0056] In the scheme implemented by the above-mentioned monitoring and early warning method, device, equipment and medium, the beneficial effects lie in two aspects. On the one hand, based on the lock information, the call stack information, the task completion time and the CPU usage rate, the early warning message of the thread pool is determined. Since manual acquisition is not required, the acquisition time of the early warning information is reduced, which is conducive to improving the efficiency of acquiring the early warning information. On the other hand, it will not be affected by manual operation, so it is conducive to improving the stability of the acquired early warning message of the thread pool.

[0057] The device running the client is referred to as a client device.

[0058] The device running the server is referred to as the server device.

[0059] The client devices may include but are not limited to various personal computers, laptops, smart phones, tablet computers, and portable wearable devices.

[0060] The server device can be implemented by an independent server or a server cluster composed of multiple servers. The present invention is described in detail below through specific embodiments.

[0061] See also Figure 2 , Figure 2 A flowchart of a monitoring and early warning method provided by an embodiment of the present invention includes the following steps:

[0062] S21, obtaining a target task, and submitting the target task to a thread pool of the system;

[0063] Exemplarily, obtaining a target task and submitting the target task to a thread pool of a system includes:

[0064] Connect to the target platform, obtain the target task to be executed by the target platform, and submit the target task to the thread pool through the submission interface.

[0065] Among them, the target platform includes but is not limited to financial platform, technology platform, and insurance platform.

[0066] Among them, financial platforms refer to online or physical platforms that integrate a variety of financial services and products, usually operated by financial institutions, technology companies or third-party service providers. These financial platforms provide a unified interface and process, allowing users to easily obtain financial services such as loans, investments, payments, and insurance.

[0067] Among them, the technology platform refers to a comprehensive service platform that integrates advanced technology, innovative resources and professional services to promote scientific and technological innovation, achievement transformation and industrial upgrading. These platforms promote the sharing and optimal allocation of scientific and technological resources by providing an open, collaborative and efficient innovation environment.

[0068] Among them, the insurance platform is an online platform that integrates insurance product sales, consulting, claims and other services, usually operated by insurance companies. Logically, the insurance platform lowers the threshold for purchasing insurance products by providing convenient and efficient online services, allowing users to obtain insurance information anytime and anywhere, compare different products, and complete online insurance and claims.

[0069] S22, executing the target task through the thread of the thread pool;

[0070] The step of executing the target task through the thread of the thread pool includes:

[0071] Obtain the current state of the thread of the thread pool, and determine whether the current state is an idle state;

[0072] When the current state is the idle state, the target task is executed by the thread.

[0073] Among them, when the current state is the idle state, it means that the thread is in a state of waiting or preparing to accept a target task, and the thread pool assigns the target task to the thread in the idle state for execution, thereby improving the timeliness of processing the target task.

[0074] S23, during the execution of the target task, obtaining monitoring data of the thread pool;

[0075] The execution period of the target task refers to the entire process from the task being started to the task being completed and the result being returned.

[0076] S24, sampling the monitoring data of the thread pool to obtain a log file of the monitoring data;

[0077] The step of sampling the monitoring data of the thread pool to obtain a log file of the monitoring data includes:

[0078] Read the sampling frequency in the preset file;

[0079] During the execution of the target task, the monitoring data of the thread pool is sampled according to the sampling frequency to obtain the sampled data, and the sampled data is recorded to obtain a log file of the monitoring data.

[0080] The monitoring data log files are files that record various sampled data generated by the system during a specific monitoring period. These files usually contain rich information about system performance, resource usage, user behavior, abnormal events, etc., and are recorded in timestamp order. The log files can trace the running status of the thread pool over the past period of time.

[0081] S25, extracting information from the log file to obtain lock information, call stack information, task completion time, and CPU usage rate in the thread pool;

[0082] The lock information includes the lock holder, the thread queue waiting for the lock, the lock type, the lock acquisition time and the lock release time.

[0083] Among them, lock information is conducive to efficient resource management and task scheduling of the thread pool. The thread pool can dynamically adjust the number of threads and task allocation according to the lock status to avoid problems such as thread starvation, deadlock and resource waste. In addition, when the thread pool encounters performance bottlenecks or exceptions, lock information can also serve as an important basis for troubleshooting, helping developers quickly locate the problem and take corresponding optimization measures.

[0084] The call stack information refers to the function call sequence recorded when each thread in the thread pool executes a task. The call stack information shows in detail the hierarchy of all function calls from the program entry point to the current execution position.

[0085] By analyzing the call stack information, users can track the execution path of threads, understand how threads collaborate with each other, and how tasks are allocated and executed. This helps to quickly locate problems such as deadlocks, resource competition, and performance bottlenecks, thereby improving system stability and efficiency.

[0086] The task completion time refers to the total time from when the thread pool receives a task to when the task is executed and the result is returned.

[0087] Among them, task completion time is crucial for evaluating the performance of the thread pool, optimizing task scheduling strategies, and ensuring that the system meets specific response time requirements. By analyzing the task completion time of the thread pool, users can understand the thread pool's ability to handle tasks and identify bottlenecks that may cause task delays, such as thread switching overhead, resource competition, or dependencies between tasks. This information is helpful for adjusting the size of the thread pool, optimizing the granularity of tasks, and improving the task allocation algorithm, thereby ensuring that the thread pool can efficiently handle a large number of concurrent tasks and meet users' expectations for response speed and service quality.

[0088] The CPU usage rate refers to the ratio of the CPU resources occupied by the thread pool during task execution to the total CPU resources.

[0089] Among them, the CPU usage reflects the occupation of CPU resources by the thread pool when executing tasks. Too high may lead to slower system response and increased task delays, while too low means that resources are not fully utilized and there is waste. Therefore, by reasonably adjusting the number of threads in the thread pool, the size of the task queue and the task scheduling strategy, the CPU usage can be kept within the preset range. This can ensure that tasks are processed in a timely manner and avoid the additional overhead caused by resource competition and context switching, thereby achieving efficient utilization of the thread pool and optimizing system performance.

[0090] S26, determining a warning message of the thread pool based on the lock information, the call stack information, the task completion time and the CPU usage rate.

[0091] Among them, the warning message of the thread pool is determined, and the warning message allows the user to take measures to intervene and repair the problem before it causes serious consequences. This process can continuously and efficiently process the target task without performance fluctuations caused by frequent thread creation and destruction. This is especially important for big data processing, because big data tasks usually need to run for a long time, and a stable thread pool can better utilize resources, which is conducive to improving the overall throughput, so that the target task of big data can be completed faster.

[0092] Wherein, after determining the warning message of the thread pool based on the lock information, the call stack information, the task completion time and the CPU usage rate, the monitoring and warning method includes:

[0093] Obtain a rollback algorithm corresponding to the warning message, and use the rollback algorithm to roll back the running state of the thread pool to a target state.

[0094] Among them, multiple preset algorithms are displayed, and the preset algorithm selected by the user is selected as the fallback algorithm corresponding to the early warning message, and the fallback algorithm corresponding to the early warning message is used to roll back the running state of the thread pool to the target state.

[0095] Among them, the number of threads in the thread pool is dynamically reduced through the back-off algorithm, which can reduce resource utilization, avoid performance degradation caused by excessive resource consumption, and help enhance performance stability.

[0096] In the embodiment of the present invention, the beneficial effects lie in two aspects. On the one hand, based on the lock information, the call stack information, the task completion time and the CPU usage rate, the warning message of the thread pool is determined. Since manual acquisition is not required, the acquisition time of the warning information is reduced, which is beneficial to improving the efficiency of obtaining the warning information. On the other hand, it will not be affected by manual operations, so it is beneficial to improve the stability of the obtained warning message of the thread pool.

[0097] See also Figure 3 , Figure 3 yes Figure 1 A specific implementation flow diagram of step S23 is described in detail as follows:

[0098] S31, during the execution of the target task, reading a monitoring instruction according to a preset path;

[0099] S32, monitoring the thread pool by executing the monitoring instruction to obtain monitoring data of the thread pool.

[0100] In the embodiment of the present invention, by executing the monitoring instruction, monitoring the thread pool, and obtaining the monitoring data of the thread pool, the user can quickly obtain the current running status of the system. This real-time performance ensures that the user can find abnormalities or potential problems in the first place, thereby avoiding system crashes, and thus is conducive to improving the operation and maintenance efficiency and performance stability of the system.

[0101] See also Figure 4 , Figure 4 yes Figure 1 A specific implementation flow diagram of step S25 is described in detail as follows:

[0102] S41, obtaining text data in the log file;

[0103] S42, extracting information from the text data to obtain lock information, call stack information, task completion time and CPU usage rate in the thread pool.

[0104] Exemplarily, information is extracted from the text data to obtain lock information, call stack information, task completion time, and CPU usage in the thread pool, including:

[0105] Obtaining a first extraction instruction, a second extraction instruction, a third extraction instruction, and a fourth extraction instruction;

[0106] By means of a first extraction instruction, information is extracted from the text data to obtain lock information in the thread pool;

[0107] By means of a second extraction instruction, information is extracted from the text data to obtain call stack information in the thread pool;

[0108] By means of a third extraction instruction, information is extracted from the text data to obtain the task completion time in the call stack information;

[0109] Information is extracted from the text data through the fourth extraction instruction to obtain the task completion time in the call stack information.

[0110] The first extraction instruction, the second extraction instruction, the third extraction instruction and the fourth extraction instruction are different extraction instructions.

[0111] In the embodiment of the present invention, the lock information, call stack information, task completion time and CPU usage in the thread pool are used to help users better understand and optimize the performance of the thread pool and improve the resource utilization of the thread pool.

[0112] See also Figure 5 , Figure 5 yes Figure 1 A specific implementation flow diagram of step S26 is described in detail as follows:

[0113] S51, detecting whether there is a deadlock in the lock information, detecting whether the current execution time of each function in the call stack information exceeds the preset execution time, detecting whether the task completion time exceeds the preset completion time, and detecting whether the CPU usage rate is greater than the preset usage rate;

[0114] S52, when the lock information is deadlocked, a first warning instruction is generated for the target task; when the current execution time exceeds the preset execution time, a second warning instruction is generated; when the task completion time exceeds the preset completion time, a third warning instruction is generated; when the CPU usage rate is greater than the preset usage rate, a fourth warning instruction is generated; the first warning instruction, the second warning instruction, the third warning instruction, and the fourth warning instruction constitute a warning message for the thread pool.

[0115] Among them, by obtaining early warning messages from the thread pool, potential performance bottlenecks or failure points can be discovered in a timely manner, allowing the system to take corresponding corrective measures, such as reallocating resources and adjusting task priorities. This mechanism ensures the efficient and stable operation of tasks and improves the reliability and availability of the entire system.

[0116] In an embodiment of the present invention, when a deadlock exists in the lock information, a first warning instruction of the target task is generated; when the current execution time exceeds the preset execution time, a second warning instruction is generated; when the task completion time exceeds the preset completion time, a third warning instruction is generated; when the CPU usage rate is greater than the preset usage rate, a fourth warning instruction is generated; the first warning instruction, the second warning instruction, the third warning instruction, and the fourth warning instruction constitute the warning message of the thread pool. Since the warning information is automatically acquired, the acquisition time of the warning information is reduced, which is conducive to improving the efficiency of acquiring the warning information.

[0117] See also Figure 6 , Figure 6 : is a schematic diagram of a structure of a monitoring and early warning device in one embodiment of the present invention. Figure 6 As shown, the monitoring and early warning device includes a first acquisition module 101, an execution module 102, a second acquisition module 103, a third acquisition module 104, an extraction module 105, and an early warning module 106. The functional modules are described in detail as follows:

[0118] The first acquisition module 101 is used to acquire a target task and submit the target task to a thread pool of the system;

[0119] An execution module 102, configured to execute the target task through threads in the thread pool;

[0120] A second acquisition module 103 is used to acquire monitoring data of the thread pool during the execution of the target task;

[0121] A third acquisition module 104 is used to sample the monitoring data of the thread pool to obtain a log file of the monitoring data;

[0122] An extraction module 105 is used to extract information from the log file to obtain lock information, call stack information, task completion time and CPU usage rate in the thread pool;

[0123] The warning module 106 is used to determine a warning message of the thread pool based on the lock information, the call stack information, the task completion time and the CPU usage rate.

[0124] In one embodiment, the execution module 102 includes:

[0125] A judging subunit, used for obtaining the current state of the thread of the thread pool, and judging whether the current state is an idle state;

[0126] The execution subunit is used to execute the target task through the thread when the current state is the idle state.

[0127] In one embodiment, the second acquisition module 103 includes:

[0128] A first reading subunit is used to read the monitoring instruction according to a preset path during the execution of the target task;

[0129] The monitoring subunit is used to monitor the thread pool by executing the monitoring instruction to obtain monitoring data of the thread pool.

[0130] In one embodiment, the third acquisition module 104 includes:

[0131] The second reading subunit is used to read the sampling frequency in the preset file;

[0132] The sampling subunit is used to sample the monitoring data of the thread pool according to the sampling frequency during the execution of the target task to obtain the sampled data, and record the sampled data to obtain a log file of the monitoring data.

[0133] In one embodiment, the extraction module 105 includes:

[0134] An acquisition subunit, used for acquiring text data in the log file;

[0135] The extraction subunit is used to extract information from the text data to obtain lock information, call stack information, task completion time and CPU usage rate in the thread pool.

[0136] In one embodiment, the early warning module 106 includes:

[0137] A detection subunit is used to detect whether the lock information has a deadlock, detect whether the current execution time of each function of the call stack information exceeds the preset execution time, detect whether the task completion time exceeds the preset completion time, and detect whether the CPU usage rate is greater than the preset usage rate;

[0138] The early warning subunit is used to generate a first early warning instruction for the target task when a deadlock exists in the lock information, generate a second early warning instruction when the current execution time exceeds the preset execution time, generate a third early warning instruction when the task completion time exceeds the preset completion time, and generate a fourth early warning instruction when the CPU usage rate is greater than the preset usage rate. The first early warning instruction, the second early warning instruction, the third early warning instruction, and the fourth early warning instruction constitute an early warning message of the thread pool.

[0139] In one embodiment, the monitoring and early warning device further includes:

[0140] A module is used to obtain a rollback algorithm corresponding to the warning message, and use the rollback algorithm to roll back the running state of the thread pool to a target state.

[0141] In the embodiment of the present invention, the beneficial effects lie in two aspects. On the one hand, based on the lock information, the call stack information, the task completion time and the CPU usage rate, the warning message of the thread pool is determined. Since manual acquisition is not required, the acquisition time of the warning information is reduced, which is beneficial to improving the efficiency of obtaining the warning information. On the other hand, it will not be affected by manual operations, so it is beneficial to improve the stability of the obtained warning message of the thread pool.

[0142] For the specific limitations of the monitoring and early warning device, please refer to the limitations of the monitoring and early warning method above, which will not be repeated here.

[0143] Each module in the above monitoring and early warning device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0144] See also Figure 7 , Figure 7 is a schematic diagram of a computer device in one embodiment of the present invention. In one embodiment, a computer device is provided. The computer device may be a server device, and its internal structure diagram may be as shown in FIG. Figure 7 The computer device includes a processor, a memory, a network interface and a database connected through a system bus.

[0145] The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. When the computer program is executed by the processor, a function or step of a monitoring and early warning method can be implemented on the server device.

[0146] See also Figure 8 , Figure 8 is another structural diagram of a computer device in one embodiment of the present invention. In one embodiment, a computer device is provided. The computer device may be a client device, and its internal structure diagram may be as shown in FIG. Figure 8 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. When the computer program is executed by the processor, a function or step of a monitoring and early warning method can be implemented on the client device.

[0147] In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor.

[0148] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can refer to the relevant description in the aforementioned method embodiment. In order to avoid repetition, they will not be described one by one here.

[0149] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0150] The above description and accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operation may vary. Parts and subsamples of some embodiments may be included in or replace parts and subsamples of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and claims, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of listings containing one or more associated ones. In addition, when used in the present application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of a stated sub-sample, whole, step, operation, element, and / or component, but do not exclude the presence or addition of one or more other sub-samples, wholes, steps, operations, elements, components and / or groups of these. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the various embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.

[0151] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. Technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present disclosure. Technicians can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0152] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some sub-samples can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.

[0153] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. In addition, the non-Company software tools or components that appear in the embodiments of the present application are only examples and do not represent actual use.

Claims

1. A monitoring and early warning method, characterized in that: include: Obtain a target task, and submit the target task to a thread pool of the system; Execute the target task through the thread of the thread pool; During the execution of the target task, obtaining monitoring data of the thread pool; Sampling the monitoring data of the thread pool to obtain a log file of the monitoring data; Extract information from the log file to obtain lock information, call stack information, task completion time and CPU usage rate in the thread pool; Based on the lock information, the call stack information, the task completion time and the CPU usage rate, a warning message of the thread pool is determined.

2. The monitoring and early warning method according to claim 1, characterized in that: The executing of the target task by the thread of the thread pool includes: Obtain the current state of the thread of the thread pool, and determine whether the current state is an idle state; When the current state is the idle state, the target task is executed by the thread.

3. The monitoring and early warning method according to claim 1, characterized in that: The acquiring of monitoring data of the thread pool during the execution of the target task includes: During the execution of the target task, reading the monitoring instruction according to the preset path; By executing the monitoring instruction, the thread pool is monitored to obtain monitoring data of the thread pool.

4. The monitoring and early warning method according to claim 1, characterized in that: The sampling of the monitoring data of the thread pool to obtain a log file of the monitoring data includes: Read the sampling frequency in the preset file; During the execution of the target task, the monitoring data of the thread pool is sampled according to the sampling frequency to obtain the sampled data, and the sampled data is recorded to obtain a log file of the monitoring data.

5. The monitoring and early warning method according to claim 1, characterized in that: The information extraction from the log file to obtain the lock information, call stack information, task completion time and CPU usage rate in the thread pool includes: Obtaining text data in the log file; Information is extracted from the text data to obtain lock information, call stack information, task completion time and CPU usage in the thread pool.

6. The monitoring and early warning method according to claim 1, characterized in that: The determining of the warning message of the thread pool based on the lock information, the call stack information, the task completion time and the CPU usage rate includes: Detect whether there is a deadlock in the lock information, detect whether the current execution time of each function in the call stack information exceeds the preset execution time, detect whether the task completion time exceeds the preset completion time, and detect whether the CPU usage rate is greater than the preset usage rate; When the lock information is deadlocked, a first warning instruction is generated for the target task; when the current execution time exceeds the preset execution time, a second warning instruction is generated; when the task completion time exceeds the preset completion time, a third warning instruction is generated; when the CPU usage rate is greater than the preset usage rate, a fourth warning instruction is generated; the first warning instruction, the second warning instruction, the third warning instruction, and the fourth warning instruction constitute a warning message of the thread pool.

7. The monitoring and early warning method according to any one of claims 1 to 6, characterized in that: After determining the warning message of the thread pool based on the lock information, the call stack information, the task completion time and the CPU usage rate, the monitoring and warning method includes: Obtain a rollback algorithm corresponding to the warning message, and use the rollback algorithm to roll back the running state of the thread pool to a target state.

8. A monitoring and early warning device, characterized in that: include: A first acquisition module is used to acquire a target task and submit the target task to a thread pool of the system; An execution module, used for executing the target task through the threads of the thread pool; A second acquisition module, used for acquiring monitoring data of the thread pool during the execution of the target task; A third acquisition module is used to sample the monitoring data of the thread pool to obtain a log file of the monitoring data; An extraction module is used to extract information from the log file to obtain lock information, call stack information, task completion time and CPU usage rate in the thread pool; An early warning module is used to determine an early warning message of the thread pool based on the lock information, the call stack information, the task completion time and the CPU usage rate.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the monitoring and early warning method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the monitoring and early warning method according to any one of claims 1 to 7 are implemented.