Method and system for dynamically configuring thread pool under micro-service and electronic equipment

By providing dynamic configuration methods for thread pools in a microservice environment, visual monitoring of thread pool health status and dynamic adjustment of parameters are solved, and the problem of unreasonable configuration of thread pool parameters in the existing technology is solved, and the system stability is improved Sex and efficiency.

CN119415233APending Publication Date: 2025-02-11SHENZHEN LANYOU TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411458419.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

The existing technology cannot monitor the usage of thread pools in real time and cannot dynamically adjust thread pool parameters, resulting in the impact of system throughput and stability. Especially in the microservice environment, parameter modification is complex and lagging.

Method used

Provide a dynamic configuration method for thread pool under microservices. It batch configures thread pool configuration parameters through web pages, obtains thread pool running data regularly for visual analysis, alerts when abnormal data occurs, and uses the best parameter selection algorithm to provide the best Configuration parameters.

Benefits of technology

It realizes visual monitoring of thread pool health status, pushes abnormal situations in real time, dynamically adjusts thread pool parameters, improves system stability and efficiency, and reduces manual configuration errors and modification complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415233A_ABST
    Figure CN119415233A_ABST
Patent Text Reader

Abstract

The invention discloses a thread pool dynamic configuration method under micro-service. The method comprises the following steps: configuring thread pool configuration parameters in batches through a web page; configuring a service according to the thread pool configuration parameter; regularly acquiring thread pool operation data; performing visualization on the operation data of the thread pool; displaying the visual data by using a web page; analyzing the operation data of the thread pool, and giving an alarm when abnormal data occurs; calculating the operation data of the thread pool, and providing optimal configuration parameters according to an optimal parameter selection algorithm: configuring the configuration parameters of the thread pool in batches through a web page according to the optimal configuration parameters. Compared with the prior art, the method has the advantages that the thread pool configuration parameters can be dynamically configured, the health condition visualization of the thread pool is realized, the abnormal condition is pushed in real time, and the stable operation of the system is facilitated. In addition, the invention also discloses a thread pool dynamic configuration system under the micro-service and electronic equipment, which also have the above technical effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of multithreading technology, and more specifically, to a thread pool dynamic configuration method, system and electronic device under microservices. Background Art

[0002] Multithreading technology plays an irreplaceable role in improving system processing performance, and multithreading is usually created and managed using thread pool technology. Improper parameter configuration of thread pool will directly affect system throughput and stability. With the popularity of microservices, a project may have hundreds of microservices.

[0003] At present, the parameters of the thread pool are often configured by developers based on experience before the system is started, and cannot be dynamically adjusted according to the actual usage of the thread pool. The popularity of microservices makes parameter modification more troublesome. The existing technology mainly modifies parameters according to thread usage when the system is suspended or abnormal, and shuts down the relevant microservices and repackages and deploys them. As the number of microservices increases, the complexity of the modification increases exponentially. In addition, the existing technology cannot monitor the usage of the thread pool in real time, and cannot perceive and process system failures in advance to avoid problems, which is lagging.

[0004] Therefore, how to provide a dynamic configuration method for thread pools under microservices, which can dynamically configure thread pool configuration parameters, realize visualization of thread pool health status, push abnormal situations in real time, and help the system run stably, has become a technical problem that needs to be solved urgently by technical personnel in this field. Summary of the invention

[0005] To solve the above technical problems, the present invention provides a thread pool dynamic configuration method under microservices, which can dynamically configure thread pool configuration parameters, realize thread pool health status visualization, push abnormal situations in real time, and help the system run stably. In addition, the present invention also provides a thread pool dynamic configuration system under microservices, which also has the above technical effects.

[0006] The technical solution provided by the present invention is as follows:

[0007] The present invention provides a thread pool dynamic configuration method under a microservice. Compared with the prior art, the method comprises the following steps: configuring thread pool configuration parameters in batches through a web page; configuring services according to the thread pool configuration parameters; obtaining thread pool operation data at a regular interval; visualizing the thread pool operation data; displaying the visualized data using a web page; analyzing the thread pool operation data and giving an alarm when abnormal data occurs; calculating the thread pool operation data and providing optimal configuration parameters according to an optimal parameter selection algorithm; and configuring the thread pool configuration parameters in batches through a web page according to the optimal configuration parameters.

