Thread pool parameter optimization method and device, equipment, storage medium and program product

By combining global search and reinforcement learning, thread pool parameters are dynamically optimized, solving the problem that thread pool parameter configuration cannot adapt to load changes and improving system response efficiency and resource utilization.

CN121542056BActive Publication Date: 2026-05-15湖南长银五八消费金融股份有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
湖南长银五八消费金融股份有限公司
Filing Date
2026-01-19
Publication Date
2026-05-15

Smart Images

  • Figure CN121542056B_ABST
    Figure CN121542056B_ABST
Patent Text Reader

Abstract

The application relates to a thread pool parameter optimization method and device, equipment, a storage medium and a program product. The method comprises the following steps: obtaining a state feature vector of a target thread pool; performing global search in a parameter space of the target thread pool based on a preset fitness function, so as to obtain an elite parameter combination, with the stage load state of the target thread pool being taken as a target; performing reinforcement learning processing in a target action space indicated by the elite parameter combination, with the state feature vector being taken as a state input, so as to obtain a parameter adjustment action for the target thread pool; and in the case that system resources of the target thread pool meet an optimization condition, applying the parameter adjustment action to the target thread pool, and performing parameter optimization on the target thread pool. The method can adapt to the dynamic change characteristics of system load and protect the quality of system services.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device, storage medium, and program product for optimizing thread pool parameters. Background Technology

[0002] In today's widely used distributed, high-concurrency server architectures, thread pools are a fundamental and core technology used to manage and reuse thread resources to handle massive concurrent task requests. The performance of thread pools directly affects the throughput, response time, and resource utilization of the entire application system.

[0003] However, the performance of a thread pool is highly dependent on the configuration of a series of key parameters, including the core thread count, maximum thread count, and work queue capacity. Currently, the common practice for configuring thread pool parameters is to perform static configuration based on the personal experience of developers or operations personnel, or to set a fixed set of parameter values ​​based on the performance under a specific load during load testing. This approach is difficult to adapt to the dynamic changes in system load. Summary of the Invention

[0004] Therefore, it is necessary to provide a thread pool parameter optimization method, apparatus, device, storage medium, and program product that can adapt to the dynamic changes in system load, addressing the aforementioned technical problems.

[0005] Firstly, this application provides a method for optimizing thread pool parameters, including:

[0006] Obtain the state feature vector of the target thread pool;

[0007] With the goal of adapting to the stage load state of the target thread pool, a global search is performed in the parameter space of the target thread pool based on a preset fitness function to obtain an elite parameter combination.

[0008] Using the state feature vector as the state input, reinforcement learning processing is performed in the target action space indicated by the elite parameter combination to obtain parameter adjustment actions for the target thread pool.

[0009] If the system resources of the target thread pool meet the optimization conditions, the parameter adjustment action is applied to the target thread pool to optimize the parameters of the target thread pool.

[0010] In one embodiment, the step of adapting to the stage load state of the target thread pool, and performing a global search within the parameter space of the target thread pool based on a preset fitness function to obtain an elite parameter combination, includes:

[0011] Determine candidate parameter combinations within the parameter space of the target thread pool;

[0012] Within a first time period corresponding to the stage load state, the candidate parameter combination is evaluated for fitness based on the preset fitness function to obtain a first fitness score result.

[0013] The candidate parameter combinations are used as the initial population, and the initial population is subjected to genetic iterative evolution to obtain the offspring population;

[0014] Within a second time period corresponding to the stage load state, the fitness score of the offspring population is performed based on the preset fitness function to obtain a second fitness score result.

[0015] Based on the first fitness score and the second fitness score, the elite parameter combination is selected from the initial population and the offspring population.

[0016] In one embodiment, the step of using the state feature vector as state input and performing reinforcement learning processing within the target action space indicated by the elite parameter combination to obtain parameter adjustment actions for the target thread pool includes:

[0017] Determine the target action space corresponding to the elite parameter combination;

[0018] The state feature vector is input into the reinforcement learning policy network under the constraint of the target action space to obtain the action probability distribution;

[0019] By sampling from the action probability distribution, parameter adjustment actions for the target thread pool are obtained.

[0020] In one embodiment, the method further includes:

[0021] Based on a preset reward function, a reward score is given to the parameter adjustment action to obtain a reward score result;

[0022] Save the reward score and the parameter adjustment actions to form an adjustment experience record;

[0023] When the number of adjustment experience records reaches a preset threshold, the reinforcement learning policy network is incrementally trained based on the training samples containing the adjustment experience records to obtain an updated reinforcement learning policy network.

[0024] In one embodiment, the method further includes:

[0025] Obtain the host system resource utilization rate of the target thread pool;

[0026] If the utilization rate of the host system resources is less than a preset utilization threshold, it is determined that the system resources of the target thread pool meet the optimization conditions.

[0027] In one embodiment, applying the parameter adjustment action to the target thread pool to optimize the parameters of the target thread pool includes:

[0028] Determine the target adjustment parameter corresponding to the parameter adjustment action;

[0029] The target adjustment parameters are smoothed to obtain smoothed parameters;

[0030] Modify the running parameters of the target thread pool to the smoothing parameters.

[0031] Secondly, this application also provides a thread pool parameter optimization device, including:

[0032] The feature vector acquisition module is used to obtain the state feature vector of the target thread pool;

[0033] The global parameter search module is used to perform a global search within the parameter space of the target thread pool based on a preset fitness function, with the goal of adapting to the stage load state of the target thread pool, to obtain an elite parameter combination.

[0034] The reinforcement learning processing module is used to perform reinforcement learning processing in the target action space indicated by the elite parameter combination, with the state feature vector as the state input, to obtain parameter adjustment actions for the target thread pool.

[0035] The parameter optimization application module is used to apply the parameter adjustment action to the target thread pool and optimize the parameters of the target thread pool when the system resources of the target thread pool meet the optimization conditions.

[0036] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0037] Obtain the state feature vector of the target thread pool;

