CN114281505A - Thread pool optimization processing method, device, storage medium and equipment - Google Patents

Thread pool optimization processing method, device, storage medium and equipment Download PDF

Info

Publication number
CN114281505A
CN114281505A CN202111603656.9A CN202111603656A CN114281505A CN 114281505 A CN114281505 A CN 114281505A CN 202111603656 A CN202111603656 A CN 202111603656A CN 114281505 A CN114281505 A CN 114281505A
Authority
CN
China
Prior art keywords
thread pool
software system
thread
memory
occupancy rate
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111603656.9A
Other languages
Chinese (zh)
Inventor
张明凡
徐永生
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Telecom Corp Ltd
Original Assignee
China Telecom Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Telecom Corp Ltd filed Critical China Telecom Corp Ltd
Priority to CN202111603656.9A priority Critical patent/CN114281505A/en
Publication of CN114281505A publication Critical patent/CN114281505A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a thread pool optimization processing method, a thread pool optimization processing device, a storage medium and equipment. Wherein, the method comprises the following steps: acquiring the memory occupancy rate of a virtual machine of a software system; if the memory occupancy rate exceeds an early warning line, triggering a thread pool control strategy aiming at the software system, wherein the thread pool control strategy is used for dynamically adjusting parameters of each thread pool in the software system so as to reduce the memory occupancy rate of the virtual machine; and when the memory occupancy rate of the virtual machine is detected to be reduced to the value which does not exceed the early warning line, updating the maximum thread number of the thread pool in the software system, and closing the thread pool control strategy. The invention solves the technical problems that the thread pool optimization processing method in the prior art is complex in implementation mode and can not completely avoid the memory overflow condition.

Description