[0008] Furthermore, in a preferred embodiment of the present invention, the step of periodically obtaining thread pool operation data includes the steps of: obtaining a thread pool API; obtaining thread pool operation data once through the thread pool API at regular intervals; and saving the thread pool operation data into a database.

[0009] Furthermore, in a preferred embodiment of the present invention, the method further includes configuring an alarm threshold via a web page.

[0010] Furthermore, the step of analyzing the thread pool operation data and issuing an alarm when abnormal data occurs includes: determining whether the thread pool operation data exceeds the alarm threshold; and pushing the abnormal data exceeding the alarm threshold via email or IM.

[0011] Furthermore, in a preferred embodiment of the present invention, the thread pool operation data includes thread status, thread activity, queue status, and task status.

[0012] In addition, the present invention also provides a thread pool dynamic configuration system under microservices, the system comprising:

[0013] A configuration service module, wherein the configuration service module is used to configure services according to thread pool configuration parameters;

[0014] A web management module, which is used to batch configure thread pool configuration parameters and visualize the thread pool operation data;

[0015] A thread pool operation status recording module, wherein the thread pool operation status recording module is used to periodically obtain thread pool operation data;

[0016] A thread pool configuration parameter calculation module, wherein the thread pool configuration parameter calculation module is used to provide optimal configuration parameters according to an optimal parameter selection algorithm;

[0017] An alarm module is used to generate an alarm when abnormal data occurs.

[0018] Furthermore, in a preferred embodiment of the present invention, the configuration service module is also used to dynamically obtain thread pool configuration parameters through the configuration service component.

[0019] Furthermore, in a preferred embodiment of the present invention, the web management module includes:

[0020] Parameter entry component, used to enter thread pool configuration parameters;

[0021] Threshold configuration component, used to configure alarm thresholds;

[0022] Thread pool monitoring component, used to visualize stored thread pool running data and search for specified thread pool running data;

[0023] The permission management component is used to manage operator permissions.

[0024] Furthermore, in a preferred embodiment of the present invention, the present invention further comprises:

[0025] A storage module, wherein the storage module is used to store the thread pool running data in a database;

[0026] The log module is used to record system modification logs and operation logs.

[0027] In addition, the present invention also provides an electronic device, comprising:

[0028] A computer program, wherein the computer program is used to execute the thread pool dynamic configuration method under the microservice as described above;

[0029] A memory, the memory being used to store the computer program;

[0030] A processor is used to execute the computer program.

[0031] The present invention provides a method, system and electronic device for dynamically configuring a thread pool under a microservice, which, compared with the prior art, comprises the following steps: configuring thread pool configuration parameters in batches through a web page; configuring services according to the thread pool configuration parameters; regularly obtaining thread pool operation data; visualizing the thread pool operation data; displaying the visualized data using a web page; analyzing the thread pool operation data and issuing an alarm when abnormal data occurs; calculating the thread pool operation data and providing optimal configuration parameters according to an optimal parameter selection algorithm: configuring the thread pool configuration parameters in batches through a web page according to the optimal configuration parameters. In the technical solution of the present invention, regularly obtaining thread pool operation data can obtain The operation of the thread pool can be monitored, and the obtained thread pool operation data can be visualized to provide transparent and intuitive information for operators, which is convenient for the subsequent operation and maintenance work; the obtained thread pool operation data can also be imported into the best parameter selection algorithm, and the algorithm can accurately derive the best thread pool configuration parameters, avoiding errors in manual parameter configuration based on experience, reducing the need to reconfigure parameters, and improving the efficiency of system operation; alarms for abnormal data can prevent problems before they occur, and handle operation problems before the system throughput and stability are affected, reducing potential risks of losses. At the same time, since the monitoring of abnormal data is completed by the algorithm, the manual workload is reduced and the labor burden is alleviated. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0033] Figure 1 A flow chart of a method for dynamically configuring a thread pool under a microservice provided by an embodiment of the present invention;

[0034] Figure 2 A schematic diagram of the main processing flow of dynamic configuration of thread pools under microservices provided in an embodiment of the present invention;

[0035] Figure 3 A schematic diagram of the module structure of a thread pool dynamic configuration system under a microservice provided by an embodiment of the present invention;