[0038] With the goal of adapting to the stage load state of the target thread pool, a global search is performed in the parameter space of the target thread pool based on a preset fitness function to obtain an elite parameter combination.

[0039] Using the state feature vector as the state input, reinforcement learning processing is performed in the target action space indicated by the elite parameter combination to obtain parameter adjustment actions for the target thread pool.

[0040] If the system resources of the target thread pool meet the optimization conditions, the parameter adjustment action is applied to the target thread pool to optimize the parameters of the target thread pool.

[0041] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0042] Obtain the state feature vector of the target thread pool;

[0043] With the goal of adapting to the stage load state of the target thread pool, a global search is performed in the parameter space of the target thread pool based on a preset fitness function to obtain an elite parameter combination.

[0044] Using the state feature vector as the state input, reinforcement learning processing is performed in the target action space indicated by the elite parameter combination to obtain parameter adjustment actions for the target thread pool.

[0045] If the system resources of the target thread pool meet the optimization conditions, the parameter adjustment action is applied to the target thread pool to optimize the parameters of the target thread pool.

[0046] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:

[0047] Obtain the state feature vector of the target thread pool;

[0048] With the goal of adapting to the stage load state of the target thread pool, a global search is performed in the parameter space of the target thread pool based on a preset fitness function to obtain an elite parameter combination.

[0049] Using the state feature vector as the state input, reinforcement learning processing is performed in the target action space indicated by the elite parameter combination to obtain parameter adjustment actions for the target thread pool.

[0050] If the system resources of the target thread pool meet the optimization conditions, the parameter adjustment action is applied to the target thread pool to optimize the parameters of the target thread pool.

[0051] The aforementioned thread pool parameter optimization method, apparatus, device, storage medium, and program products acquire the state feature vector of the target thread pool; aiming to adapt to the stage load state of the target thread pool, a global search is performed in the parameter space of the target thread pool based on a preset fitness function to obtain elite parameter combinations; using the state feature vector as state input, reinforcement learning processing is performed in the target action space indicated by the elite parameter combinations to obtain parameter adjustment actions for the target thread pool; when the system resources of the target thread pool meet the optimization conditions, the parameter adjustment actions are applied to the target thread pool to optimize the parameters of the target thread pool, and the state feature vector can represent... By globally searching the parameter space of the target thread pool to determine the system resource status related to the target thread pool, the optimal elite parameter combination for the target thread pool within a certain time period can be obtained. This elite parameter combination can then serve as a guide for reinforcement learning fine-tuning. By combining the state feature vector as state input, parameter adjustment actions are obtained. Applying these parameter adjustment actions when appropriate can optimize the parameters in the target thread pool corresponding to the adjustment actions. Through phased global search combined with short-term reinforcement learning, it can adapt well to the dynamic changes in system resource load and achieve rational utilization of system resources while protecting the quality of system services. Attached Figure Description

[0052] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0053] Figure 1 This is a diagram illustrating the application environment of a thread pool parameter optimization method in one embodiment.

[0054] Figure 2 This is a flowchart illustrating a thread pool parameter optimization method in one embodiment;

[0055] Figure 3 This is a flowchart illustrating the process of performing a global search within the parameter space of the target thread pool based on a preset fitness function to obtain an elite parameter combination, with the goal of adapting to the stage load state of the target thread pool.

[0056] Figure 4 This is a schematic diagram of the population iterative evolution process involved in the genetic algorithm in one embodiment;

[0057] Figure 5This is a flowchart illustrating the process of using state feature vectors as state inputs and performing reinforcement learning processing within the target action space indicated by elite parameter combinations to obtain parameter adjustment actions for the target thread pool in one embodiment.

[0058] Figure 6 This is a schematic diagram of a dual-timescale collaborative mechanism of genetic algorithm and reinforcement learning in one embodiment;

[0059] Figure 7 This is a flowchart illustrating the process of applying the parameter adjustment action to the target thread pool and optimizing the parameters of the target thread pool in one embodiment.

[0060] Figure 8 This is a flowchart illustrating the thread pool parameter optimization method in another embodiment;

[0061] Figure 9 This is a structural block diagram of a thread pool parameter optimization device in one embodiment;

[0062] Figure 10 This is an internal structural diagram of a computer device in one embodiment;

[0063] Figure 11 This is a diagram of the internal structure of a computer device in another embodiment. Detailed Implementation

[0064] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0065] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.

[0066] Currently, the common practice for configuring thread pool parameters is to statically configure them based on the personal experience of developers or operations personnel, or to set a fixed set of parameter values ​​based on the performance under a specific load during load testing. This static approach cannot adapt to the dynamic changes in online business load. Real online traffic often exhibits a significant "tidal effect," meaning that load levels vary greatly at different times (such as day and night), and are often accompanied by sudden traffic surges caused by market activities, hot events, etc. A fixed set of parameter configurations can hardly maintain an optimal state at all times when facing such complex and variable loads. The result is often that during peak business periods, insufficient thread resources cause tasks to wait in the queue for a long time, resulting in a sharp increase in response latency, while during off-peak business periods, a large number of idle threads occupy valuable memory and CPU resources and cause unnecessary context switching overhead.

[0067] To address the rigidity of static configurations, some related technologies attempt to introduce dynamic adjustment mechanisms based on simple rules. For example, by monitoring the task queue length of the thread pool, the number of threads is automatically increased when the queue backlog exceeds a certain threshold. While these solutions achieve some degree of adaptability, their limitations are still significant. First, they typically rely on a single, local performance metric, lacking a global, multi-dimensional understanding of the system state, making them prone to biased or even erroneous adjustment decisions, sometimes even causing system performance fluctuations. Second, these methods are inherently reactive, only triggering adjustments after signs of system performance deterioration (such as a large backlog of tasks), resulting in significant response lag. Furthermore, complex non-linear coupling relationships exist between the various parameters of the thread pool; adjusting a single parameter in isolation ignores the impact of these coupling relationships.