Thread pool optimization processing method, device, storage medium and equipment
Technical Field
The invention relates to the technical field of data processing, in particular to a thread pool optimization processing method, a thread pool optimization processing device, a storage medium and equipment.
Background
With the continuous development of communication technology, the increasing amount of information causes many platforms to face the pressure of high concurrent information processing, and during the high concurrent processing, a large amount of multi-thread execution modes are often used. When the system is in multi-thread high-load operation, if the thread occupies too much memory resources, the memory overflow may be caused, once the memory overflow occurs in the system, the system cannot continue to provide service, and finally, the service state of the system can be recovered only by carrying out manual restart.
At present, most companies avoid system crash caused by system memory usage overflow by optimizing jvm (java virtual machine operating environment, hereinafter referred to as jvm), but the implementation process of the optimization manner in the prior art is complex and cannot completely avoid the memory overflow.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a thread pool optimization processing method, a thread pool optimization processing device, a storage medium and equipment, and at least solves the technical problems that the thread pool optimization processing method in the prior art is complex in implementation mode and cannot completely avoid the occurrence of a memory overflow condition.
According to an aspect of the embodiments of the present invention, there is provided a thread pool optimization processing method, including: acquiring the memory occupancy rate of a virtual machine of a software system; if the memory occupancy rate exceeds an early warning line, triggering a thread pool control strategy aiming at the software system, wherein the thread pool control strategy is used for dynamically adjusting parameters of each thread pool in the software system so as to reduce the memory occupancy rate of the virtual machine; and when the memory occupancy rate of the virtual machine is detected to be reduced to the value which does not exceed the early warning line, updating the maximum thread number of the thread pool in the software system, and closing the thread pool control strategy.
Optionally, the obtaining the memory occupancy rate of the virtual machine of the software system includes: acquiring the current running state of the software system and the hardware information of a server where the software system is located; acquiring the memory configuration information of the virtual machine; and determining the memory occupancy rate of the virtual machine according to the current operating condition, the hardware information and the memory configuration information.
Optionally, the method further includes: if the memory occupancy rate is detected not to exceed the early warning line, acquiring the current thread number of the thread pool; and if the current thread number is not equal to the maximum thread number, setting the maximum thread number as the current thread number.
Optionally, the triggering a thread pool control policy for the software system includes: and adjusting the maximum thread number of each thread pool in the software system in a discontinuous and gradual mode so as to control the software system to reduce the number of the thread pools which actually exist at present.
Optionally, adjusting the maximum thread number of each thread pool in the software system in a discontinuous progressive manner includes: acquiring the duration that the occupancy rate of the memory exceeds the early warning line; and adjusting the maximum thread number of each thread pool by a preset percentage each time according to the duration by taking seconds as a unit by adopting a preset early warning rule.
Optionally, after triggering the thread pool control policy for the software system, the method further includes: determining alarm prompt information based on the triggering frequency and the severity of the thread pool control strategy; and outputting the alarm prompt information to a manager, wherein the alarm prompt information is used for prompting the manager to judge whether the physical memory needs to be manually added so as to meet the memory requirement of the software system.
According to another aspect of the embodiments of the present invention, there is also provided a thread pool optimization processing apparatus, including: the acquisition module is used for acquiring the memory occupancy rate of the virtual machine of the software system; a first processing module, configured to trigger a thread pool control policy for the software system if it is detected that the memory occupancy rate exceeds an early warning line, where the thread pool control policy is used to dynamically adjust parameters of each thread pool in the software system, so as to reduce the memory occupancy rate of the virtual machine; and the second processing module is used for updating the maximum thread number of the thread pool in the software system and closing the thread pool control strategy when detecting that the memory occupancy rate of the virtual machine is reduced to be less than the early warning line.
Optionally, the obtaining module includes: a first obtaining unit, configured to obtain a current operating status of the software system and hardware information of a server where the software system is located; a second obtaining unit, configured to obtain memory configuration information of the virtual machine; and the determining unit is used for determining the memory occupancy rate of the virtual machine according to the current operating condition, the hardware information and the memory configuration information.
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, which stores a plurality of instructions, the instructions being suitable for being loaded by a processor and executing any one of the above thread pool optimization processing methods.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including a memory and a processor, where the memory stores a computer program, and the processor is configured to execute the computer program to perform any one of the above thread pool optimization processing methods.
In the embodiment of the invention, the memory occupancy rate of the virtual machine of the software system is acquired; if the memory occupancy rate exceeds an early warning line, triggering a thread pool control strategy aiming at the software system, wherein the thread pool control strategy is used for dynamically adjusting parameters of each thread pool in the software system so as to reduce the memory occupancy rate of the virtual machine; when the memory occupancy rate of the virtual machine is detected to be reduced to a value which does not exceed the early warning line, the maximum thread number of the thread pool in the software system is updated, and the thread pool control strategy is closed, so that the purpose of triggering the thread pool control strategy according to the memory occupancy rate and further dynamically adjusting the operation parameters is achieved, the technical effect of reducing the memory occupancy rate of the virtual machine is achieved, and the technical problems that the thread pool optimization processing method in the prior art is complex in implementation mode and cannot completely avoid the memory overflow condition are solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow chart of a thread pool optimization processing method according to an embodiment of the invention;
FIG. 2 is a flow diagram illustrating an alternative thread pool optimization process according to an embodiment of the invention;
fig. 3 is a schematic diagram illustrating an alternative flow of confirming memory occupancy rate according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a thread pool optimization processing apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
In accordance with an embodiment of the present invention, there is provided an embodiment of a thread pool optimization processing method, it should be noted that the steps illustrated in the flowchart of the accompanying drawings may be performed in a computer system such as a set of computer executable instructions, and that while a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than that herein.
Fig. 1 is a flowchart of a thread pool optimization processing method according to an embodiment of the present invention, and as shown in fig. 1, the method includes the following steps:
step S102, acquiring the memory occupancy rate of a virtual machine of a software system;
step S104, if the memory occupancy rate is detected to exceed an early warning line, triggering a thread pool control strategy aiming at the software system, wherein the thread pool control strategy is used for dynamically adjusting parameters of each thread pool in the software system so as to reduce the memory occupancy rate of the virtual machine;
and step S106, when the memory occupancy rate of the virtual machine is detected to be not reduced to exceed the early warning line, updating the maximum thread number of the thread pool in the software system, and closing the thread pool control strategy.
In this embodiment of the present invention, the execution subject of the thread pool optimization processing scheme provided in the steps S102 to S106 is a server, that is, the server of the software system is adopted to obtain the memory occupancy rate of the virtual machine of the software system; judging whether the memory occupancy rate exceeds an early warning line, if so, triggering a thread pool control strategy aiming at the software system to reduce the memory occupancy rate of the virtual machine; and when the memory occupancy rate of the virtual machine is reduced to the value which does not exceed the early warning line, updating the maximum thread number of the thread pool in the software system, and closing the thread pool control strategy.
It should be noted that the server may be embedded in the software system, and is configured to obtain hardware data related to the memory, the number of CPU cores of the processor, and the like; the thread pool control strategy is used for dynamically adjusting parameters of each thread pool in the software system so as to reduce the memory occupancy rate of the virtual machine.
As an alternative embodiment, the server is adopted to obtain the memory of the software system, the number of CPU cores of the processor, and other related hardware data, and calculate jvm (the running environment of the java virtual machine, hereinafter referred to as jvm) memory size; and calculating by a multiple of two times of the progressive progress of a thread control strategy formula to obtain the optimal thread number, monitoring the occupancy rates of the memory and the CPU in the progressive progress, wherein the high occupancy rate threshold of the memory can be set to 75%, the high occupancy rate threshold of the CPU can be set to 80%, and the calculation formula is as follows:
Figure BDA0003432750310000051
wherein, N is the number of CPUs; u is the utilization rate of the target CPU, and 0< ═ U < ═ 1; W/E is the ratio of latency to computation time; the number of progressive steps is n.
Optionally, when the occupancy rate of the software system exceeds the high occupancy rate threshold, the optimal thread number is calculated by subtracting 1 from the progressive number n.
As an alternative embodiment, the memory warning level of the virtual machine (i.e. the warning line) may be obtained jvm according to the memory occupancy variance v, where the memory variance calculation formula is:
Figure BDA0003432750310000052
when the variance is less than 5, the disturbance of the memory occupancy rate is small, and the warning waterline can be set to be 90%; when the variance is greater than 5, the calculation method of the warning waterline is as follows:
Figure BDA0003432750310000053
and obtaining the optimal memory warning water level through the algorithm.
According to the embodiment of the invention, as shown in the thread pool optimization processing flow diagram of fig. 2, the virtual machine memory occupancy rate is analyzed and calculated in real time according to the current software system operation state, so as to obtain the optimal parameters of the thread pool of the current software system, thereby improving the concurrent processing capability of the system. By setting the memory occupancy standard of the virtual machine, if the memory occupancy rate is too large and reaches the corresponding early warning line, the thread pool limiting strategy is triggered immediately, and the parameters of each thread pool are dynamically adjusted to reduce the memory occupancy rate of the virtual machine. After the memory occupancy rate is reduced to a normal level, the algorithm modifies the maximum thread number of the thread pool again and closes the thread control strategy, so as to ensure that the service cannot be completely lost under the condition of sudden increase of the system pressure, and the system resources are utilized to the maximum extent under the condition of permission of the system memory occupancy rate, so that the concurrent processing speed of the system is improved, meanwhile, if the limitation strategy is triggered, an alarm is sent to an administrator, and according to the frequency severity triggered by the limitation strategy, the administrator judges whether the physical memory needs to be manually increased or not so as to meet the system requirement.
Through the embodiment of the invention, the purpose of triggering the thread pool control strategy according to the memory occupancy rate and further dynamically adjusting the operation parameters is achieved, so that the technical effect of reducing the memory occupancy rate of the virtual machine is realized, and the technical problems that the thread pool optimization processing method in the prior art is complex in implementation mode and cannot completely avoid the memory overflow condition are solved.
In an optional embodiment, the obtaining the memory occupancy rate of the virtual machine of the software system includes:
step S202, acquiring the current operating state of the software system and the hardware information of the server where the software system is located;
step S204, obtaining the memory configuration information of the virtual machine;
step S206, determining the memory occupancy rate of the virtual machine according to the current operating status, the hardware information, and the memory configuration information.
In the embodiment of the present invention, as shown in the schematic diagram of the memory occupancy rate confirmation flow shown in fig. 3, the server is adopted to obtain the current operating status of the software system and the hardware information of the server where the software system is located; acquiring the memory configuration information of the virtual machine; and determining the memory occupancy rate of the virtual machine according to the current operating condition, the hardware information and the memory configuration information.
As an alternative embodiment, after obtaining the hardware data related to the memory of the software system, the number of CPU cores of the processor, and the like, the memory occupancy rate of jvm is calculated according to the hardware condition of the software system and the memory configuration of jvm.
In an optional embodiment, the method further includes:
step S302, if the memory occupancy rate is detected not to exceed the early warning line, the current thread number of the thread pool is obtained;
in step S304, if the current thread count is not equal to the maximum thread count, the maximum thread count is set as the current thread count.
In the embodiment of the present invention, if it is detected that the memory occupancy rate does not exceed the preset early warning line, the current thread number of the thread pool is obtained, and whether the current thread number is equal to the calculated maximum thread number is determined, and if not, the maximum thread number is set as the current thread number.
As an alternative embodiment, in the running process of the software system, if the memory occupancy rate does not reach the warning level, the thread parameter of the current system thread pool is set to the calculated maximum thread number, so as to ensure high concurrency of the system.
In an optional embodiment, the triggering the thread pool control policy for the software system includes:
step S402, adjusting the maximum thread number of each thread pool in the software system in an intermittent progressive manner to control the software system to reduce the number of the thread pools which actually exist currently.
As an optional embodiment, in the running process of the software system, when a pressure peak occurs, that is, when the server monitors that the current memory occupancy rate of the software system reaches an early warning line, the server immediately applies the thread pool control strategy, and continuously reduces the running parameters such as the maximum thread number of each thread pool in the system in an intermittent and gradual manner, so as to slowly reduce the actual thread number in the software system.
In an optional embodiment, adjusting the maximum thread count of each thread pool in the software system in an intermittent and gradual manner includes:
step S502, obtaining the duration that the occupancy rate of the memory exceeds the early warning line;
step S504, a preset early warning rule is adopted, according to the duration, the maximum thread number of each thread pool is adjusted each time and is decreased by a preset percentage by taking seconds as a unit.
In the embodiment of the present invention, in the process of adjusting the maximum thread count of each thread pool in the software system in an intermittent and gradual manner, the duration that the memory occupancy rate exceeds the warning line is first obtained, and the maximum thread count of each thread pool is adjusted to be decreased by a predetermined percentage each time in units of seconds.
As an alternative embodiment, the slow descending process may be performed according to the fact that the memory occupancy rate exceeds the early warning line time, and the number of threads is decreased once per second, and each time is adjusted to be 75% of the maximum number of threads.
In an optional embodiment, after the triggering the thread pool control policy for the software system, the method further includes:
step S602, determining alarm prompt information based on the triggering frequency and the severity of the thread pool control strategy;
step S604, outputting the alarm prompt information to a manager, where the alarm prompt information is used to prompt the manager to determine whether a physical memory needs to be manually added to meet a memory requirement of the software system.
In the embodiment of the present invention, the server may determine an alarm prompt message according to the trigger frequency and the severity of the thread pool control policy, and send the alarm prompt message to an electronic device associated with a manager, so as to prompt the manager to determine whether a physical memory needs to be manually added to meet a memory requirement of the software system.
As an optional embodiment, the server may record triggering time after triggering the thread pool control policy each time, and analyze and process the triggering time and the triggering times for multiple times, if the judgment is more serious, an alarm short message may be sent to an administrator according to the trigger early warning, and the administrator judges whether to manually add a physical memory to meet the system requirement according to the frequency and the severity of the thread control policy.
Optionally, after the alarm prompt information is triggered, the number of actual operating threads of the software system gradually decreases, and when the memory of the software system is restored to a normal level, the server stops the control strategy of the thread pool. At this time, the actual number of the threads of the software system meets the high concurrency degree, and the maximum concurrency degree which can be provided while the software system stably runs can be ensured due to the optimal number of the threads of the current software system in stable running.
As an alternative embodiment, when the server monitors that the current system memory occupancy amount decreases to a lower level (the lower limit of the memory precaution line is 40%) after the peak of the software system memory occupancy rate pressure, the server dynamically modifies the parameters of each thread pool of the software system to the calculated maximum number of threads that can be borne under the condition of meeting the current business high-efficiency operation condition.
Optionally, after the control strategy is stopped, if the memory occupancy rate reaches the warning line again, the thread pool control strategy is triggered again, so that it can be ensured that the system does not crash comprehensively due to memory overflow.
Through the steps, the stability and the high concurrency of the software system can be balanced, the overall data processing efficiency of the system is greatly improved under the condition of ensuring the stable operation of the software system according to the optimal thread number between the stability and the high concurrency, the performance of server hardware is exerted to the maximum extent, the stability of the system is ensured, the thread pool parameters are in the optimal state in real time, manual pressure measurement is not needed any more to determine the core parameter size of the thread pool, the purpose of triggering the thread pool control strategy according to the memory occupancy rate and further dynamically adjusting the operation parameters is achieved, the technical effect of reducing the memory occupancy rate of the virtual machine is achieved, and the technical problems that the thread pool optimization processing method in the prior art is complex in implementation mode and the memory overflow condition cannot be completely avoided are solved.
Example 2
According to an embodiment of the present invention, an embodiment of an apparatus for implementing the thread pool optimization processing method is further provided, and fig. 4 is a schematic structural diagram of a thread pool optimization processing apparatus according to an embodiment of the present invention, as shown in fig. 4, the apparatus includes: an acquisition module 40, a first processing module 42, and a second processing module 44, wherein:
an obtaining module 40, configured to obtain a memory occupancy rate of a virtual machine of a software system;
a first processing module 42, configured to trigger a thread pool control policy for the software system if it is detected that the memory occupancy rate exceeds an early warning line, where the thread pool control policy is used to dynamically adjust parameters of each thread pool in the software system, so as to reduce the memory occupancy rate of the virtual machine;
a second processing module 44, configured to update the maximum thread count of the thread pool in the software system and close the thread pool control policy when it is detected that the memory occupancy rate of the virtual machine has decreased to a value that does not exceed the warning line.
Optionally, the obtaining module includes: a first obtaining unit, configured to obtain a current operating status of the software system and hardware information of a server where the software system is located; a second obtaining unit, configured to obtain memory configuration information of the virtual machine; and the determining unit is used for determining the memory occupancy rate of the virtual machine according to the current operating condition, the hardware information and the memory configuration information.
It should be noted here that the acquiring module 40, the first processing module 42 and the second processing module 44 correspond to steps S102 to S106 in embodiment 1, and the three modules are the same as the corresponding steps in the implementation example and application scenario, but are not limited to the disclosure in embodiment 1.
It should be noted that, reference may be made to the relevant description in embodiment 1 for a preferred implementation of this embodiment, and details are not described here again.
Embodiments of a computer-readable storage medium are also provided according to embodiments of the present invention. Optionally, in this embodiment, the computer-readable storage medium may be configured to store the program code executed by the thread pool optimization processing method provided in embodiment 1.
Optionally, in this embodiment, the computer-readable storage medium may be located in any one of computer terminals in a computer terminal group in a computer network, or in any one of mobile terminals in a mobile terminal group.
Optionally, in this embodiment, the computer readable storage medium is configured to store program codes for performing the following steps: acquiring the memory occupancy rate of a virtual machine of a software system; if the memory occupancy rate exceeds an early warning line, triggering a thread pool control strategy aiming at the software system, wherein the thread pool control strategy is used for dynamically adjusting parameters of each thread pool in the software system so as to reduce the memory occupancy rate of the virtual machine; and when the memory occupancy rate of the virtual machine is detected to be reduced to the value which does not exceed the early warning line, updating the maximum thread number of the thread pool in the software system, and closing the thread pool control strategy.
Optionally, the computer-readable storage medium may further include program code for performing the following steps: acquiring the current running state of the software system and the hardware information of a server where the software system is located; acquiring the memory configuration information of the virtual machine; and determining the memory occupancy rate of the virtual machine according to the current operating condition, the hardware information and the memory configuration information.
Optionally, the computer-readable storage medium may further include program code for performing the following steps: if the memory occupancy rate is detected not to exceed the early warning line, acquiring the current thread number of the thread pool; and if the current thread number is not equal to the maximum thread number, setting the maximum thread number as the current thread number.
Optionally, the computer-readable storage medium may further include program code for performing the following steps: and adjusting the maximum thread number of each thread pool in the software system in a discontinuous and gradual mode so as to control the software system to reduce the number of the thread pools which actually exist at present.
Optionally, the computer-readable storage medium may further include program code for performing the following steps: acquiring the duration that the occupancy rate of the memory exceeds the early warning line; and adjusting the maximum thread number of each thread pool by a preset percentage each time according to the duration by taking seconds as a unit by adopting a preset early warning rule.
Optionally, the computer-readable storage medium may further include program code for performing the following steps: determining alarm prompt information based on the triggering frequency and the severity of the thread pool control strategy; and outputting the alarm prompt information to a manager, wherein the alarm prompt information is used for prompting the manager to judge whether the physical memory needs to be manually added so as to meet the memory requirement of the software system.
Embodiments of a processor are also provided according to embodiments of the present invention. Optionally, in this embodiment, the computer-readable storage medium may be configured to store the program code executed by the thread pool optimization processing method provided in embodiment 1.
The embodiment of the application provides an electronic device, the device comprises a processor, a memory and a program which is stored on the memory and can be run on the processor, and the processor executes the program and realizes the following steps: acquiring the memory occupancy rate of a virtual machine of a software system; if the memory occupancy rate exceeds an early warning line, triggering a thread pool control strategy aiming at the software system, wherein the thread pool control strategy is used for dynamically adjusting parameters of each thread pool in the software system so as to reduce the memory occupancy rate of the virtual machine; and when the memory occupancy rate of the virtual machine is detected to be reduced to the value which does not exceed the early warning line, updating the maximum thread number of the thread pool in the software system, and closing the thread pool control strategy.
Optionally, the electronic device may further execute program codes of the following steps: acquiring the current running state of the software system and the hardware information of a server where the software system is located; acquiring the memory configuration information of the virtual machine; and determining the memory occupancy rate of the virtual machine according to the current operating condition, the hardware information and the memory configuration information.
Optionally, the electronic device may further execute program codes of the following steps: if the memory occupancy rate is detected not to exceed the early warning line, acquiring the current thread number of the thread pool; and if the current thread number is not equal to the maximum thread number, setting the maximum thread number as the current thread number.
Optionally, the electronic device may further execute program codes of the following steps: and adjusting the maximum thread number of each thread pool in the software system in a discontinuous and gradual mode so as to control the software system to reduce the number of the thread pools which actually exist at present.
Optionally, the electronic device may further execute program codes of the following steps: acquiring the duration that the occupancy rate of the memory exceeds the early warning line; and adjusting the maximum thread number of each thread pool by a preset percentage each time according to the duration by taking seconds as a unit by adopting a preset early warning rule.
Optionally, the electronic device may further execute program codes of the following steps: determining alarm prompt information based on the triggering frequency and the severity of the thread pool control strategy; and outputting the alarm prompt information to a manager, wherein the alarm prompt information is used for prompting the manager to judge whether the physical memory needs to be manually added so as to meet the memory requirement of the software system.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device: acquiring the memory occupancy rate of a virtual machine of a software system; if the memory occupancy rate exceeds an early warning line, triggering a thread pool control strategy aiming at the software system, wherein the thread pool control strategy is used for dynamically adjusting parameters of each thread pool in the software system so as to reduce the memory occupancy rate of the virtual machine; and when the memory occupancy rate of the virtual machine is detected to be reduced to the value which does not exceed the early warning line, updating the maximum thread number of the thread pool in the software system, and closing the thread pool control strategy.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A thread pool optimization processing method is characterized by comprising the following steps:
acquiring the memory occupancy rate of a virtual machine of a software system;
if the memory occupancy rate exceeds an early warning line, triggering a thread pool control strategy aiming at the software system, wherein the thread pool control strategy is used for dynamically adjusting parameters of each thread pool in the software system so as to reduce the memory occupancy rate of the virtual machine;
and when the memory occupancy rate of the virtual machine is detected to be reduced to the value which does not exceed the early warning line, updating the maximum thread number of the thread pool in the software system, and closing the thread pool control strategy.
2. The method of claim 1, wherein the obtaining the memory occupancy rate of the virtual machine of the software system comprises:
acquiring the current operating condition of the software system and the hardware information of a server where the software system is located;
acquiring memory configuration information of the virtual machine;
and determining the memory occupancy rate of the virtual machine according to the current operating condition, the hardware information and the memory configuration information.
3. The method of claim 1, further comprising:
if the memory occupancy rate is detected not to exceed the early warning line, acquiring the current thread number of the thread pool;
and if the current thread number is not equal to the maximum thread number, setting the maximum thread number as the current thread number.
4. The method of claim 1, wherein triggering a thread pool control policy for the software system comprises:
and adjusting the maximum thread number of each thread pool in the software system in a discontinuous progressive mode to control the software system to reduce the number of the thread pools which actually exist at present.
5. The method of claim 4, wherein adjusting the maximum thread count for each thread pool in the software system in a discontinuous and gradual manner comprises:
acquiring the duration that the memory occupancy rate exceeds the early warning line;
and adjusting the maximum thread number of each thread pool by a preset percentage each time according to the duration by taking seconds as a unit by adopting a preset early warning rule.
6. The method of claim 1, wherein after the triggering a thread pool control policy for the software system, the method further comprises:
determining alarm prompt information based on the triggering frequency and the severity of the thread pool control strategy;
and outputting the alarm prompt information to a manager, wherein the alarm prompt information is used for prompting the manager to judge whether the physical memory needs to be manually added so as to meet the memory requirement of the software system.
7. A thread pool optimization processing apparatus, comprising:
the acquisition module is used for acquiring the memory occupancy rate of the virtual machine of the software system;
the first processing module is used for triggering a thread pool control strategy aiming at the software system if the memory occupancy rate is detected to exceed an early warning line, wherein the thread pool control strategy is used for dynamically adjusting parameters of each thread pool in the software system so as to reduce the memory occupancy rate of the virtual machine;
and the second processing module is used for updating the maximum thread number of the thread pool in the software system and closing the thread pool control strategy when the memory occupancy rate of the virtual machine is detected to be reduced to be less than the early warning line.
8. The apparatus of claim 7, wherein the obtaining module comprises:
the first acquisition unit is used for acquiring the current operating condition of the software system and the hardware information of a server where the software system is located;
a second obtaining unit, configured to obtain memory configuration information of the virtual machine;
and the determining unit is used for determining the memory occupancy rate of the virtual machine according to the current operating condition, the hardware information and the memory configuration information.
9. A computer-readable storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the thread pool optimization processing method of any one of claims 1 to 6.
10. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the computer program to perform the thread pool optimization processing method according to any one of claims 1 to 6.
CN202111603656.9A 2021-12-24 2021-12-24 Thread pool optimization processing method, device, storage medium and equipment Pending CN114281505A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111603656.9A CN114281505A (en) 2021-12-24 2021-12-24 Thread pool optimization processing method, device, storage medium and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111603656.9A CN114281505A (en) 2021-12-24 2021-12-24 Thread pool optimization processing method, device, storage medium and equipment