[0036] Figure 4 The present invention is a schematic diagram of a thread pool parameter configuration process in the prior art. DETAILED DESCRIPTION

[0037] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only 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 the field without creative work are within the scope of protection of the present invention.

[0038] It should be noted that the terms "comprises", "includes" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, product or equipment that includes a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, product or equipment.

[0039] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "multiple" and "several" is two or more, unless otherwise clearly and specifically defined.

[0040] It should be noted that the structures, proportions, sizes, etc. illustrated in the drawings of this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with this technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantive technical significance. Any structural modification, change in proportion or adjustment of size, without affecting the effects and purposes that can be achieved by the present invention, should still fall within the scope of the technical contents disclosed by the present invention.

[0041] Please Figures 1 to 4 As shown, the thread pool dynamic configuration method under the microservice provided by the embodiment of the present invention includes the following steps: batch configuring thread pool configuration parameters through a web page; configuring services according to the thread pool configuration parameters; regularly obtaining thread pool operation data; visualizing the thread pool operation data; using a web page to display the visualized data; analyzing the thread pool operation data and issuing an alarm when abnormal data occurs; calculating the thread pool operation data and providing optimal configuration parameters according to an optimal parameter selection algorithm: according to the optimal configuration parameters, batch configuring the thread pool configuration parameters through a web page.

[0042] In the above-mentioned embodiment of the present invention, the regular acquisition of thread pool operation data can obtain the operation status of the thread pool, so that the operation of the thread pool can be monitored, and the obtained thread pool operation data can be visualized. Compared with the prior art, it can provide transparent and intuitive information for operators, which is convenient for the subsequent operation and maintenance work; the obtained thread pool operation data can also be imported into the best parameter selection algorithm, and the algorithm can accurately derive the best thread pool configuration parameters, avoiding errors in manual parameter configuration based on experience, reducing the need to reconfigure parameters, and improving the efficiency of system operation; compared with the prior art, alarms are issued for abnormal data, which can prevent problems before they occur, and handle operation problems before the system throughput and stability are affected, thereby reducing the potential risk of losses. At the same time, since the monitoring of abnormal data is completed by the algorithm, the manual workload is reduced and the labor burden is alleviated.

[0043] It can be seen from the above that the thread pool dynamic configuration method under the microservice provided by the embodiment of the present invention can dynamically configure the thread pool configuration parameters, realize the visualization of the health status of the thread pool, push abnormal situations in real time, and help the system run stably.

[0044] Specifically, the step of periodically obtaining thread pool running data includes the steps of: obtaining a thread pool API; obtaining thread pool running data once through the thread pool API at regular intervals; and saving the thread pool running data in a database.

[0045] It should be noted that in the embodiment of the present invention, the thread pool operation data is obtained through the thread pool API. Since the thread pool API provides a set of standardized operation interfaces, the coupling between system modules is reduced, which enhances the maintainability and scalability of the modules compared to the prior art.

[0046] Among them, at regular intervals, through a scheduled task or a scheduled scheduler, at set time intervals, such as 1 second or 1 minute, the real-time data of its runtime can be obtained again through the thread pool API and saved in the database. Compared with the existing technology, it is further helpful for the call of the subsequent links.

[0047] Specifically, the thread pool running data includes thread status, thread activity, queue status, and task status.

[0048] It should be noted that by analyzing the status distribution of threads, it is possible to determine whether the utilization of the thread pool is reasonable, such as whether there are a large number of waiting or blocked threads; through thread activity, it is possible to determine whether the thread pool is overloaded; by monitoring the number of waiting tasks in the queue, it is possible to determine whether the thread pool has sufficient resources to process tasks; through task status, it is possible to monitor the overall execution of tasks in the system, understand the completion rate and failure rate of tasks, and thus determine the health of the system.

[0049] Specifically, in the embodiment of the present invention, the step of configuring the alarm threshold through a web page is also included.

[0050] It should be noted that in the embodiment of the present invention, the scope of abnormal data is determined by configuring the alarm threshold. In addition, there are intelligent algorithms that can automatically determine the abnormal data to generate an alarm, which is not excluded from the scope of the present invention.