[0068] Based on the above problems, the embodiments of this application combine global search optimization and reinforcement learning action fine-tuning. Global search optimization can determine the elite parameter combination that is adapted to the stage load state, while reinforcement learning can fine-tune the parameters of the target thread pool in real time. The elite parameter combination can provide a range reference for the action space of reinforcement learning, realize the dynamic adjustment of the target thread pool parameter optimization, and adapt to the dynamic changes in system resource load.

[0069] The thread pool parameter optimization method provided in this application embodiment can be applied to, for example... Figure 1In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or placed on a cloud or other network server. Terminal 102 obtains the state feature vector of the target thread pool; with the goal of adapting to the stage load state of the target thread pool, it performs a global search within the parameter space of the target thread pool based on a preset fitness function to obtain elite parameter combinations; using the state feature vector as state input, it performs reinforcement learning processing within the target action space indicated by the elite parameter combinations to obtain parameter adjustment actions for the target thread pool; when the system resources of the target thread pool meet the optimization conditions, it applies the parameter adjustment actions to the target thread pool to optimize its parameters. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, etc. Server 104 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0070] In one exemplary embodiment, such as Figure 2 As shown, a thread pool parameter optimization method is provided, which is then applied to... Figure 1 The following steps are used as an example of the terminal in the example, including steps 202 to 208.

[0071] Step 202: Obtain the state feature vector of the target thread pool.

[0072] The target thread pool refers to the thread pool targeted for parameter optimization operations. The state feature vector is a vector representing the resource states associated with the target thread pool. These resource states can include the internal runtime state of the target thread pool, the resource states of its host system, and the task flow characteristics. Various state information can be collected at fixed time intervals by calling the relevant functional code of the target thread pool. For example, in monitoring the internal runtime state of the target thread pool, the runtime code sets up a `ThreadPoolMetricsCollector` class, which holds a reference to the target thread pool, and its `collect()` method is periodically called by a dedicated `ScheduledExecutorService` at a fixed rate of 1 second.

[0073] For example, the internal running information, system resource information, and task flow characteristic information of the target thread pool are obtained, and the internal running information, system resource information, and task flow characteristic information are integrated into comprehensive state information, and the comprehensive state information is transformed into a state feature vector.

[0074] Internal operational information characterizes the running state of the target thread pool. This information, collected through the target thread pool's `collect()` method, can include the number of active threads, current queue length, instantaneous throughput, total thread count, and the increase in rejected tasks. This information can be retrieved by calling the corresponding function code. For example, calling `getActiveCount()` retrieves the number of active threads. Call getQueue().size() to get the current length of the queue. The `getCompletedTaskCount()` function retrieves the cumulative number of completed tasks, and by subtracting the value from the previous sampling point, the instantaneous throughput within the current sampling period is calculated. Call getPoolSize() to get the total number of threads in the current thread pool. To accurately count rejected tasks, a custom `RejectedExecutionHandler` implementation can be set for the thread pool. This implementation internally maintains an `AtomicLong` counter. `ThreadPoolMetricsCollector` will read the value of this counter and calculate the increment of rejected tasks within the sampling period. .

[0075] System resource information can characterize the resource utilization of a parasitic system. This functionality can be uniformly integrated into ThreadPoolMetricsCollector. Singletons of OperatingSystemMXBean and MemoryMXBean can be obtained through java.lang.management.ManagementFactory. The getProcessCpuLoad() method of OperatingSystemMXBean returns the average CPU load since the most recent call (values ​​range from 0.0 to 1.0). This allows for obtaining more accurate instantaneous CPU (Central Processing Unit) utilization. This can be combined with `getProcessCpuTime()` to calculate the ratio of CPU time increment to physical time increment. CPU time increment refers to the actual time a Java process occupies the CPU for computation between two sampling intervals, while physical time increment refers to the time that naturally elapses in the real world between two sampling intervals. The `getHeapMemoryUsage()` method of `MemoryMXBean` returns a `MemoryUsage` object. The `getUsed()` and `getMax()` methods can be used to calculate the current JVM (Java Virtual Machine) heap memory utilization. .

[0076] Task flow characteristic information can characterize the characteristics of the tasks carried by the target thread pool. To statistically analyze task flow characteristics, the `ThreadPoolExecutor` class can be extended to create a subclass of `AdaptiveThreadPoolExecutor`. In this subclass, the `execute(Runnable)` method is overridden. Within the `execute` method, the current timestamp is recorded immediately upon task submission. Simultaneously, the `beforeExecute(Thread, Runnable)` and `afterExecute(Runnable, Throwable)` methods of `ThreadPoolExecutor` are also overridden. In `beforeExecute`, the timestamp of task execution start is recorded, and the task waiting time is calculated. The `afterExecute` function records the timestamp of task completion and calculates the task execution time. The calculated and The data is stored in their respective fixed-size ConcurrentLinkedQueues, serving as a sliding window. During data collection, ThreadPoolMetricsCollector can average the data from these two queues to obtain the average task waiting time. and average task execution time Task completion rate The counting counter for the execute method can then be used to calculate the count within the sampling period.

[0077] In one embodiment, after collecting all the raw data, the ThreadPoolMetricsCollector can also call the StateVectorBuilder, which maintains the mean and standard deviation of all monitored metrics over a period of time (e.g., the most recent 100 samples). For each newly collected metric value x, the StateVectorBuilder can standardize it using the following formula 1.

[0078] Formula 1: .

[0079] Where μ is the historical mean of the indicator value, and σ is the historical standard deviation of the indicator value.

[0080] All standardized index values ​​can be assembled into a fixed-dimensional floating-point array, i.e., a state feature vector. .

[0081] In another embodiment, Principal Component Analysis (PCA) is used to reduce the dimensionality of the original high-dimensional comprehensive state information, extracting the principal components that best reflect the changes in system state as state features. Alternatively, deep learning models such as autoencoders can be used to automatically extract low-dimensional, high-information-content latent representations from the comprehensive state information through unsupervised learning, serving as state feature vectors to help reinforcement learning models better understand the intrinsic dynamics of the system.

