Thread pool dynamic adjustment method and device based on configuration center
By configuring the center to manage thread pool parameters, using historical data and system load analysis to determine the adjustment step size, and monitoring performance indicators in real time, the efficiency and accuracy of thread pool parameter adjustment in the existing technology are solved, and better system performance and stability are achieved.
Patent Information
- Application Number
- CN202411748739.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-12-02
AI Technical Summary
The prior art is difficult to effectively and dynamically adjust thread pool parameters, resulting in waste of resources or delayed system response, and lacks global optimization capabilities and accurate effect evaluation.
The thread pool parameters are initialized by the configuration center, and the historical parameter version is sorted based on the effective time, the credibility of the parameter source is calculated, and the adjustment step size is determined through the risk value and optimal time window to achieve dynamic adjustment. At the same time, performance indicators are continuously collected and rolled back to the stable parameter version.
It improves the efficiency and accuracy of dynamic adjustment of thread pools, ensures the rational utilization of system resources and the optimization of response time, and reduces the failure rate and operation and maintenance costs.
Smart Images

Figure CN119225980B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular to a method and device for dynamically adjusting a thread pool based on a configuration center. Background Art
[0002] In the current complex and ever-changing distributed system environment, the dynamic adjustment of thread pool parameters has always been a technical difficulty that has attracted much attention. Traditional static configuration methods have been unable to adapt to the rapid changes in system load, and manual adjustments often lag behind actual needs, easily causing resource waste or system response delays. Although some automated parameter adjustment solutions have emerged, these solutions often have problems such as overly simple adjustment strategies, insufficient risk control, and lack of effective historical experience reuse.
[0003] Especially in microservice architecture, due to the complex dependencies between services, thread pool parameter changes of a single service may cause a chain reaction on the entire system. Most existing adjustment solutions are limited to a single service dimension and lack the ability to optimize parameters from a global perspective. At the same time, the evaluation of the effect of parameter adjustment is relatively rough, and it is difficult to accurately measure the impact of parameter changes on the overall performance of the system.
[0004] In addition, existing solutions also have deficiencies in the timing of parameter adjustment and risk prevention and control. Most systems use fixed adjustment strategies without fully considering system load characteristics and historical experience, which can easily trigger parameter adjustments at inappropriate times and affect system stability. When problems arise with parameter adjustments, the rollback mechanism of existing systems often reacts slowly, making it difficult to restore to a stable state in a timely manner. Summary of the invention
[0005] In response to the problems in the prior art, the present application provides a method and device for dynamically adjusting a thread pool based on a configuration center, which can effectively improve the efficiency and accuracy of dynamic adjustment of the thread pool.
[0006] In order to solve at least one of the above problems, the present application provides the following technical solutions:
[0007] In a first aspect, the present application provides a thread pool dynamic adjustment method based on a configuration center, comprising:
[0008] Initialize thread pool parameters, including the number of core threads, the maximum number of threads, and the thread queue capacity. The version library of the parameters records the effective time, parameter source, and parameter value. Sort the historical parameter versions by the effective time, and calculate the credibility of each parameter source based on the change effect of different parameter sources; multiply the difference ratio between the number of core threads after the change and the current parameter value, the difference ratio between the maximum number of threads after the change and the current parameter value, and the difference ratio between the queue capacity after the change and the current parameter value by the credibility of the corresponding parameter source to obtain a weighted change ratio, and sum the three weighted change ratios to obtain a risk value;
[0009] Analyze the correspondence between the effective time of each parameter and the system load in the historical version library to establish the optimal time window for parameter changes. When the risk value is lower than the threshold and is in the optimal time window, determine the adjustment step size according to the credibility of the parameter source, calculate the new number of core threads, maximum number of threads and queue capacity according to the current parameter value, and record the new effective time, parameter source and parameter value in the version library after the parameter adjustment is completed;
[0010] Performance indicators are continuously collected and associated with corresponding parameter versions. When the performance indicators deteriorate, the last stable parameter value and effective time are located through the version library records, and rollback is performed accordingly.
[0011] Furthermore, the historical parameter versions are sorted by effective time, and the credibility of each parameter source is calculated based on the change effect of different parameter sources, including:
[0012] Query the effective time of the parameter version in the version library, build an ordered linked list based on the timestamp of the effective time, use the time difference between adjacent versions as the weight factor, calculate the system throughput, average response time and thread pool usage in each time period, and obtain the performance score through normalization;
[0013] Count the number of changes in each parameter source in historical versions and the corresponding performance score, calculate the proportion of performance improvement caused by the parameter change of the source, and take the product of the performance improvement amplitude and the improvement proportion as the credibility coefficient of the parameter source.
[0014] Furthermore, the difference ratio of the core thread number after the change and the current parameter value, the difference ratio of the maximum thread number after the change and the current parameter value, and the difference ratio of the queue capacity after the change and the current parameter value are respectively multiplied by the credibility of the corresponding parameter source to obtain a weighted change ratio, and the three weighted change ratios are summed to obtain a risk value, including:
[0015] Get the target values of the number of core threads, the maximum number of threads, and the queue capacity in the change parameter group, divide them by the corresponding parameter values currently in effect to get the change ratios of the three parameters, and normalize each change ratio to a value in the interval [-1,1], taking a positive value for an increasing trend and a negative value for a shrinking trend. The larger the absolute value of the change ratio, the greater the magnitude of the change.
[0016] The credibility coefficient of the parameter source that initiated the change is read from the version library, the standardized change ratios of the three parameters are multiplied by the credibility coefficient to obtain the weighted change value, the three weighted change values are squared and summed, and the square root is taken to obtain the Euclidean distance as the final risk measurement value, wherein the larger the risk measurement value, the higher the overall change risk.
[0017] Furthermore, the analysis of the correspondence between the effective time of each parameter in the historical version library and the system load to establish the optimal time window for parameter change includes:
[0018] Obtain system load data from the operation and maintenance platform, align CPU usage, memory usage, and disk IO data in time series, extract the periodic characteristics of system load through Fourier transform, identify the time distribution pattern of load peaks and troughs, and divide the load curve into peak period, stable period, and trough period according to the fluctuation amplitude;
[0019] Traverse the parameter change records in the version library, calculate the system stability index within a complete cycle after each parameter change, map the change time point to the corresponding interval of the load curve, use regression analysis method to establish the corresponding relationship model between parameter change success rate and load interval, and select the time interval with the highest success rate as the optimal change window.
[0020] Furthermore, when the risk value is lower than a threshold and is in an optimal time window, determining the adjustment step size according to the credibility of the parameter source includes:
[0021] Read the risk threshold set by the configuration center, compare the calculated risk value with the threshold, and obtain the current timestamp to determine whether it is within the optimal change window. Confirm whether the parameter adjustment conditions are met by performing an AND operation on the risk value comparison result and the time window judgment result.
[0022] The maximum step length interval of this adjustment is calculated based on the credibility coefficient of the parameter source, and the parameter adjustment range in the change request is constrained to be within the maximum step length interval. The adjustment value exceeding the interval is truncated to generate the final parameter adjustment value.
[0023] Furthermore, the new number of core threads, maximum number of threads and queue capacity are calculated based on the current parameter values, and the new effective time, parameter source and parameter value are recorded in the version library after the parameter adjustment is completed, including:
[0024] The maximum adjustment step is multiplied by the currently effective parameter value to obtain the parameter adjustment amount, and the adjustment amount is added to the current parameter value to calculate the new parameter combination. The three parameters of the number of core threads, the maximum number of threads, and the queue capacity are checked for legality to ensure that the number of core threads does not exceed the maximum number of threads and that the new parameter combination meets the basic constraints for the operation of the thread pool.
[0025] Construct a version record object, mark the initiator of the parameter change as the parameter source, generate a Unix timestamp as the effective time, fill the verified number of core threads, maximum number of threads and queue capacity as parameter values, and submit the new parameter version data through the write interface of the version library.
[0026] Furthermore, the performance indicators are continuously collected and associated with corresponding parameter versions. When the performance indicators deteriorate, the last stable parameter value and effective time are located through the version library records, and rollback is performed accordingly, including:
[0027] Use performance collection probes to periodically obtain the number of active threads, total threads, and waiting tasks in the thread pool. Associate the sampled data with the effective parameter version in the version library according to the timestamp, calculate the fluctuation trend of performance indicators within the sampling window, and use the double exponential smoothing algorithm to predict the direction of the performance curve. Determine the performance degradation status based on the degree of deviation between the predicted results and the performance benchmark.
[0028] Traverse the parameter records in the version library from the current version, read the performance indicator data associated with each historical version, extract the parameter version with stable performance indicators and meeting the target requirements as the rollback target, set the parameter combination of the version record to the current effective value, generate a new version record and mark it as a rollback operation.
[0029] In a second aspect, the present application provides a thread pool dynamic adjustment device based on a configuration center, comprising:
[0030] A risk value determination module is used to initialize thread pool parameters, wherein the parameters include the number of core threads, the maximum number of threads, and the thread queue capacity. The version library of the parameters records the effective time, the parameter source, and the parameter value. The historical parameter versions are sorted by the effective time, and the credibility of each parameter source is calculated based on the change effect of different parameter sources; the difference ratio between the number of core threads after the change and the current parameter value, the difference ratio between the maximum number of threads after the change and the current parameter value, and the difference ratio between the queue capacity after the change and the current parameter value are multiplied by the credibility of the corresponding parameter source to obtain a weighted change ratio, and the three weighted change ratios are summed to obtain a risk value;
[0031] The parameter adjustment module is used to analyze the corresponding relationship between the effective time of each parameter and the system load in the historical version library to establish the optimal time window for parameter changes. When the risk value is lower than the threshold and is in the optimal time window, the adjustment step is determined according to the credibility of the parameter source, and the new number of core threads, maximum number of threads and queue capacity are calculated according to the current parameter value. After the parameter adjustment is completed, the new effective time, parameter source and parameter value are recorded in the version library;
[0032] The parameter rollback module is used to continuously collect performance indicators and associate them with the corresponding parameter versions. When the performance indicators deteriorate, the last stable parameter value and effective time are located through the version library records, and rollback is performed accordingly.
[0033] In a third aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the method for dynamic adjustment of a thread pool based on a configuration center are implemented.
[0034] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for dynamic adjustment of a thread pool based on a configuration center.
[0035] In a fifth aspect, the present application provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the method for dynamic adjustment of a thread pool based on a configuration center.
[0036] It can be seen from the above technical scheme that the present application provides a method and device for dynamic adjustment of thread pools based on a configuration center, which initializes thread pool parameters, sorts historical parameter versions by effective time, calculates the credibility of each parameter source based on the change effect of different parameter sources, and sums up the three weighted change ratios to obtain a risk value; analyzes the correspondence between the effective time of each parameter in the historical version library and the system load to establish an optimal time window for parameter change; when the risk value is lower than the threshold and is in the optimal time window, determines the adjustment step according to the credibility of the parameter source, continuously collects performance indicators and associates them with the corresponding parameter version; when the performance indicator deteriorates, locates the last stable parameter value and effective time through the version library record, and performs rollback accordingly, thereby effectively improving the efficiency and accuracy of dynamic adjustment of the thread pool. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present application 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 some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0038] Figure 1 This is one of the flow charts of the thread pool dynamic adjustment method based on the configuration center in the embodiment of the present application;
[0039] Figure 2 This is a second flow chart of a method for dynamically adjusting a thread pool based on a configuration center in an embodiment of the present application;
[0040] Figure 3 This is a flowchart of the method for dynamically adjusting the thread pool based on the configuration center in the embodiment of the present application.
[0041] Figure 4 This is a fourth flow chart of a method for dynamically adjusting a thread pool based on a configuration center in an embodiment of the present application;
[0042] Figure 5 This is a fifth flow chart of a method for dynamically adjusting a thread pool based on a configuration center in an embodiment of the present application;
[0043] Figure 6 This is a sixth flow chart of a method for dynamically adjusting a thread pool based on a configuration center in an embodiment of the present application;
[0044] Figure 7 This is the seventh flow chart of the thread pool dynamic adjustment method based on the configuration center in the embodiment of the present application;
[0045] Figure 8 A structural diagram of a thread pool dynamic adjustment device based on a configuration center in an embodiment of the present application;
[0046] Fig. 9 It is a schematic diagram of the structure of an electronic device in an embodiment of the present application.
[0047] Reference numerals:
[0048] Electronic device 9600, central processing unit 9100, memory 9140, communication module 9110, input unit 9120, audio processor 9130, display 9160, power supply 9170, buffer memory 9141, application / function storage unit 9142, data storage unit 9143, driver program storage unit 9144, antenna 9111, speaker 9131, microphone 9132. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0050] The acquisition, storage, use, and processing of data in the technical solution of this application comply with the relevant provisions of national laws and regulations.
[0051] In view of the problems existing in the prior art, the present application provides a method and device for dynamic adjustment of a thread pool based on a configuration center, which initializes thread pool parameters, sorts historical parameter versions by effective time, calculates the credibility of each parameter source based on the change effect of different parameter sources, and sums up the three weighted change ratios to obtain a risk value; analyzes the correspondence between the effective time of each parameter in the historical version library and the system load to establish an optimal time window for parameter change; when the risk value is lower than a threshold and is in the optimal time window, determines the adjustment step according to the credibility of the parameter source, continuously collects performance indicators and associates them with corresponding parameter versions; when the performance indicators deteriorate, locates the last stable parameter value and effective time through the version library record, and performs rollback accordingly, thereby effectively improving the efficiency and accuracy of dynamic adjustment of the thread pool.
[0052] In order to effectively improve the efficiency and accuracy of thread pool dynamic adjustment, the present application provides an embodiment of a thread pool dynamic adjustment method based on a configuration center, see Figure 1 The thread pool dynamic adjustment method based on the configuration center specifically includes the following contents:
[0053] Step S101: Initialize thread pool parameters, including the number of core threads, the maximum number of threads, and the thread queue capacity. The version library of the parameters records the effective time, the parameter source, and the parameter value. The historical parameter versions are sorted by the effective time, and the credibility of each parameter source is calculated based on the change effect of different parameter sources; the difference ratio between the core thread number after the change and the current parameter value, the difference ratio between the maximum thread number after the change and the current parameter value, and the difference ratio between the queue capacity after the change and the current parameter value are multiplied by the credibility of the corresponding parameter source to obtain a weighted change ratio, and the three weighted change ratios are summed to obtain a risk value;
[0054] Optionally, in this embodiment, this step describes the core process of thread pool parameter initialization and risk assessment. The system implements intelligent adjustment of thread pool configuration through parameter version management and credibility calculation.
[0055] The initialization process first determines the three key parameters of the thread pool: the number of core threads determines the number of resident threads, which directly affects the basic processing capacity of the system; the maximum number of threads limits the maximum number of threads that the system can create at the same time to prevent excessive resource consumption; the thread queue capacity controls the number of waiting tasks and affects the buffering capacity of the system. The reasonable configuration of these three parameters has a decisive impact on system performance.
[0056] The design of the version library adopts a time-series data storage mode. Each parameter record contains the effective time, parameter source and specific parameter value. The effective time is stored using a timestamp to ensure the timeliness of the version; the parameter source records the change initiator, which may be an automatic tuning system, operation and maintenance personnel or other authorized systems; the parameter value saves the complete parameter combination in a structured form.
[0057] The historical version sorting establishes an ordered sequence based on the effective time. The sorting process uses timestamp comparison to build the evolution chain of parameter versions, providing a time sequence basis for subsequent analysis. By traversing the ordered version sequence, the system can track the change history and effects of parameters.
[0058] The calculation of parameter source credibility adopts an effect-based evaluation method. The system tracks the historical change records of each source and evaluates the system performance improvement after the change. The source with greater performance improvement and higher improvement frequency obtains higher credibility. The credibility calculation considers multiple performance indicators, including response time, throughput, resource utilization, etc.
[0059] The risk value calculation adopts the weighted summation method. First, the change ratio of the three parameters is calculated, and the change ratio is calculated by the difference between the new parameter value and the current value. This relative value calculation method can eliminate the influence of the difference in parameter magnitude. Each change ratio is multiplied by the credibility of the corresponding parameter source to obtain the weighted change ratio.
[0060] The summation of weighted change ratios takes into account the overall impact of the parameters. Changes in the three parameters are usually related, for example, an increase in the number of core threads often requires a corresponding adjustment of the maximum number of threads. The risk value obtained by summing up the calculations comprehensively reflects the overall risk level of this change.
[0061] This step solves many problems in traditional thread pool configuration: lack of basis for parameter adjustment, difficulty in assessing change risk, unclear credibility of parameter sources, etc. Through a systematic calculation method, decision support for parameter adjustment is provided.
[0062] The technical effects include: parameter changes are more controllable; risk assessment is more accurate; parameter sources are more reliable; and configuration adjustments are more reasonable. This method provides basic support for the intelligent management of thread pools, improving the reliability and performance optimization of the system. Especially in large-scale distributed systems, it shows significant practical value. Practice shows that thread pool configuration management based on this method can effectively reduce system failure rate and improve service quality.
[0063] Step S102: Analyze the correspondence between the effective time of each parameter and the system load in the historical version library to establish the optimal time window for parameter change. When the risk value is lower than the threshold and is in the optimal time window, determine the adjustment step size according to the credibility of the parameter source, calculate the new number of core threads, maximum number of threads and queue capacity according to the current parameter value, and record the new effective time, parameter source and parameter value in the version library after the parameter adjustment is completed;
[0064] Optionally, in this embodiment, this step describes the execution process of adjusting the thread pool parameters, and ensures the safety and effectiveness of parameter changes through load analysis and multiple constraints. This process combines the technical methods of timing analysis and parameter calculation.
[0065] The determination of the optimal time window is based on the analysis of system load characteristics. The system first collects historical load data, including CPU usage, memory usage, IO status and other indicators, and identifies the periodic pattern of the load through time series analysis. After the load data is normalized, the time series analysis algorithm is used to extract the fluctuation pattern and divide the time axis into peak period, stable period and trough period.
[0066] The system associates and analyzes historical parameter change records with load data. By counting the success rate and impact range of parameter changes in different time periods, a mapping relationship between change time and effect is established. This association analysis takes into account the stability cycle after the change, and builds a prediction model through regression analysis to screen out the time interval with the highest change success rate.
[0067] The triggering of parameter adjustment relies on dual condition judgment. First, check whether the risk value is lower than the preset threshold, which is determined according to the importance and fault tolerance of the system. At the same time, check whether the current time is within the optimal change window. Only when these two conditions are met can the parameter adjustment be performed. This dual verification mechanism significantly improves the security of the change.
[0068] The calculation of the adjustment step size adopts an adaptive method. The system sets the reference step size based on the credibility of the parameter source. The higher the credibility, the larger the adjustment range allowed. The step size calculation also takes into account the stability requirements of the system, and adjusts the final change range through dynamic factors to ensure that the system can smoothly transition to the new parameter configuration.
[0069] The calculation of new parameter values follows strict constraints. The system first verifies the logical relationship between parameters to ensure that the number of core threads does not exceed the maximum number of threads and the queue capacity matches the system memory limit. The parameter calculation process adopts a progressive adjustment strategy, limiting the maximum range of a single adjustment through a preset safety interval.
[0070] The update of the version library record adopts atomic operation. The system generates a new version record, which contains the precise effective timestamp, parameter source identifier and complete parameter value set. The persistence of version record ensures the traceability of parameter changes and provides a basis for possible rollback operations.
[0071] This step solves many difficulties in traditional thread pool tuning: improper parameter adjustment timing leading to system fluctuations, excessive adjustment causing performance problems, lack of tracking of parameter changes, etc. Through systematic analysis and control methods, safe and controllable parameter adjustment is achieved.
[0072] The technical effect is significant: parameter adjustment is more accurate; system stability is improved; the change process is traceable; and the optimization effect is predictable. This method is particularly suitable for production systems with high stability requirements, and can achieve performance optimization while ensuring service quality. Practice has proved that using this method for thread pool optimization can effectively improve system resource utilization and reduce operation and maintenance risks.
[0073] Step S103: Continuously collect performance indicators and associate them with corresponding parameter versions. When the performance indicators deteriorate, locate the last stable parameter value and effective time through the version library records, and perform rollback accordingly.
[0074] Optionally, in this embodiment, this step describes the monitoring and rollback mechanism after the thread pool parameters are changed, and through continuous performance indicator collection and intelligent analysis, automatic protection measures are implemented when system performance is abnormal.
[0075] Performance indicators are collected using distributed probe technology to continuously collect key monitoring data without affecting the normal operation of the system. The collected indicators include thread pool core indicators (number of active threads, total number of threads, number of waiting tasks), system resource indicators (CPU usage, memory usage, GC status) and business indicators (request response time, throughput, error rate). The collection frequency is dynamically adjusted according to the system load to ensure the real-time and accuracy of the data.
[0076] The association between performance data and parameter versions uses a time series mapping method. The system establishes a correspondence between the collected performance indicators and the parameter records in the version library according to the timestamp, forming a complete performance evaluation data chain. This association mechanism enables the system to accurately track the impact of parameter changes on performance and provide data support for subsequent decision-making.
[0077] The determination of performance degradation is based on multi-dimensional analysis. The system first pre-processes the collected performance indicators and eliminates data noise through methods such as moving average. Then, the double exponential smoothing algorithm is used to perform trend analysis on the processed data to predict short-term performance trends. The system also maintains a performance baseline. When the deviation of the actual performance indicator from the baseline exceeds the preset threshold and the trend continues to deteriorate, the performance degradation determination is triggered.
[0078] The rollback target version is selected using a retrospective analysis method. Starting from the current version, the system analyzes the performance data of historical versions one by one to find the most recent stable running version. The criteria for determining a stable version include multiple dimensions such as the stability of performance indicators, the rationality of system resource usage, and the compliance of business indicators. This multi-dimensional evaluation ensures the reliability of the rollback target.
[0079] The rollback operation is performed using atomic transaction processing. The system first verifies the validity of the target version parameters, and then completes the parameter switch and version record update in one transaction. During the rollback process, the system continuously monitors performance indicators to ensure the smoothness of the switch process. The relevant information of the rollback operation is marked in the new version record to facilitate subsequent analysis and auditing.
[0080] This step solves many problems in traditional thread pool management: performance degradation is difficult to detect in time, parameter change effects are difficult to evaluate, and system recovery cycles are long. Through automated monitoring and rollback mechanisms, the system's self-healing capabilities are significantly improved.
[0081] The technical effects include: rapid discovery of performance anomalies; shortened system recovery time; reduced operation and maintenance costs; and improved service reliability. This method is particularly suitable for critical business systems that require high availability, and can quickly recover to a stable state when performance problems occur. Practice has shown that this method can reduce the average recovery time of system failures by more than 50%, significantly improving the availability of services.
[0082] From the above description, it can be seen that the thread pool dynamic adjustment method based on the configuration center provided in the embodiment of the present application can initialize the thread pool parameters, sort the historical parameter versions by the effective time, calculate the credibility of each parameter source based on the change effect of different parameter sources, and sum up the three weighted change ratios to obtain the risk value; analyze the correspondence between the effective time of each parameter in the historical version library and the system load to establish the optimal time window for parameter change; when the risk value is lower than the threshold and is in the optimal time window, determine the adjustment step according to the credibility of the parameter source, continuously collect performance indicators and associate them with the corresponding parameter version, and when the performance indicator deteriorates, locate the last stable parameter value and effective time through the version library record, and perform rollback accordingly, thereby effectively improving the efficiency and accuracy of dynamic adjustment of the thread pool.
[0083] In one embodiment of the thread pool dynamic adjustment method based on the configuration center of the present application, see Figure 2 , and can also include the following:
[0084] Step S201: query the effective time of the parameter version in the version library, build an ordered linked list according to the timestamp of the effective time, use the time difference between adjacent versions as a weight factor, calculate the system throughput, average response time and thread pool usage in each time period, and obtain the performance score through normalization;
[0085] Step S202: Count the number of changes of each parameter source in the historical version and the corresponding performance score, calculate the proportion of performance improvement caused by the parameter change of the source, and use the product of the performance improvement amplitude and the improvement proportion as the credibility coefficient of the parameter source.
[0086] Optionally, in this embodiment, these two steps describe a parameter source credibility assessment mechanism based on historical data, and achieve quantitative assessment of parameter adjustment sources through performance indicator analysis and weight calculation.
[0087] First, in S201, the system obtains the parameter version record from the version library and extracts the effective time information. The effective time is stored in a standard timestamp format with millisecond accuracy. The system builds a bidirectional linked list structure based on the timestamp. Each node contains version information and timestamps, and the nodes are associated with each other through pointers. The time difference between adjacent versions is calculated by timestamp subtraction, and the difference is used as a weight factor for subsequent performance evaluation.
[0088] The performance indicators are calculated using the time window statistical method. The system throughput is calculated by the number of tasks completed per unit time; the average response time is calculated by taking the arithmetic mean based on the start and end timestamps of the task; and the thread pool utilization is calculated by the ratio of the number of active threads to the maximum number of threads. These original indicators are time-weighted averaged to eliminate the impact of uneven sampling time.
[0089] Normalization processing uses the Min-Max normalization method to convert performance indicators of different dimensions to the [0,1] interval. The converted indicators are weighted and summed to obtain a comprehensive performance score. The weight distribution takes into account the importance and reliability of the indicators, and the optimal weight combination is determined by the principal component analysis method.
[0090] In S202, the system performs statistical analysis on each parameter source. The change count is implemented using a counter, which is accumulated by traversing the version records. The performance score comparison is based on adjacent versions. When the performance score of the new version is higher than that of the old version, it is recorded as a performance improvement. The improvement ratio is obtained by dividing the number of improvements by the total number of changes.
[0091] The calculation of the performance improvement takes into account the impact of the change. The system calculates the relative growth rate of the performance score, expressed as the ratio of the difference to the baseline value. The relative growth rate is multiplied by the time weight factor to obtain the weighted improvement. This calculation method emphasizes the effect of changes that are sustainable.
[0092] The calculation of the credibility coefficient combines the two dimensions of frequency and effect. The performance improvement is multiplied by the improvement ratio to obtain the credibility coefficient that reflects the overall reliability of the parameter source. This calculation method takes into account both the success rate of the change and the significance of the effect of the change.
[0093] These two steps solve the key problems in traditional thread pool optimization: the reliability of parameter sources is difficult to quantify, historical data is not fully utilized, and performance evaluation standards are not unified. Through systematic data analysis and evaluation methods, an objective credibility evaluation system is established.
[0094] The technical effect is significant: parameter source evaluation is more objective; performance measurement is more accurate; historical data is more fully utilized; and optimization decisions are more reliable. This method is particularly suitable for large-scale systems that run for a long time, and can continuously optimize decision-making quality through the accumulation of historical data. Practice has proved that using this method for parameter tuning can significantly improve the optimization success rate and reduce the risk of system fluctuations.
[0095] In one embodiment of the thread pool dynamic adjustment method based on the configuration center of the present application, see Figure 3 , and can also include the following:
[0096] Step S301: Obtain the target values of the number of core threads, the maximum number of threads, and the queue capacity in the change parameter group, and divide them by the corresponding parameter values currently in effect to obtain the change ratios of the three parameters. Standardize each change ratio to a value in the interval [-1, 1], taking a positive value for an increasing trend and a negative value for a shrinking trend. The larger the absolute value of the change ratio, the larger the change range.
[0097] Step S302: Read the credibility coefficient of the parameter source that initiated the change from the version library, multiply the standardized change ratios of the three parameters by the credibility coefficients to obtain weighted change values, perform square sum operations on the three weighted change values and take square roots to obtain the Euclidean distance as the final risk measurement value, wherein a larger risk measurement value indicates a higher overall change risk.
[0098] Optionally, in this embodiment, these two steps describe the quantitative assessment process of the risk of thread pool parameter changes, and through change ratio analysis and risk metric calculation, an accurate measurement of parameter adjustment risks is achieved.
[0099] In S301, the system first obtains the target value configuration of the parameter group to be changed. The parameter acquisition process uses atomic reading to ensure the consistency of three key parameters (core thread number, maximum thread number, and queue capacity). The system reads the effective parameter value from the current operating environment as a benchmark and uses division to calculate the change ratio. This relative value calculation method eliminates the impact of parameter magnitude differences.
[0100] The standardization of the change ratio adopts the segmented mapping method. The system first determines the change trend and determines the growth or contraction direction by comparing the target value with the current value. For the growth trend, the change ratio is mapped to the (0,1) interval; for the contraction trend, it is mapped to the [-1,0) interval. The mapping process uses nonlinear transformation to ensure a reasonable correspondence between the change amplitude and the standardized value.
[0101] In S302, the system reads the credibility coefficient of the parameter source from the version library. The credibility coefficient reading adopts a cache mechanism to reduce database access overhead. The system uses the credibility coefficient as a weight factor and multiplies it with the standardized change ratio to obtain a weighted change value that takes into account the reliability of the parameter source.
[0102] The risk metric is calculated using the Euclidean distance formula. The system treats the three weighted change values as coordinate components in three-dimensional space, and calculates the Euclidean distance from the point to the origin to obtain a scalar value that reflects the overall change risk. This calculation method takes into account the synergistic effect of parameter changes and can effectively reflect the comprehensive risk of multi-parameter linkage changes.
[0103] The calculation process of Euclidean distance includes square sum operation and square root extraction. The square operation strengthens the impact of large changes, making the risk metric more sensitive to significant changes. At the same time, the square sum form ensures that the change directions of different parameters will not offset each other, and truly reflects the scale of the overall change.
[0104] These two steps solve many difficulties in traditional thread pool parameter adjustment: the risk of change is difficult to quantify, the synergy of multiple parameters is difficult to evaluate, and the reliability of parameter sources is difficult to comprehensively consider. Through mathematical analysis methods, an objective risk assessment system is established.
[0105] The technical effect is remarkable: risk assessment is more accurate; parameter adjustment is more controllable; change decision-making is more scientific; system stability is more guaranteed. This method is particularly suitable for core business systems with high stability requirements, and can effectively control risks during parameter optimization. Practice has proved that the use of this method for parameter adjustment can reduce the system failure rate caused by improper configuration by more than 80%.
[0106] The innovation of the method lies in the unified measurement of multi-dimensional change impacts through Euclidean distance and the introduction of a credibility weight mechanism, so that risk assessment takes into account both the characteristics of the change itself and the reliability of the source of the change. This comprehensive assessment method provides reliable decision support for parameter adjustment.
[0107] The calculated results of the risk metric can be directly used in the automated decision-making system to automate risk control by comparing it with the preset threshold. This mechanism significantly improves the autonomy of the system and reduces the need for human intervention.
[0108] In one embodiment of the thread pool dynamic adjustment method based on the configuration center of the present application, see Figure 4 , and can also include the following:
[0109] Step S401: Obtain system load data from the operation and maintenance platform, align CPU usage, memory usage, and disk IO data in time series, extract the periodic characteristics of the system load through Fourier transform, identify the time distribution law of load peaks and troughs, and divide the load curve into peak period, stable period, and trough period according to the fluctuation amplitude;
[0110] Step S402: traverse the parameter change records in the version library, calculate the system stability index within a complete cycle after each parameter change, map the change time point to the corresponding interval of the load curve, use regression analysis method to establish a corresponding relationship model between the parameter change success rate and the load interval, and select the time interval with the highest success rate as the optimal change window.
[0111] Optionally, in this embodiment, these two steps describe the process of system load analysis and optimal change time window determination, and intelligent selection of parameter change timing is achieved through time series data analysis and statistical modeling.
[0112] In S401, the system first establishes a data channel with the operation and maintenance platform, and uses a push-pull method to obtain load data. Data collection covers multiple system indicators, including CPU usage (user state, system state, IO wait), memory usage (total, used, cache), disk IO status (read and write rate, wait time), etc. The collected raw data is preprocessed to eliminate outliers and supplement missing values.
[0113] Time series alignment uses a time window aggregation method. The system groups the sampled data of different indicators by timestamp, unifies the sampling frequency through an interpolation algorithm, and ensures the time consistency of the data. The aligned data forms a multidimensional time series, with each dimension representing a system indicator.
[0114] Fourier transform analysis uses the Fast Fourier Transform (FFT) algorithm. The system converts time series data into the frequency domain and extracts the main frequency components. By analyzing the spectrum characteristics, the main and secondary cycles of the system load are identified. The frequency domain analysis results are reconstructed into the time domain signal through inverse transformation to obtain the denoised load curve.
[0115] The load interval division adopts the adaptive threshold method. The system sets the dynamic threshold boundary based on the mean and standard deviation of the load curve. The period above the upper threshold is divided into the peak period, the period below the lower threshold is divided into the valley period, and the middle area is the stable period. The calculation of the threshold takes into account the historical operation characteristics of the system.
[0116] In S402, the system analyzes the parameter change records in the version library. The change records are traversed using a time window sliding method, extracting data for a complete cycle each time. System stability indicators include multiple dimensions such as service response time, error rate, and resource utilization.
[0117] The stability assessment adopts a comprehensive scoring mechanism. The system sets a target range for each indicator and calculates the degree of conformity between the actual value and the target range. The overall stability score is obtained through weighted average. The weight distribution reflects the importance of different indicators.
[0118] The interval mapping of the change time adopts the pattern matching method. The system aligns the change time point with the time axis of the load curve and determines the load interval to which the time point belongs. Through statistical analysis, the success rate of the change in each interval is calculated.
[0119] The regression analysis uses a generalized linear model. The system uses the load interval characteristics as the independent variable and the change success rate as the dependent variable to establish a prediction model. The model training uses the cross-validation method to avoid overfitting. Through model prediction, the expected success rate of different time intervals is calculated.
[0120] These two steps solve the key problems in traditional parameter adjustment: arbitrary selection of change timing, insufficient knowledge of load characteristics, and difficulty in predicting success rate. Through data-driven analysis methods, scientific selection of change timing is achieved.
[0121] The technical effect is significant: the success rate of changes is improved; the system stability is enhanced; the operation and maintenance efficiency is improved; and the risk controllability is enhanced. This method is particularly suitable for production systems with obvious load periodicity and can significantly improve the effect of parameter adjustment. Practice has proved that the success rate of parameter adjustment can be increased to more than 90% by using this method to select the time of change.
[0122] The innovation of the method lies in the combination of frequency domain analysis and statistical modeling. Through multi-dimensional data analysis, the system operation rules can be accurately grasped, providing a scientific basis for time selection for parameter adjustment. This method not only improves the success rate of changes, but also reduces the dependence on the experience of operation and maintenance personnel.
[0123] In one embodiment of the thread pool dynamic adjustment method based on the configuration center of the present application, see Figure 5 , and can also include the following:
[0124] Step S501: Read the risk threshold set by the configuration center, compare the calculated risk value with the threshold, and obtain the current timestamp to determine whether it is within the optimal change window interval. Confirm whether the parameter adjustment conditions are met by performing an AND operation on the risk value comparison result and the time window judgment result;
[0125] Step S502: Calculate the maximum step interval of this adjustment based on the credibility coefficient of the parameter source, constrain the parameter adjustment range in the change request, limit the adjustment range to the maximum step interval, perform truncation processing on the adjustment value exceeding the interval, and generate the final parameter adjustment value.
[0126] Optionally, in this embodiment, these two steps describe the risk control and execution process of parameter adjustment, and through multiple constraints and adaptive restrictions, safe and controllable dynamic adjustment of parameters is achieved.
[0127] In S501, the system first reads the risk threshold configuration from the configuration center. The configuration reading adopts a distributed configuration management mechanism and supports dynamic refresh. The risk threshold is set based on the stability requirements of the system and can be dynamically adjusted according to the business scenario. The system compares the calculated risk value with the threshold value to obtain a Boolean comparison result.
[0128] The time window judgment uses an interval matching algorithm. The system obtains the current system timestamp and converts it to the UTC time of the standard time zone to eliminate the impact of time zone differences. By comparing it with the pre-identified optimal change window, it determines whether the current time falls within the appropriate change interval.
[0129] The conditional judgment adopts logical AND operation. The system performs Boolean algebra operation on the risk value comparison result and the time window judgment result. Only when both conditions are met at the same time, the parameter adjustment is allowed. This double verification mechanism effectively prevents parameter changes at inappropriate times.
[0130] In S502, the system calculates the adjustment step length based on the credibility coefficient of the parameter source. The step length calculation adopts an adaptive algorithm. The higher the credibility, the larger the allowed adjustment step length. The system converts the credibility coefficient into a specific step length limit value through a nonlinear mapping function.
[0131] The determination of the maximum step length interval takes into account multiple factors. The system sets the basic step length and then dynamically adjusts it based on the credibility coefficient. The adjustment process adopts the proportional control principle to ensure the continuity and smoothness of the step length change. At the same time, the system will consider the historical adjustment records to avoid drastic changes in the short term.
[0132] The constraint of parameter adjustment value adopts boundary checking and truncation. The system compares the adjustment range in the change request with the calculated maximum step range. For adjustment values that exceed the range, the system does not simply reject them, but performs intelligent truncation to limit them to a reasonable range.
[0133] The truncation process uses a smooth transition method. The system normalizes the adjustment values that are out of range to ensure that the adjusted parameter values fall within the allowable range while maintaining the directionality of the original adjustment as much as possible. This processing method ensures safety while retaining the adjustment intention to the greatest extent.
[0134] These two steps solve many difficulties in traditional parameter adjustment: inaccurate control of adjustment timing, difficulty in controlling adjustment range, fuzzy safety boundaries, etc. Through a sophisticated control mechanism, parameter adjustment is standardized and safe.
[0135] The technical effect is significant: parameter adjustment is safer; system stability is improved; the adjustment process is controllable; and operation and maintenance efficiency is improved. This method is particularly suitable for core business systems with high stability requirements, and can achieve dynamic optimization of parameters while ensuring system stability. Practice has proved that the use of this method for parameter adjustment can reduce the system failure rate caused by parameter changes by more than 95%.
[0136] The innovation of the method lies in the organic combination of multiple constraint mechanisms such as risk control, time window and step size limit, and the safety of parameter adjustment is ensured through scientific control strategies. At the same time, flexible control of parameter adjustment is achieved through adaptive step size calculation and smooth truncation processing. This comprehensive control method provides a reliable execution framework for dynamic parameter adjustment.
[0137] In one embodiment of the thread pool dynamic adjustment method based on the configuration center of the present application, see Figure 6 , and can also include the following:
[0138] Step S601: multiply the maximum adjustment step by the currently effective parameter value to obtain the parameter adjustment amount, add the adjustment amount to the current parameter value to calculate a new parameter combination, perform a legality check on the three parameters of the number of core threads, the maximum number of threads and the queue capacity, and ensure that the number of core threads does not exceed the maximum number of threads, and the new parameter combination meets the basic constraints of the thread pool operation;
[0139] Step S602: Construct a version record object, mark the initiator of the parameter change as the parameter source, generate a Unix timestamp as the effective time, fill the verified number of core threads, maximum number of threads and queue capacity as parameter values, and submit the new parameter version data through the write interface of the version library.
[0140] Optionally, in this embodiment, these two steps describe the specific execution and version recording process of thread pool parameter adjustment, and ensure the correctness and traceability of parameter adjustment through parameter legitimacy verification and version management mechanism.
[0141] In S601, the system first calculates the specific parameter adjustment amount. The adjustment amount calculation adopts the proportional control method, multiplying the maximum adjustment step by the current parameter value. This relative value calculation method can adapt to parameters of different magnitudes to ensure that the relative amplitude of the adjustment remains consistent. The calculation process uses high-precision floating-point operations to avoid precision loss.
[0142] Parameter superposition adopts atomic operation mode. The system reads the snapshot value of the current parameter and superimposes the calculated adjustment amount on the reference value. The superposition process takes into account the value characteristics of the parameter. For integer type parameters, the rounding down method is used to ensure the validity of the result.
[0143] The validity check uses multiple constraint verification. First, check the basic constraints of the parameters to ensure that all parameter values are positive. Then verify the relationship constraints between the parameters. The number of core threads must be less than or equal to the maximum number of threads. Finally, check the operation constraints of the thread pool, including the ratio between the queue capacity and the number of threads, resource limits, etc.
[0144] In S602, the system constructs a version record object in a standard format. The record object contains complete metadata information, including parameter source identification, timestamp, parameter value, etc. The record of parameter source adopts a unified identification system to support the identification and tracking of multiple source types.
[0145] Timestamp generation uses the UTC time standard. The system calls the underlying clock service to obtain the current time and converts it to the Unix timestamp format. The timestamp accuracy reaches the millisecond level, ensuring the timing accuracy of version records. For systems deployed across time zones, the UTC time is used uniformly to avoid the complexity of time zone conversion.
[0146] The parameter values are filled in by deep copying. The system copies the verified parameter values to the version record object to ensure the integrity and independence of the data. The filling process includes the complete attribute set of the parameter, which is convenient for subsequent version tracking and rollback operations.
[0147] The version library is written using transactional operations. The system submits version data through a unified write interface, and the writing process includes a complete transaction protection mechanism. If an exception occurs during the writing process, the system will automatically roll back to ensure the consistency of the version data.
[0148] These two steps solve the key problems in traditional parameter adjustment: parameter constraints are difficult to guarantee, version management is not standardized, and the adjustment process cannot be traced. Through strict verification mechanisms and perfect version management, the standardization and controllability of parameter adjustment are achieved.
[0149] The technical effect is significant: improved parameter correctness; standardized version management; enhanced traceability; and improved operation and maintenance efficiency. This method is particularly suitable for dynamic systems that require frequent parameter adjustments, and can ensure the security and traceability of the adjustment process. Practice has proved that using this method for parameter adjustment can reduce system anomalies caused by inconsistent parameters by more than 99%.
[0150] In one embodiment of the thread pool dynamic adjustment method based on the configuration center of the present application, see Figure 7 , and can also include the following:
[0151] Step S701: Use the performance collection probe to regularly obtain the number of active threads, total number of threads, and number of waiting tasks in the thread pool, associate the sampled data with the effective parameter version in the version library according to the timestamp, calculate the performance indicator fluctuation trend within the sampling window, predict the performance curve trend through the double exponential smoothing algorithm, and determine the performance degradation state according to the deviation degree between the prediction result and the performance benchmark;
[0152] Step S702: Traverse the parameter records in the version library from the current version forward, read the performance indicator data associated with each historical version, extract the parameter version with stable performance indicators and meeting the target requirements as the rollback target, set the parameter combination of the version record to the current effective value, generate a new version record and mark it as a rollback operation.
[0153] Optionally, in this embodiment, these two steps describe the complete process of thread pool performance monitoring and parameter rollback, and automatic optimization and recovery of system performance are achieved through real-time performance analysis and intelligent version selection.
[0154] In S701, the performance collection probe uses a lightweight sampling mechanism. The probe obtains the core operating indicators of the thread pool through the JMX interface, including the number of active threads, the total number of threads, the number of waiting tasks, etc. The sampling process uses an asynchronous method to minimize the impact on business threads. The sampling frequency is dynamically adjusted according to the system load to ensure data accuracy while avoiding oversampling.
[0155] Time association adopts the principle of nearest matching. The system matches the timestamp of the sampled data with the parameter version time in the version library to establish the corresponding relationship between performance data and parameter version. The association process takes into account the time delay of parameter effectiveness to ensure the accuracy of data association.
[0156] The fluctuation trend analysis of performance indicators adopts the sliding window method. The system calculates the statistical characteristics of performance indicators within a fixed-size time window, including mean, variance, coefficient of variation, etc. The dynamic change trend of indicators is captured by sliding the window.
[0157] The double exponential smoothing algorithm is used for performance forecasting. The algorithm generates short-term performance forecasts by taking a weighted average of historical data and taking into account both the horizontal and trend terms of the data. The smoothing parameters of the algorithm are dynamically adjusted according to the forecast accuracy to improve the accuracy of the forecast.
[0158] Performance degradation judgment adopts multi-dimensional evaluation. The system compares the prediction results with the preset performance benchmark and determines the performance status through the set judgment rules. The judgment process considers the importance of indicators and fluctuation tolerance to avoid misjudgment.
[0159] In S702, the version traversal adopts an efficient retrieval mechanism. The system starts from the current version and traverses the historical version records in reverse chronological order. The traversal process adopts a batch reading strategy to optimize IO performance. At the same time, the system maintains the version index to speed up the retrieval efficiency.
[0160] The analysis of performance indicators uses statistical significance tests. The system performs statistical analysis on the performance data associated with each historical version to evaluate the stability and compliance of the indicators. The analysis process considers multiple statistical characteristics of the indicators to ensure that the selected version has good performance.
[0161] The selection of rollback targets adopts a multi-objective optimization method. The system comprehensively considers factors such as the stability and satisfaction of performance indicators and the time span of versions, and selects the optimal rollback version through a weighted scoring mechanism. The selection process gives priority to the most recent version that meets the conditions to reduce the impact of changes caused by rollback.
[0162] Parameter rollback uses atomic operations. The system sets the parameter combination of the selected version through the configuration interface of the thread pool to ensure the atomicity of parameter changes. The rollback process includes complete parameter validity verification to prevent parameter errors caused by rollback.
[0163] These two steps solve the key problems in traditional performance management: performance degradation is difficult to detect in time, rollback version selection is difficult, and rollback operations are risky. Through automated monitoring and analysis and intelligent version selection, automatic repair of system performance is achieved.
[0164] The technical effect is remarkable: accurate performance monitoring; rapid discovery of degradation; intelligent and controllable rollback; and improved recovery efficiency. This method is particularly suitable for online service systems with high performance requirements, and can achieve rapid discovery and automatic recovery of performance problems. Practice has proved that using this method for performance management can shorten the average recovery time of performance problems by more than 80%.
[0165] In order to effectively improve the efficiency and accuracy of thread pool dynamic adjustment, the present application provides an embodiment of a thread pool dynamic adjustment device based on a configuration center for implementing all or part of the content of the thread pool dynamic adjustment method based on a configuration center, see Figure 8 The thread pool dynamic adjustment device based on the configuration center specifically includes the following contents:
[0166] The risk value determination module 10 is used to initialize thread pool parameters, wherein the parameters include the number of core threads, the maximum number of threads, and the thread queue capacity. The version library of the parameters records the effective time, the parameter source, and the parameter value. The historical parameter versions are sorted by the effective time, and the credibility of each parameter source is calculated based on the change effect of different parameter sources; the difference ratio between the number of core threads after the change and the current parameter value, the difference ratio between the maximum number of threads after the change and the current parameter value, and the difference ratio between the queue capacity after the change and the current parameter value are multiplied by the credibility of the corresponding parameter source to obtain a weighted change ratio, and the three weighted change ratios are summed to obtain a risk value;
[0167] The parameter adjustment module 20 is used to analyze the corresponding relationship between the effective time of each parameter and the system load in the historical version library to establish the optimal time window for parameter change. When the risk value is lower than the threshold and is in the optimal time window, the adjustment step is determined according to the credibility of the parameter source, and the new number of core threads, maximum number of threads and queue capacity are calculated according to the current parameter value. After the parameter adjustment is completed, the new effective time, parameter source and parameter value are recorded in the version library;
[0168] The parameter rollback module 30 is used to continuously collect performance indicators and associate them with corresponding parameter versions. When the performance indicators deteriorate, the last stable parameter value and effective time are located through the version library records, and rollback is performed accordingly.
[0169] From the above description, it can be seen that the thread pool dynamic adjustment device based on the configuration center provided in the embodiment of the present application can initialize the thread pool parameters, sort the historical parameter versions by effective time, calculate the credibility of each parameter source based on the change effect of different parameter sources, and sum up the three weighted change ratios to obtain the risk value; analyze the correspondence between the effective time of each parameter in the historical version library and the system load to establish the optimal time window for parameter change; when the risk value is lower than the threshold and is in the optimal time window, determine the adjustment step according to the credibility of the parameter source, continuously collect performance indicators and associate them with the corresponding parameter version, and when the performance indicator deteriorates, locate the last stable parameter value and effective time through the version library record, and perform rollback accordingly, thereby effectively improving the efficiency and accuracy of dynamic adjustment of the thread pool.
[0170] From the hardware level, in order to effectively improve the efficiency and accuracy of dynamic adjustment of the thread pool, the present application provides an embodiment of an electronic device for implementing all or part of the content of the thread pool dynamic adjustment method based on the configuration center, and the electronic device specifically includes the following content:
[0171] Processor, memory, communication interface and bus; wherein the processor, memory and communication interface communicate with each other through the bus; the communication interface is used to realize information transmission between the thread pool dynamic adjustment device based on the configuration center and the core business system, user terminal and related database and other related devices; the logic controller can be a desktop computer, a tablet computer and a mobile terminal, etc., but the present embodiment is not limited thereto. In the present embodiment, the logic controller can be implemented with reference to the embodiment of the thread pool dynamic adjustment method based on the configuration center and the embodiment of the thread pool dynamic adjustment device based on the configuration center in the embodiment, and the contents thereof are incorporated herein, and the repeated parts are not repeated.
[0172] It is understandable that the user terminal may include a smart phone, a tablet electronic device, a network set-top box, a portable computer, a desktop computer, a personal digital assistant (PDA), a vehicle-mounted device, a smart wearable device, etc. Among them, the smart wearable device may include smart glasses, a smart watch, a smart bracelet, etc.
[0173] In practical applications, part of the thread pool dynamic adjustment method based on the configuration center can be executed on the electronic device side as described above, or all operations can be completed in the client device. The specific selection can be based on the processing capability of the client device and the limitations of the user's usage scenario. This application does not limit this. If all operations are completed in the client device, the client device may also include a processor.
[0174] The client device may have a communication module (i.e., a communication unit) that can communicate with a remote server to achieve data transmission with the server. The server may include a server on the task scheduling center side, and other implementation scenarios may also include a server on an intermediate platform, such as a server on a third-party server platform that has a communication link with the task scheduling center server. The server may include a single computer device, or a server cluster consisting of multiple servers, or a server structure of a distributed device.
[0175] Fig. 9 FIG. 9 is a schematic block diagram of the system structure of the electronic device 9600 according to an embodiment of the present application. Fig. 9 As shown, the electronic device 9600 may include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. It is worth noting that Fig. 9 is exemplary; other types of structures may also be used to supplement or replace this structure to implement telecommunication functions or other functions.
[0176] In one embodiment, the thread pool dynamic adjustment method function based on the configuration center can be integrated into the central processing unit 9100. The central processing unit 9100 can be configured to perform the following control:
[0177] Step S101: Initialize thread pool parameters, including the number of core threads, the maximum number of threads, and the thread queue capacity. The version library of the parameters records the effective time, the parameter source, and the parameter value. The historical parameter versions are sorted by the effective time, and the credibility of each parameter source is calculated based on the change effect of different parameter sources; the difference ratio between the core thread number after the change and the current parameter value, the difference ratio between the maximum thread number after the change and the current parameter value, and the difference ratio between the queue capacity after the change and the current parameter value are multiplied by the credibility of the corresponding parameter source to obtain a weighted change ratio, and the three weighted change ratios are summed to obtain a risk value;
[0178] Step S102: Analyze the correspondence between the effective time of each parameter and the system load in the historical version library to establish the optimal time window for parameter change. When the risk value is lower than the threshold and is in the optimal time window, determine the adjustment step size according to the credibility of the parameter source, calculate the new number of core threads, maximum number of threads and queue capacity according to the current parameter value, and record the new effective time, parameter source and parameter value in the version library after the parameter adjustment is completed;
[0179] Step S103: Continuously collect performance indicators and associate them with corresponding parameter versions. When the performance indicators deteriorate, locate the last stable parameter value and effective time through the version library records, and perform rollback accordingly.
[0180] From the above description, it can be seen that the electronic device provided in the embodiment of the present application initializes the thread pool parameters, sorts the historical parameter versions by the effective time, calculates the credibility of each parameter source based on the change effect of different parameter sources, and sums the three weighted change ratios to obtain the risk value; analyzes the correspondence between the effective time of each parameter in the historical version library and the system load to establish the optimal time window for parameter change; when the risk value is lower than the threshold and is in the optimal time window, determines the adjustment step according to the credibility of the parameter source, continuously collects performance indicators and associates them with the corresponding parameter version, and when the performance indicator deteriorates, locates the last stable parameter value and effective time through the version library record, and performs rollback accordingly, thereby effectively improving the efficiency and accuracy of dynamic adjustment of the thread pool.
[0181] In another embodiment, the thread pool dynamic adjustment device based on the configuration center can be configured separately from the central processing unit 9100. For example, the thread pool dynamic adjustment device based on the configuration center can be configured as a chip connected to the central processing unit 9100, and the thread pool dynamic adjustment method function based on the configuration center can be implemented through the control of the central processing unit.
[0182] like Fig. 9 As shown, the electronic device 9600 may also include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is worth noting that the electronic device 9600 does not necessarily have to include Fig. 9 In addition, the electronic device 9600 may also include Fig. 9 For components not shown, reference may be made to the prior art.
[0183] like Fig. 9 As shown, the central processing unit 9100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor device and / or logic device. The central processing unit 9100 receives input and controls the operation of various components of the electronic device 9600.
[0184] The memory 9140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 9100 may execute the program stored in the memory 9140 to implement information storage or processing, etc.
[0185] The input unit 9120 provides input to the central processing unit 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to provide power to the electronic device 9600. The display 9160 is used to display display objects such as images and texts. The display may be, for example, an LCD display, but is not limited thereto.
[0186] The memory 9140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 9140 may also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application / function storage unit 9142, which is used to store application programs and function programs or processes for executing the operation of the electronic device 9600 through the central processor 9100.
[0187] The memory 9140 may also include a data storage unit 9143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 9144 of the memory 9140 may include various drivers for communication functions of the electronic device and / or for executing other functions of the electronic device (such as messaging applications, address book applications, etc.).
[0188] The communication module 9110 is a transmitter / receiver that sends and receives signals via the antenna 9111. The communication module 9110 (transmitter / receiver) is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.
[0189] Based on different communication technologies, multiple communication modules 9110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless LAN module, etc. The communication module 9110 (transmitter / receiver) is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide an audio output via the speaker 9131 and receive an audio input from the microphone 9132, thereby realizing a common telecommunication function. The audio processor 9130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 9130 is also coupled to the central processor 9100, so that recording can be performed on the local machine through the microphone 9132, and the sound stored on the local machine can be played through the speaker 9131.
[0190] The embodiments of the present application also provide a computer-readable storage medium capable of implementing all the steps in the method for dynamically adjusting a thread pool based on a configuration center in the above-mentioned embodiment, where the execution subject is a server or a client. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, all the steps in the method for dynamically adjusting a thread pool based on a configuration center in the above-mentioned embodiment are implemented. For example, when the processor executes the computer program, the following steps are implemented:
[0191] Step S101: Initialize thread pool parameters, including the number of core threads, the maximum number of threads, and the thread queue capacity. The version library of the parameters records the effective time, the parameter source, and the parameter value. The historical parameter versions are sorted by the effective time, and the credibility of each parameter source is calculated based on the change effect of different parameter sources; the difference ratio between the core thread number after the change and the current parameter value, the difference ratio between the maximum thread number after the change and the current parameter value, and the difference ratio between the queue capacity after the change and the current parameter value are multiplied by the credibility of the corresponding parameter source to obtain a weighted change ratio, and the three weighted change ratios are summed to obtain a risk value;
[0192] Step S102: Analyze the correspondence between the effective time of each parameter and the system load in the historical version library to establish the optimal time window for parameter change. When the risk value is lower than the threshold and is in the optimal time window, determine the adjustment step size according to the credibility of the parameter source, calculate the new number of core threads, maximum number of threads and queue capacity according to the current parameter value, and record the new effective time, parameter source and parameter value in the version library after the parameter adjustment is completed;
[0193] Step S103: Continuously collect performance indicators and associate them with corresponding parameter versions. When the performance indicators deteriorate, locate the last stable parameter value and effective time through the version library records, and perform rollback accordingly.
[0194] From the above description, it can be seen that the computer-readable storage medium provided in the embodiment of the present application initializes the thread pool parameters, sorts the historical parameter versions by the effective time, calculates the credibility of each parameter source based on the change effect of different parameter sources, and sums the three weighted change ratios to obtain the risk value; analyzes the correspondence between the effective time of each parameter in the historical version library and the system load to establish the optimal time window for parameter change; when the risk value is lower than the threshold and is in the optimal time window, determines the adjustment step according to the credibility of the parameter source, continuously collects performance indicators and associates them with the corresponding parameter version, and when the performance indicator deteriorates, locates the last stable parameter value and effective time through the version library record, and performs rollback accordingly, thereby effectively improving the efficiency and accuracy of dynamic adjustment of the thread pool.
[0195] The embodiments of the present application also provide a computer program product capable of implementing all steps in the method for dynamically adjusting a thread pool based on a configuration center in the above embodiment, where the execution subject is a server or a client. When the computer program / instruction is executed by a processor, the steps of the method for dynamically adjusting a thread pool based on a configuration center are implemented. For example, the computer program / instruction implements the following steps:
[0196] Step S101: Initialize thread pool parameters, including the number of core threads, the maximum number of threads, and the thread queue capacity. The version library of the parameters records the effective time, the parameter source, and the parameter value. The historical parameter versions are sorted by the effective time, and the credibility of each parameter source is calculated based on the change effect of different parameter sources; the difference ratio between the core thread number after the change and the current parameter value, the difference ratio between the maximum thread number after the change and the current parameter value, and the difference ratio between the queue capacity after the change and the current parameter value are multiplied by the credibility of the corresponding parameter source to obtain a weighted change ratio, and the three weighted change ratios are summed to obtain a risk value;
[0197] Step S102: Analyze the correspondence between the effective time of each parameter and the system load in the historical version library to establish the optimal time window for parameter change. When the risk value is lower than the threshold and is in the optimal time window, determine the adjustment step size according to the credibility of the parameter source, calculate the new number of core threads, maximum number of threads and queue capacity according to the current parameter value, and record the new effective time, parameter source and parameter value in the version library after the parameter adjustment is completed;
[0198] Step S103: Continuously collect performance indicators and associate them with corresponding parameter versions. When the performance indicators deteriorate, locate the last stable parameter value and effective time through the version library records, and perform rollback accordingly.
[0199] From the above description, it can be seen that the computer program product provided in the embodiment of the present application initializes the thread pool parameters, sorts the historical parameter versions by the effective time, calculates the credibility of each parameter source based on the change effect of different parameter sources, and sums the three weighted change ratios to obtain the risk value; analyzes the correspondence between the effective time of each parameter in the historical version library and the system load to establish the optimal time window for parameter change; when the risk value is lower than the threshold and is in the optimal time window, determines the adjustment step according to the credibility of the parameter source, continuously collects performance indicators and associates them with the corresponding parameter version, and when the performance indicator deteriorates, locates the last stable parameter value and effective time through the version library record, and performs rollback accordingly, thereby effectively improving the efficiency and accuracy of dynamic adjustment of the thread pool.
[0200] It should be understood by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0201] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (apparatus), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0202] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0203] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0204] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A thread pool dynamic adjustment method based on a configuration center, characterized in that: Applied to the configuration center, the method includes: Initialize thread pool parameters, including the number of core threads, the maximum number of threads, and the thread queue capacity. The version library of the parameters records the effective time, parameter source, and parameter value. Sort the historical parameter versions by the effective time, and calculate the credibility of each parameter source based on the change effect of different parameter sources; multiply the difference ratio between the number of core threads after the change and the current parameter value, the difference ratio between the maximum number of threads after the change and the current parameter value, and the difference ratio between the queue capacity after the change and the current parameter value by the credibility of the corresponding parameter source to obtain a weighted change ratio, and sum the three weighted change ratios to obtain a risk value; Analyze the correspondence between the effective time of each parameter and the system load in the historical version library to establish the optimal time window for parameter changes. When the risk value is lower than the threshold and is in the optimal time window, determine the adjustment step size according to the credibility of the parameter source, calculate the new number of core threads, maximum number of threads and queue capacity according to the current parameter value, and record the new effective time, parameter source and parameter value in the version library after the parameter adjustment is completed; Performance indicators are continuously collected and associated with corresponding parameter versions. When the performance indicators deteriorate, the last stable parameter value and effective time are located through the version library records, and rollback is performed accordingly.
2. The thread pool dynamic adjustment method based on the configuration center according to claim 1 is characterized in that: The historical parameter versions are sorted by effective time, and the credibility of each parameter source is calculated based on the change effect of different parameter sources, including: Query the effective time of the parameter version in the version library, build an ordered linked list based on the timestamp of the effective time, use the time difference between adjacent versions as the weight factor, calculate the system throughput, average response time and thread pool usage in each time period, and obtain the performance score through normalization; Count the number of changes in each parameter source in historical versions and the corresponding performance score, calculate the proportion of performance improvement caused by the parameter change of the source, and take the product of the performance improvement amplitude and the improvement proportion as the credibility coefficient of the parameter source.
3. The thread pool dynamic adjustment method based on the configuration center according to claim 1 is characterized in that: The weighted change ratio is obtained by multiplying the difference ratio of the core thread number after the change and the current parameter value, the difference ratio of the maximum thread number after the change and the current parameter value, and the difference ratio of the queue capacity after the change and the current parameter value by the credibility of the corresponding parameter source, and the three weighted change ratios are summed to obtain the risk value, including: Get the target values of the number of core threads, the maximum number of threads, and the queue capacity in the change parameter group, divide them by the corresponding parameter values currently in effect to get the change ratios of the three parameters, and normalize each change ratio to a value in the interval [-1,1], taking a positive value for an increasing trend and a negative value for a shrinking trend. The larger the absolute value of the change ratio, the greater the magnitude of the change. The credibility coefficient of the parameter source that initiated the change is read from the version library, the standardized change ratios of the three parameters are multiplied by the credibility coefficient to obtain the weighted change value, the three weighted change values are squared and summed, and the square root is taken to obtain the Euclidean distance as the final risk measurement value, wherein the larger the risk measurement value, the higher the overall change risk.
4. The thread pool dynamic adjustment method based on the configuration center according to claim 1 is characterized in that: The analysis of the correspondence between the effective time of each parameter in the historical version library and the system load to establish the optimal time window for parameter change includes: Obtain system load data from the operation and maintenance platform, align CPU usage, memory usage, and disk IO data in time series, extract the periodic characteristics of system load through Fourier transform, identify the time distribution pattern of load peaks and troughs, and divide the load curve into peak period, stable period, and trough period according to the fluctuation amplitude; Traverse the parameter change records in the version library, calculate the system stability index within a complete cycle after each parameter change, map the change time point to the corresponding interval of the load curve, use regression analysis method to establish the corresponding relationship model between parameter change success rate and load interval, and select the time interval with the highest success rate as the optimal change window.
5. The thread pool dynamic adjustment method based on the configuration center according to claim 1 is characterized in that: When the risk value is lower than a threshold value and is in the optimal time window, determining the adjustment step size according to the credibility of the parameter source includes: Read the risk threshold set by the configuration center, compare the calculated risk value with the threshold, and obtain the current timestamp to determine whether it is within the optimal change window. Confirm whether the parameter adjustment conditions are met by performing an AND operation on the risk value comparison result and the time window judgment result. The maximum step length interval of this adjustment is calculated based on the credibility coefficient of the parameter source, and the parameter adjustment range in the change request is constrained to be within the maximum step length interval. The adjustment value exceeding the interval is truncated to generate the final parameter adjustment value.
6. The thread pool dynamic adjustment method based on the configuration center according to claim 1 is characterized in that: The new number of core threads, maximum number of threads, and queue capacity are calculated based on the current parameter values, and the new effective time, parameter source, and parameter value are recorded in the version library after the parameter adjustment is completed, including: The maximum adjustment step is multiplied by the currently effective parameter value to obtain the parameter adjustment amount, and the adjustment amount is added to the current parameter value to calculate the new parameter combination. The three parameters of the number of core threads, the maximum number of threads, and the queue capacity are checked for legality to ensure that the number of core threads does not exceed the maximum number of threads and that the new parameter combination meets the basic constraints for the operation of the thread pool. Construct a version record object, mark the initiator of the parameter change as the parameter source, generate a Unix timestamp as the effective time, fill the verified number of core threads, maximum number of threads and queue capacity as parameter values, and submit the new parameter version data through the write interface of the version library.
7. The thread pool dynamic adjustment method based on the configuration center according to claim 1 is characterized in that: The continuous collection of performance indicators and association with corresponding parameter versions, when the performance indicators deteriorate, locate the last stable parameter value and effective time through the version library record, and perform rollback accordingly, including: Use performance collection probes to periodically obtain the number of active threads, total threads, and waiting tasks in the thread pool. Associate the sampled data with the effective parameter version in the version library according to the timestamp, calculate the fluctuation trend of performance indicators within the sampling window, and use the double exponential smoothing algorithm to predict the direction of the performance curve. Determine the performance degradation status based on the degree of deviation between the predicted results and the performance benchmark. Traverse the parameter records in the version library from the current version, read the performance indicator data associated with each historical version, extract the parameter version with stable performance indicators and meeting the target requirements as the rollback target, set the parameter combination of the version record to the current effective value, generate a new version record and mark it as a rollback operation.
8. A thread pool dynamic adjustment device based on a configuration center, characterized in that: The device comprises: A risk value determination module is used to initialize thread pool parameters, wherein the parameters include the number of core threads, the maximum number of threads, and the thread queue capacity. The version library of the parameters records the effective time, the parameter source, and the parameter value. The historical parameter versions are sorted by the effective time, and the credibility of each parameter source is calculated based on the change effect of different parameter sources; the difference ratio between the number of core threads after the change and the current parameter value, the difference ratio between the maximum number of threads after the change and the current parameter value, and the difference ratio between the queue capacity after the change and the current parameter value are multiplied by the credibility of the corresponding parameter source to obtain a weighted change ratio, and the three weighted change ratios are summed to obtain a risk value; The parameter adjustment module is used to analyze the corresponding relationship between the effective time of each parameter and the system load in the historical version library to establish the optimal time window for parameter changes. When the risk value is lower than the threshold and is in the optimal time window, the adjustment step is determined according to the credibility of the parameter source, and the new number of core threads, maximum number of threads and queue capacity are calculated according to the current parameter value. After the parameter adjustment is completed, the new effective time, parameter source and parameter value are recorded in the version library; The parameter rollback module is used to continuously collect performance indicators and associate them with the corresponding parameter versions. When the performance indicators deteriorate, the last stable parameter value and effective time are located through the version library records, and rollback is performed accordingly.
9. An electronic 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 program, the steps of the thread pool dynamic adjustment method based on the configuration center described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the thread pool dynamic adjustment method based on the configuration center described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Advertising-oriented master-slave distributed content crawling robot
CN113656673A
Parameter dynamic configuration management method and device, equipment and medium
CN115390910A