[0051] Specifically, in an embodiment of the present invention, the step of analyzing the thread pool operation data and issuing an alarm when abnormal data occurs includes: determining whether the thread pool operation data exceeds the alarm threshold; and pushing the abnormal data exceeding the alarm threshold via email or IM.

[0052] It should be noted that in the embodiment of the present invention, abnormal data exceeding the alarm threshold will be pushed to the system operator, who can infer thread pool operation problems based on the pushed abnormal data and deal with the problems in a timely manner to avoid potential losses.

[0053] In addition, an embodiment of the present invention further provides a thread pool dynamic configuration system under a microservice, the system comprising:

[0054] A configuration service module, wherein the configuration service module is used to configure services according to thread pool configuration parameters;

[0055] A web management module, which is used to batch configure thread pool configuration parameters and visualize the thread pool operation data;

[0056] A thread pool operation status recording module, wherein the thread pool operation status recording module is used to periodically obtain thread pool operation data;

[0057] A thread pool configuration parameter calculation module, wherein the thread pool configuration parameter calculation module is used to provide optimal configuration parameters according to an optimal parameter selection algorithm;

[0058] An alarm module is used to generate an alarm when abnormal data occurs.

[0059] Among them, the configuration service module can adopt configuration service components such as nacos, and the web management module is used to batch configure the thread pool configuration parameters. There is no need to manually modify the parameters one by one, which improves the modification efficiency of the thread pool configuration parameters. The thread pool configuration parameters can be dynamically adjusted through the web management module without releasing the version or restarting the service, which can improve the system robustness and availability.

[0060] Specifically, the configuration service module is also used to dynamically obtain thread pool configuration parameters through the configuration service component.

[0061] Specifically, the web management module includes: a parameter entry component for entering thread pool configuration parameters; a threshold configuration component for configuring alarm thresholds; a thread pool monitoring component for visually viewing stored thread pool operation data and searching for specified thread pool operation data; and a permission management component for managing operator permissions.

[0062] Among them, through the parameter entry component, various parameters of the thread pool can be flexibly set or adjusted, so as to dynamically adjust the configuration of the thread pool according to changes in the operation of the thread pool, and batch configure the thread pool configuration parameters through the web page; through the threshold configuration component, different alarm thresholds can be flexibly set according to actual needs to ensure that the alarm system can adapt to various application scenarios; through the thread pool monitoring component, the thread pool operation data is presented in a graphical manner to help operators quickly understand the load status of the current system. Not only that, a search function is provided to allow operators to view historical operation data for a specific time period or a specified thread pool, which is helpful for analyzing system performance fluctuations, tuning and troubleshooting; through the permission management component, accidental modifications or even malicious operations can be avoided.

[0063] Specifically, it also includes: a storage module, which is used to store the thread pool running data in a database; and a log module, which is used to record system modification logs and running logs.

[0064] Among them, the storage module ensures that the thread pool operation data can be stored for a long time, facilitates the call of the thread pool operation data, helps to analyze the thread pool operation status later, and visualizes and searches the thread pool operation status; in the log module, the system modification log is used to record all configuration, code or environment change information in the system, which is convenient for version management and troubleshooting. The operation log mainly records the daily operation status and operation information of the system, which can monitor the overall operation status of the system and reflect the health of the system.

[0065] In addition, an embodiment of the present invention further provides an electronic device, including:

[0066] A computer program, wherein the computer program is used to execute the thread pool dynamic configuration method under the microservice as described above;

[0067] A memory, the memory being used to store the computer program;

[0068] A processor is used to execute the computer program.