[0082] Step 204: With the goal of adapting to the stage load state of the target thread pool, a global search is performed in the parameter space of the target thread pool based on the preset fitness function to obtain an elite parameter combination.

[0083] The stage load state of the target thread pool refers to the load state of the target thread pool within a relatively macroscopic time scale. The parameter space of the target thread pool refers to the space formed by the thread parameters of the target thread pool. Different thread parameter values ​​result in different positions within the parameter space. The preset fitness function is a pre-set function that evaluates the degree to which thread parameters adapt to the stage load state; it can include multiple evaluation metrics. Global search refers to the operation of performing a numerical search within the entire parameter space of the target thread pool. Elite parameter combinations refer to parameter combinations that meet the fitness criteria for adapting to the stage load state. The fitness criteria can be set to achieve the highest fitness score calculated based on the preset fitness function, or a fitness score exceeding a certain threshold. The preset fitness function can be a multi-objective function; by setting various weights and global search within the preset fitness function, multi-objective optimization can be achieved.

[0084] For example, any heuristic optimization algorithm with global search capabilities can be used to obtain elite parameter combinations. For instance, Particle Swarm Optimization (PSO) can be used, treating each particle as a parameter combination. With the goal of adapting to the stage load state of the target thread pool, it searches for the optimal solution by following both individual optima and the global optimum, thus serving as the elite parameter combination. Similarly, Simulated Annealing (SA) can be applied, using a mechanism that accepts bad solutions with a decreasing probability over time to escape local optima and eventually converge to the global optimum, which is the elite parameter combination. Furthermore, other evolutionary computation methods such as Ant Colony Optimization (ACO) or Differential Evolution (DE) can also be applied to the global search process.

[0085] Step 206: Using the state feature vector as the state input, perform reinforcement learning processing in the target action space indicated by the elite parameter combination to obtain the parameter adjustment action for the target thread pool.

[0086] Reinforcement learning is a machine learning method that allows an agent to learn optimal policies through trial and error in interactions with its environment. It includes elements such as state, action, and reward. The target action space refers to the parameter space that fits the elite parameter set, and the actions can be adjusted to achieve the desired results. During reinforcement learning, after the agent performs an action, the environment transitions to a new state and provides a reward signal (positive or negative). Based on the new state and the reward from the environment, the agent executes a new action according to a specific strategy. Through reinforcement learning, the agent learns which actions to take in which state to maximize its reward. This embodiment uses the state feature vector as the state input to the trained reinforcement learning agent. Based on the experience gained during training, the agent can adjust its actions according to the output parameters of the state feature vector. The reinforcement learning agent can respond on relatively microscopic time scales, adjusting its actions to cope with instantaneous changes in system resource load.

[0087] For example, the elite parameter combination can indicate the baseline state of the target thread pool. The baseline of the target thread pool is switched according to the elite parameter combination. The action space guided by the switched baseline is used as the target action space. Using the state feature vector as the state input, reinforcement learning processes are used to obtain parameter adjustment actions, which reside within the target action space. Reinforcement learning can employ value-based algorithms such as Deep Q-Network (DQN), or its improved versions such as Double DQN or Dueling DQN, to learn the Q-value of each fine-tuning action in a specific state and select the action with the highest Q-value as the parameter adjustment action. Alternatively, other policy-based algorithms can be used, such as the Asynchronous Advantage Actor-Critic (A3C) algorithm or its synchronous version A2C, to accelerate the learning process through multiple parallel agents. For more complex scenarios, Deep Deterministic Policy Gradient (DDPG) or its improved algorithms such as TD3 (Twin Delayed Deep Deterministic policy gradient) and SAC (Soft Actor-Critic) can be used to handle output parameter adjustment actions after the action space has been modified.

[0088] Step 208: If the system resources of the target thread pool meet the optimization conditions, apply the parameter adjustment action to the target thread pool and optimize the parameters of the target thread pool.

[0089] The system resources of the target thread pool refer to the resources of the parasitic system on which the target thread pool resides. Optimization conditions refer to the conditions that the system resources should meet before parameter adjustment actions are applied. Parameter adjustment actions may include the type and data of the thread parameters to be adjusted. During application to the target thread pool, the thread parameters of the target thread pool are adjusted according to the instructions of the parameter adjustment actions, so that the optimized thread parameters can adapt to the instantaneous load state of the target thread pool.

[0090] In one embodiment, if the system resources of the target thread pool meet the optimization conditions, the parameter adjustment action is applied to the target thread pool. Before optimizing the parameters of the target thread pool, the method further includes: obtaining the host system resource utilization rate of the target thread pool; if the host system resource utilization rate is less than a preset utilization rate threshold, determining that the system resources of the target thread pool meet the optimization conditions.

[0091] Host system resource utilization refers to the utilization rate of host system resources such as processor and memory while the target thread pool is running. This includes CPU utilization and memory utilization. The calculation methods for CPU utilization and memory utilization can refer to the steps described above. Optimization conditions can be set to ensure that the host system resource utilization is less than or equal to a resource threshold. For example, setting the resource threshold to 0.95, with CPU utilization... and memory utilization If all resources are less than or equal to the resource threshold, then the system resources of the target thread pool are determined to meet the optimization conditions. or In such cases, if the system resources of the target thread pool do not meet the optimization criteria, any parameter changes that would increase the core thread count or maximum thread count can be rejected. The optimization criteria may also include hard constraint checks, verifying that each parameter value in the parameter adjustment action is within the range defined by a predefined global minimum and maximum value.