Publications (1)

Publication Number Publication Date
CN114281505A true CN114281505A (en) 2022-04-05

Family

ID=80875432

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111603656.9A Pending CN114281505A (en) 2021-12-24 2021-12-24 Thread pool optimization processing method, device, storage medium and equipment

Country Status (1)

Country Link
CN (1) CN114281505A (en)

Similar Documents

Publication Publication Date Title
CN105677477B (en) Method and device for optimizing application program resources and electronic equipment
CN104424031B (en) Method and device for controlling working frequency of processor
CN107273182B (en) Method and system for dynamically expanding virtual machine resources
CN103780447B (en) A kind of flow control methods and device
CN109308252A (en) A kind of fault location processing method and processing device
CN109491788B (en) Method and device for realizing load balance of virtualization platform
CN107402851B (en) Data recovery control method and device
CN114443429B (en) Alarm event processing method and device and computer readable storage medium
CN106951321B (en) Method and device for managing CPU (Central processing Unit) resources of virtual machine
US10111207B2 (en) Network device, terminal device, and voice service control method
CN110837456A (en) Control method and device and electronic equipment
CN111130834A (en) Method and device for processing network elasticity strategy
CN114281505A (en) Thread pool optimization processing method, device, storage medium and equipment
CN107092551A (en) A kind of server system performance optimization method and device
CN113886196B (en) On-chip power consumption management method, electronic device and storage medium
CN107391254B (en) Intelligent terminal, resource allocation method thereof and computer-readable storage medium
CN106789720B (en) Dynamic token bucket generation method based on system hardware utilization rate
JP2011510370A (en) Overload processing method and apparatus for communication equipment
CN114401204A (en) Link pool management method and device, computer equipment and storage medium
CN115237238A (en) Power saving method and device for mobile terminal and mobile terminal
CN112910732A (en) Method and equipment for resetting edge computing server
CN111193760A (en) Information sending method, device and storage medium
CN112162864A (en) Cloud resource allocation method and device and storage medium
CN109919521B (en) Block chain operation confirmation method and device and electronic equipment
US10291685B2 (en) Method and apparatus for controlling running of service

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