[0069] To elaborate more specifically, multithreading technology plays an irreplaceable role in improving system processing performance. Multithreading is usually created and managed using thread pool technology, and the parameters of the thread pool are often configured by developers based on experience before the system is started, and cannot be dynamically adjusted with the actual use of the thread pool. The unreasonable configuration of the thread pool parameters will directly affect the system throughput and stability. In the prior art, the parameters of the thread pool configuration rely on experience, which is easy to cause unreasonable parameter configuration, and parameter modification requires each service to shut down, modify the code, and package and deploy. As the number of microservices increases, the complexity of the modification increases exponentially. In addition, the health status of the thread pool is a black box that cannot be actively monitored, and it is impossible to perceive and process in advance before a system failure occurs to avoid problems. Based on this, the technical solution involved in the embodiment of the present invention, based on the principles of dynamic configuration, observability, sampling, etc., achieves the rationalization of thread pool parameter configuration, the dynamic configuration of thread pool parameters, the visualization of thread pool health status, and real-time push of abnormal situations, which helps the system to be more robust and stable. The technical solution involved in the embodiment of the present invention involves the following important technical contents: first, the thread pool configuration parameters are obtained by calculating the thread pool operation data, so as to solve the inaccurate configuration problem according to the empirical value; second, the thread pool configuration parameters in multiple services are modified in batches, so as to avoid manually modifying the parameters one by one and improve the efficiency; third, the thread pool configuration parameters are adjusted dynamically, without the need to release the version or restart the service, so as to improve the robustness and availability of the system; fourth, the thread pool related problems are warned in advance by pushing abnormal data, and the alarm is sent to the relevant personnel to avoid production problems. The present invention accurately generates thread pool configuration parameter information by using the optimal parameter selection algorithm, improves the configuration accuracy of thread pool configuration parameters, batch modifies thread pool configuration parameters in multiple services through the web management module, dynamically adjusts thread pool configuration parameters, and pushes alarm information, which has significant technical effects compared with the prior art.

[0070] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A thread pool dynamic configuration method under microservices, characterized in that: Includes steps: Batch configure thread pool configuration parameters through the web page; Configure the service according to the thread pool configuration parameters; Get thread pool running data regularly; Performing visual processing on the thread pool running data; Display visual data through web pages; Analyze the thread pool running data and issue an alarm when abnormal data appears; The thread pool operation data is calculated, and the optimal configuration parameters are provided according to the optimal parameter selection algorithm: According to the optimal configuration parameters, the thread pool configuration parameters are configured in batches through a web page.

2. The thread pool dynamic configuration method under microservice according to claim 1 is characterized in that: The steps to periodically obtain thread pool operation data include: Get the thread pool api; Obtain thread pool operation data through the thread pool API at regular intervals; The thread pool running data is saved in a database.

3. The thread pool dynamic configuration method under microservice according to claim 2 is characterized in that: Also includes the steps: Configure the alarm threshold through the web page.

4. The thread pool dynamic configuration method under microservice according to claim 3 is characterized in that: Analyzing the thread pool running data and issuing an alarm when abnormal data occurs includes the following steps: Determine whether the thread pool running data exceeds the alarm threshold; Abnormal data that exceeds the alarm threshold will be pushed via email or IM.

5. The thread pool dynamic configuration method under microservice according to any one of claims 1 to 4, characterized in that: The thread pool operation data includes thread status, thread activity, queue status and task status.

6. A thread pool dynamic configuration system under microservices, characterized in that: The system is used to execute the thread pool dynamic configuration method under the microservice according to any one of claims 1 to 5, comprising: A configuration service module, wherein the configuration service module is used to configure services according to thread pool configuration parameters; A web management module, which is used to batch configure thread pool configuration parameters and visualize the thread pool operation data; A thread pool operation status recording module, wherein the thread pool operation status recording module is used to periodically obtain thread pool operation data; A thread pool configuration parameter calculation module, wherein the thread pool configuration parameter calculation module is used to provide optimal configuration parameters according to an optimal parameter selection algorithm; An alarm module is used to generate an alarm when abnormal data occurs.

7. The thread pool dynamic configuration system under microservice according to claim 6, characterized in that: The configuration service module is also used to dynamically obtain thread pool configuration parameters through the configuration service component.

8. The thread pool dynamic configuration system under microservice according to claim 6, characterized in that: The web management module includes: Parameter entry component, used to enter thread pool configuration parameters; Threshold configuration component, used to configure alarm thresholds; Thread pool monitoring component, used to visualize stored thread pool running data and search for specified thread pool running data; The permission management component is used to manage operator permissions.

9. The thread pool dynamic configuration system under microservice according to claim 6, characterized in that: The system also includes: A storage module, wherein the storage module is used to store the thread pool running data in a database; The log module is used to record system modification logs and operation logs.

10. An electronic device, characterized in that: include: A computer program, the computer program being used to execute the thread pool dynamic configuration method under a microservice according to any one of claims 1 to 5; A memory, the memory being used to store the computer program; A processor is used to execute the computer program.