[0092] In the above thread pool parameter optimization method, the state feature vector of the target thread pool is obtained; with the goal of adapting to the stage load state of the target thread pool, a global search is performed in the parameter space of the target thread pool based on a preset fitness function to obtain an elite parameter combination; using the state feature vector as state input, reinforcement learning processing is performed in the target action space indicated by the elite parameter combination to obtain parameter adjustment actions for the target thread pool; when the system resources of the target thread pool meet the optimization conditions, the parameter adjustment actions are applied to the target thread pool to optimize the parameters of the target thread pool. The state feature vector can represent the system resource state related to the target thread pool. A global search in the parameter space of the target thread pool can find the best elite parameter combination for the target thread pool within a certain time period. The elite parameter combination can also serve as a guide for reinforcement learning fine-tuning. Combined with the state feature vector as state input, the parameter adjustment action is obtained. Applying the parameter adjustment action under appropriate conditions can optimize the parameters in the target thread pool corresponding to the parameter adjustment action. Through staged global search combined with short-term reinforcement learning, it can well adapt to the dynamic changes in system resource load and achieve reasonable utilization of system resources while protecting the system service quality.

[0093] In one exemplary embodiment, such as Figure 3 As shown, with the goal of adapting to the stage load state of the target thread pool, a global search is performed in the parameter space of the target thread pool based on a preset fitness function to obtain an elite parameter combination, including steps 302 to 310.

[0094] Step 302: Determine candidate parameter combinations within the parameter space of the target thread pool.

[0095] This embodiment employs a genetic algorithm for global search and optimization to obtain elite parameter combinations. Candidate parameter combinations refer to parameter combinations that can be considered as candidates for elite combinations. The parameter space range of the target thread pool can be predefined according to actual conditions. A `Chromosome` class is defined to represent parameter combinations, which can contain three integer fields: `corePoolSize` (core thread count), `maximumPoolSize` (maximum thread count), and `queueCapacity` (queue capacity). A `GeneSpec` can also be defined for each thread parameter, specifying its minimum, maximum, and variable length to ensure that the generated thread parameters are always valid. Upon initial startup of the genetic algorithm, `GeneticAlgorithmOptimizer` can randomly generate 20 `Chromosome` objects based on the parameter space specified by `GeneSpec` as candidate parameter combinations, which can serve as the initial population. If elite parameter combinations have already been obtained previously, they can be directly used as candidate parameter combinations for the current iteration.

[0096] Step 304: Within the first time period corresponding to the stage load state, the candidate parameter combination is evaluated for fitness based on the preset fitness function to obtain the first fitness score result.

[0097] Each elite parameter combination obtained through a global search using a genetic algorithm can adapt to the phased load state of the target thread pool within a certain period. During the population iteration process of the genetic algorithm, the fitness score of each generation of the population can be mapped to a portion of the time period within the phased load state. The time period corresponding to the fitness score of the candidate parameter combination is the first time period, and the score result of the candidate parameter combination is the first fitness score result. Each generation of the population can include multiple chromosomes, i.e., multiple parameter combinations, and multiple candidate parameter combinations can be used as the initial population.

[0098] In one embodiment, the preset fitness function includes weight coefficients. The weighting coefficients for each item are determined as follows: , , , .in, As throughput weight, For response delay weights, As a resource cost weight, This serves as a penalty weight. By quantifying the importance of different performance metrics, it's easier to flexibly adjust the optimization direction based on specific business scenarios. For example, real-time trading systems prioritize low latency, so improvements could be made... The weights are assigned to specific parameters, and higher penalty weights are used to strongly suppress task rejection. These weights can be dynamically adjusted externally to adapt to different business scenarios. The first fitness score for each candidate parameter combination is obtained by multiplying the weight coefficients by the corresponding type of parameters in the candidate parameter combination and then summing the products of each weight coefficient.

[0099] During the fitness scoring process, the parameters of each Chromosome can be applied to an AdaptiveThreadPoolExecutor sequentially (using methods such as setCorePoolSize), and the Executor can run for 15 seconds. During this period, ThreadPoolMetricsCollector continuously collects data. After 15 seconds, the average throughput, latency, and resource cost during this period are calculated, and then substituted into the preset fitness function to calculate the score. The score is then stored in the corresponding Chromosome object.

[0100] Step 306: The candidate parameter combination is used as the initial population, and the initial population is subjected to genetic iterative evolution to obtain the offspring population.

[0101] Reference Figure 4 , Figure 4 This diagram illustrates the population iterative evolution process involved in a genetic algorithm in one embodiment. The iterative evolution process of the initial population can include selection, crossover, and mutation. During selection, the `GeneticAlgorithmOptimizer` implements a `tournamentSelect()` method. This tournament selection method executes cyclically, randomly selecting three Chromosomes from the current population without replacement each time, comparing their fitness scores, and copying the one with the highest score to a new mating pool. During crossover, the `crossover(Chromosomep1, Chromosome p2)` method is implemented. This method performs crossover with a probability of 0.8. It randomly selects a crossover point (1 or 2), exchanging the genes of the two parent chromosomes after the crossover point, generating two new offspring Chromosomes. During mutation, the `mutate(Chromosome child)` method is implemented. For each gene (parameter) of the offspring, mutation is triggered with a probability of 0.05. The mutation operation can add or subtract a predefined step from the current value of the gene (e.g., the step for corePoolSize is 1, and the step for queueCapacity is 50), and ensure that the result does not exceed the range defined by GeneSpec.

[0102] Step 308: Within the second time period corresponding to the stage load state, the fitness score of the offspring population is performed based on the preset fitness function to obtain the second fitness score result.

[0103] The time period corresponding to the stage load state of the offspring population is the second time period. The fitness score of the offspring population is the second fitness score. Taking a total of 5 generations for all populations as an example, the first generation is the initial population, and all subsequent generations are offspring populations. Each generation of offspring populations can be scored according to the same preset fitness function to obtain the second fitness score. The scoring process is the same as that for the initial population.

[0104] Step 310: Based on the first fitness score and the second fitness score, select elite parameter combinations from the initial population and the offspring population.

[0105] After generating a sufficient number of offspring populations, the GeneticAlgorithmOptimizer merges these offspring populations with the initial population, sorts them by fitness score from highest to lowest, and selects the top 20 individuals from both the initial and offspring populations as the initial population for the next generation. This elite population preservation strategy ensures that the optimal solution is not lost. After five generations of evolution, the GeneticAlgorithmOptimizer can select the three chromosomes with the highest fitness from all populations as the elite parameter combination for output.

[0106] In this embodiment, the global search and optimization process of the population iteration evolution of the genetic algorithm can periodically find elite parameter combinations that can adapt to the system load state within a relatively macroscopic time scale, providing guidance for fine-grained thread parameter adjustment within a microscopic time scale.

[0107] In one exemplary embodiment, such as Figure 5 As shown, the state feature vector is used as the state input, and reinforcement learning is performed in the target action space indicated by the elite parameter combination to obtain the parameter adjustment action for the target thread pool, including steps 502 to 506.

[0108] Step 502: Determine the target action space corresponding to the elite parameter combination.

[0109] The action space refers to the range of parameter values ​​involved in the actions output by reinforcement learning. The target action space is the action space guided by the elite parameter combination. The actions output by reinforcement learning are adjustments to the thread parameters of the target thread pool, which involve thread parameters. Therefore, the location of the target action space can be defined by the values ​​of each parameter in the elite parameter combination.

[0110] Reference Figure 6 , Figure 6 This is a schematic diagram of a dual-timescale collaborative mechanism for genetic algorithms and reinforcement learning in one embodiment. The genetic algorithm and reinforcement learning processes can be performed in parallel. HybridOptimizerService serves as the main loop of the entire optimization engine. Internally, it maintains a lastGaRunTimestamp timestamp to ensure that the `evolveAndGetBest()` method of GeneticAlgorithmOptimizer is called every 300 seconds to perform a global search by the genetic algorithm and update the `eliteBaseline` variable with the returned optimal Chromosome. The reinforcement learning process runs at a fixed interval of 5 seconds, and each loop can execute the agent's decision-making and application process once.

[0111] Step 504: Input the state feature vector into the reinforcement learning policy network under the target action space constraint to obtain the action probability distribution.

[0112] This embodiment uses a deep learning framework such as Deeplearning4j to implement the PPO (Proximal Policy Optimization) algorithm. The constructed Markov decision process is configured as follows: the state input is the state feature vector (StateVector) of the target thread pool; the action space is fixed at 7 discrete actions, represented by integers 0 to 6; and the preset reward function is implemented by the RewardCalculator class. The weight coefficients of the preset reward function can be set consistently with the preset fitness function in the previous embodiment, but the values ​​multiplied by each weight coefficient are instantaneous changes. For example, the throughput reward term calculates the throughput of the current period, and the latency penalty term is the average waiting time of the current period.

[0113] Furthermore, the reinforcement learning network structure in this embodiment can be configured as follows: both the Actor (policy) network and the Critic (evaluation) network are designed with an input layer dimension equal to the StateVector dimension, followed by two hidden layers, each with 128 neurons and the ReLU activation function. The Actor network's output layer dimension is 7 (discrete action space size), and the Softmax activation function is used. The Critic network's output layer dimension is 1, with no activation function. The logic for interacting with the PPO model is encapsulated through the RLOptimizer class.

[0114] A well-trained reinforcement learning policy network can output an action probability distribution based on the input state feature vector, providing parameters to adjust the possible probability range of actions.

[0115] Step 506: Sample from the action probability distribution to obtain the parameter adjustment actions for the target thread pool.

[0116] Random sampling can be performed from the action probability distribution to select an action as the parameter adjustment action for the target thread pool. This random sampling operation ensures a certain degree of exploratory nature. The parameter adjustment action can include an action identifier. After calling RLOptimizer.decideAction(), HybridOptimizerService can incrementally modify eliteBaseline based on the returned action identifier, generating a temporary effectiveParams. For example, if the parameter adjustment action is +10%_queue (increasing the queue length by 10%), then effectiveParams.queueCapacity = eliteBaseline.queueCapacity 1.1.

[0117] In one embodiment, after taking the state feature vector as the state input and performing reinforcement learning processing in the target action space indicated by the elite parameter combination to obtain the parameter adjustment action for the target thread pool, the method further includes: scoring the parameter adjustment action based on a preset reward function to obtain a reward score result; saving the reward score result and the parameter adjustment action to form an adjustment experience record; and when the number of adjustment experience records reaches a preset threshold, incrementally training the reinforcement learning policy network based on the training samples containing the adjustment experience records to obtain an updated reinforcement learning policy network.

[0118] After the parameter adjustment action is applied to the target thread pool, environmental feedback on the action can be obtained. This feedback is then used to incrementally train and update the reinforcement learning policy network. The preset reward function can be dynamically adjusted according to the actual business scenario requirements. The reward scoring process for the parameter adjustment action can refer to the fitness scoring process described above, using a weighted summation method to calculate the reward score. The adjustment experience record is used to save the parameter adjustment action and the reward score result after execution. Each execution of a parameter adjustment action generates a corresponding adjustment experience record. When the number of adjustment experience records reaches a preset threshold, it can be considered as triggering the model training condition for reinforcement learning, and incremental training of the reinforcement learning policy network can be performed. The preset threshold can be set to 1024. The training samples can contain all adjustment experience records obtained from the last incremental training to the current incremental training.

[0119] In one embodiment, a complete interaction (S, A, R, S') is stored as an Experience object in a fixed-size ReplayBuffer using the `observe(StateVector state, int action, doublereward, StateVector nextState)` method. A separate background thread handles the training process, executing `PPOModelTrainer.trainOnCollectedData()`. When the number of experiences in the ReplayBuffer reaches a preset threshold, such as 1024, incremental training is triggered. The training process can follow the Clipped Surrogate Objective of the PPO algorithm to update the weights of the Actor and Critic networks. After training, the updated model parameters are hot-loaded by the RLOptimizer for subsequent decision-making.

[0120] In this embodiment, the macro-scale baseline adjustment of global search is combined with micro-scale parameter adjustment based on reinforcement learning. By coordinating on the time scale and leveraging the real-time fine-tuning capability of reinforcement learning, the thread pool can respond quickly and accurately to instantaneous load peaks, proactively increase processing capacity, effectively reduce task waiting time in the queue, and quickly reclaim excess resources when the load decreases, avoiding unnecessary performance overhead. Through dynamic management, the system can maintain high processing efficiency and low response latency under various load conditions.

[0121] In one exemplary embodiment, such as Figure 7 As shown, the parameter adjustment action is applied to the target thread pool to optimize the parameters of the target thread pool, including the following steps 702 to 706.

[0122] Step 702: Determine the target adjustment parameter corresponding to the parameter adjustment action.

[0123] The target adjustment parameter refers to the thread parameters after adjustment involved in the parameter adjustment action. For example, if the parameter adjustment action is to increase the queue length by 10%, represented as +10%_queue, then the target adjustment parameter can be determined as +10%_queue.

[0124] Step 704: Smooth the target adjustment parameters to obtain smoothed parameters.

[0125] If the system resources of the target thread pool meet the optimization conditions and pass the hard constraint check and resource threshold check, the target adjustment parameters can be smoothed to avoid situations where they cannot be applied due to incorrect parameter types. The SafetyGovernor can maintain a currentAppliedParams variable and use the EMA (Exponential Moving Average) formula for smoothing to calculate the final smoothing parameter smoothedParams to be applied: smoothedCoreSize = 0.4 effectiveParams.corePoolSize+0.6 currentAppliedParams.corePoolSize.

[0126] Step 706: Modify the running parameters of the target thread pool to smooth parameters.

[0127] The calculated smoothing parameter can be rounded up, and then applied to the thread pool using methods such as targetPool.setCorePoolSize(), updating the current running parameter currentAppliedParams to the smoothing parameter smoothedParams.

[0128] In this embodiment, the smoothed thread parameters are applied to the target thread pool to avoid excessive changes in thread parameters and achieve a smooth switching of the target thread pool state.

[0129] In one exemplary embodiment, such as Figure 8 As shown, the method includes the following steps S1 to S4.

[0130] S1. Target Thread Pool and System Status Monitoring. The target thread pool and system status are monitored in real-time by collecting data on the number of active threads, queue length, task throughput, average wait time, and the CPU and memory utilization of the host system. These collected metrics are then converted into standardized status feature vectors for use in subsequent decision-making steps.

[0131] S2. Global optimization based on genetic algorithms to obtain elite parameter combinations. The core parameter combination of the target thread pool is used as the chromosome, with core parameters including the number of core threads, the maximum number of threads, and the queue capacity. A multi-objective fitness function that integrates throughput, latency, and resource cost is used for evaluation. The selection, crossover, and mutation operations of the genetic algorithm are then used to evolve the pool on a macroscopic time scale to find the elite parameter combination.

[0132] S3. Perform parameter decision-making based on reinforcement learning and output parameter adjustment actions. Using the standardized state feature vector obtained in the above steps as the state input, and the discretized fine-tuning actions of the target thread pool parameters as the action space, the optimal policy is learned by maximizing an immediate reward function consistent with the multi-objective fitness function objective, generating real-time parameter adjustment actions on a micro-time scale.

[0133] S4. Two-layer hybrid optimization coordination and safe execution. The aforementioned elite parameter combination serves as the baseline for fine-tuning decisions in reinforcement learning. The safe execution mechanism includes performing resource threshold checks before applying real-time parameter adjustments and using a smooth transition method to apply the final parameter changes to the target thread pool, thereby achieving adaptive optimization of thread pool parameters.

[0134] Unlike traditional static configurations or simple rule-based dynamic adjustments that result in long-term resource idleness or excessive occupation, this embodiment can accurately match thread resources according to actual needs. While ensuring performance, it uses the fewest possible number of threads and memory resources, avoiding context switching overhead and memory occupation caused by maintaining too many idle threads. For applications deployed in cloud environments, this efficient resource utilization directly translates into lower server computing costs and a better return on investment.

[0135] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.

[0136] Based on the same inventive concept, this application also provides a thread pool parameter optimization device for implementing the thread pool parameter optimization method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more thread pool parameter optimization device embodiments provided below can be found in the limitations of the thread pool parameter optimization method described above, and will not be repeated here.

[0137] In one exemplary embodiment, such as Figure 9 As shown, a thread pool parameter optimization device 900 is provided, including: a feature vector acquisition module 901, a global parameter search module 902, a reinforcement learning processing module 903, and a parameter optimization application module 904.

[0138] The feature vector acquisition module 901 is used to acquire the state feature vector of the target thread pool.

[0139] The global parameter search module 902 is used to perform a global search within the parameter space of the target thread pool based on a preset fitness function, with the goal of adapting to the stage load state of the target thread pool, to obtain an elite parameter combination.

[0140] The reinforcement learning processing module 903 is used to perform reinforcement learning processing in the target action space indicated by the elite parameter combination, using the state feature vector as the state input, to obtain parameter adjustment actions for the target thread pool.

[0141] The parameter optimization application module 904 is used to apply the parameter adjustment action to the target thread pool and optimize the parameters of the target thread pool when the system resources of the target thread pool meet the optimization conditions.

[0142] In an exemplary embodiment, the global parameter search module 902 is further configured to: determine candidate parameter combinations within the parameter space of the target thread pool; within a first time period corresponding to the stage load state, perform fitness scoring on the candidate parameter combinations based on a preset fitness function to obtain a first fitness score result; use the candidate parameter combinations as an initial population, perform genetic iterative evolution processing on the initial population to obtain a offspring population; within a second time period corresponding to the stage load state, perform fitness scoring on the offspring population based on a preset fitness function to obtain a second fitness score result; and based on the first fitness score result and the second fitness score result, select elite parameter combinations from the initial population and the offspring population.

[0143] In an exemplary embodiment, the reinforcement learning processing module 903 is further configured to: determine the target action space corresponding to the elite parameter combination; input the state feature vector into the reinforcement learning policy network constrained by the target action space to obtain the action probability distribution; and sample from the action probability distribution to obtain the parameter adjustment action for the target thread pool.

[0144] In an exemplary embodiment, the reinforcement learning processing module 903 is further configured to: score the parameter adjustment action based on a preset reward function to obtain a reward score result; save the reward score result and the parameter adjustment action to form an adjustment experience record; and when the number of adjustment experience records reaches a preset threshold, incrementally train the reinforcement learning policy network based on the training samples containing the adjustment experience records to obtain an updated reinforcement learning policy network.

[0145] In an exemplary embodiment, the thread pool parameter optimization device 900 further includes a resource threshold checking module, used to: obtain the host system resource utilization rate of the target thread pool; and determine that the system resources of the target thread pool meet the optimization conditions when the host system resource utilization rate is less than a preset utilization rate threshold.

[0146] In an exemplary embodiment, the parameter optimization application module 904 is further configured to: determine the target adjustment parameter corresponding to the parameter adjustment action; perform smoothing processing on the target adjustment parameter to obtain a smoothed parameter; and modify the running parameters of the target thread pool to the smoothed parameter.

[0147] Each module in the aforementioned thread pool parameter optimization device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0148] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 10 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores state feature vector data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When executed by the processor, the computer program implements a thread pool parameter optimization method.

[0149] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 11 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a thread pool parameter optimization method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0150] Those skilled in the art will understand that Figure 10 and Figure 11 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0151] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0152] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.

[0153] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0154] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0155] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0156] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for optimizing thread pool parameters, characterized in that, The method includes: Obtain the state feature vector of the target thread pool; the state feature vector refers to a vector representing the resource state associated with the target thread pool; the resource state includes the internal running state of the target thread pool, the system resource state of the parasitic system of the target thread pool, and the task flow characteristic state; With the goal of adapting to the stage load state of the target thread pool, a global search is performed in the parameter space of the target thread pool based on a preset fitness function to obtain an elite parameter combination. Using the state feature vector as the state input, reinforcement learning processing is performed in the target action space indicated by the elite parameter combination to obtain parameter adjustment actions for the target thread pool. If the system resources of the target thread pool meet the optimization conditions, the parameter adjustment action is applied to the target thread pool to optimize the parameters of the target thread pool. The step, aiming to adapt to the stage load state of the target thread pool, involves a global search within the parameter space of the target thread pool based on a preset fitness function to obtain elite parameter combinations, including: Determine candidate parameter combinations within the parameter space of the target thread pool; Within a first time period corresponding to the stage load state, the candidate parameter combination is evaluated for fitness based on the preset fitness function to obtain a first fitness score result. The candidate parameter combinations are used as the initial population, and the initial population is subjected to genetic iterative evolution to obtain the offspring population; Within a second time period corresponding to the stage load state, the fitness score of the offspring population is performed based on the preset fitness function to obtain a second fitness score result. Based on the first fitness score and the second fitness score, the elite parameter combination is selected from the initial population and the offspring population.

2. The method according to claim 1, characterized in that, The step of using the state feature vector as state input and performing reinforcement learning processing within the target action space indicated by the elite parameter combination to obtain parameter adjustment actions for the target thread pool includes: Determine the target action space corresponding to the elite parameter combination; The state feature vector is input into the reinforcement learning policy network under the constraint of the target action space to obtain the action probability distribution; By sampling from the action probability distribution, parameter adjustment actions for the target thread pool are obtained.

3. The method according to claim 2, characterized in that, The method further includes: Based on a preset reward function, a reward score is given to the parameter adjustment action to obtain a reward score result; Save the reward score and the parameter adjustment actions to form an adjustment experience record; When the number of adjustment experience records reaches a preset threshold, the reinforcement learning policy network is incrementally trained based on the training samples containing the adjustment experience records to obtain an updated reinforcement learning policy network.

4. The method according to claim 1, characterized in that, The method further includes: Obtain the host system resource utilization rate of the target thread pool; If the utilization rate of the host system resources is less than a preset utilization threshold, it is determined that the system resources of the target thread pool meet the optimization conditions.

5. The method according to any one of claims 1 to 4, characterized in that, The step of applying the parameter adjustment action to the target thread pool to optimize the parameters of the target thread pool includes: Determine the target adjustment parameter corresponding to the parameter adjustment action; The target adjustment parameters are smoothed to obtain smoothed parameters; Modify the running parameters of the target thread pool to the smoothing parameters.

6. A thread pool parameter optimization device, characterized in that, The device includes: The feature vector acquisition module is used to acquire the state feature vector of the target thread pool; the state feature vector refers to a vector that characterizes the resource state related to the target thread pool; the resource state includes the internal running state of the target thread pool, the system resource state of the parasitic system of the target thread pool, and the task flow characteristic state; The global parameter search module is used to perform a global search within the parameter space of the target thread pool based on a preset fitness function, with the goal of adapting to the stage load state of the target thread pool, to obtain an elite parameter combination. The global parameter search module is specifically used for: determining candidate parameter combinations within the parameter space of the target thread pool; within a first time period corresponding to the stage load state, performing fitness scoring on the candidate parameter combinations based on the preset fitness function to obtain a first fitness score result; using the candidate parameter combinations as an initial population, performing genetic iterative evolution processing on the initial population to obtain a offspring population; within a second time period corresponding to the stage load state, performing fitness scoring on the offspring population based on the preset fitness function to obtain a second fitness score result; and selecting the elite parameter combinations from the initial population and the offspring population based on the first fitness score result and the second fitness score result. The reinforcement learning processing module is used to perform reinforcement learning processing in the target action space indicated by the elite parameter combination, with the state feature vector as the state input, to obtain parameter adjustment actions for the target thread pool. The parameter optimization application module is used to apply the parameter adjustment action to the target thread pool and optimize the parameters of the target thread pool when the system resources of the target thread pool meet the optimization conditions.

7. The apparatus according to claim 6, characterized in that, The reinforcement learning processing module is specifically used for: Determine the target action space corresponding to the elite parameter combination; The state feature vector is input into the reinforcement learning policy network under the constraint of the target action space to obtain the action probability distribution; By sampling from the action probability distribution, parameter adjustment actions for the target thread pool are obtained.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.