Kernel parameter tuning method and electronic equipment
By using a parameter recommendation model and security verification, kernel parameters are automatically adjusted to adapt to dynamic system changes, overcoming the limitations of existing Linux kernel parameter tuning methods and improving system performance and stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-16
- Publication Date
- 2026-04-03
AI Technical Summary
Existing Linux kernel parameter tuning methods rely on experience and static configuration, which are difficult to adapt to the dynamic and fine-grained performance management requirements of complex scenarios such as high concurrency, traffic fluctuations and hardware heterogeneity in modern computing environments, resulting in poor system performance.
By generating a parameter recommendation model that provides recommended kernel parameters and combining it with security checks, kernel parameters are automatically adjusted to adapt to dynamic system changes and improve system performance.
It enables automatic adjustment of kernel parameters based on dynamic changes in the system, improving system stability and performance, enhancing system reliability, and avoiding the limitations of traditional tuning methods.
Smart Images

Figure CN121785679A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and more specifically, to a kernel parameter tuning method and an electronic device. Background Technology
[0002] Currently, Linux kernel parameter tuning, as a core part of system performance optimization, still faces significant limitations in practice. Traditional tuning methods mainly rely on the personal experience of system administrators or engineers and statically preset scripts, manually or periodically adjusting kernel parameters such as sysctl to adapt to system operating requirements.
[0003] However, as application scenarios become increasingly complex, especially in modern computing environments with high concurrency access, drastic traffic fluctuations, diverse business types, and heterogeneous hardware resources, this static, experience-driven tuning model can no longer meet the needs of dynamic and refined performance management, resulting in poor system performance. Summary of the Invention
[0004] The purpose of this application is to provide a kernel parameter tuning method and an electronic device, which generates recommended kernel parameters through a parameter recommendation model, integrates security constraints to perform security verification on the recommended kernel parameters, and uses the verified recommended kernel parameters as the kernel parameters of the target system to support the operation of the target system, thereby coping with the dynamically changing load and environment of the target system and improving system performance.
[0005] In a first aspect, embodiments of this application provide a kernel parameter tuning method, which includes: acquiring current performance index data of a target system and kernel parameters to be tuned; generating a current state vector based on the current performance index data and kernel parameters to be tuned; generating recommended kernel parameters based on the current state vector using a preset parameter recommendation model; wherein the preset parameter recommendation model is trained and generated based on historical performance index data and corresponding historical kernel parameters; performing security verification on the recommended kernel parameters, and using the verified recommended kernel parameters as tuning parameters for the target system to support the operation of the target system.
[0006] In this embodiment, a current state vector is generated based on current performance metrics and the kernel parameters to be tuned. This current state vector reflects the system performance of the target system under the kernel parameters to be tuned. Using a preset parameter recommendation model, recommended kernel parameters are generated based on this current state vector. This allows for automatic adjustment of kernel parameters according to the dynamic changes of the target system, improving system stability. Furthermore, the recommended kernel parameters undergo security verification to constrain the tuning range and enhance system reliability. By combining parameter recommendation and security verification, system performance is improved.
[0007] In some embodiments, the preset parameter recommendation model includes a reinforcement learning recommendation model; generating recommendation kernel parameters based on the current state vector using the preset parameter recommendation model includes: generating action distribution parameters based on the current state vector through the policy network of the reinforcement learning recommendation model; randomly sampling according to the action distribution parameters to obtain kernel parameter adjustment actions; and generating recommendation kernel parameters based on kernel parameter adjustment actions.
[0008] In this embodiment, the preset parameter recommendation model is a reinforcement learning recommendation model, under which parameter tuning is modeled as a decision-making process. The policy network maximizes the cumulative reward during continuous state transitions, enabling the recommendation to not only focus on the immediate effect of a single adjustment but also consider the long-term impact of parameter adjustments on the subsequent states of the system, thus avoiding "short-sighted" behavior. The recommendation kernel parameters generated in this way are beneficial to the long-term stability and performance optimization of the system.
[0009] In some embodiments, the action distribution parameters include a probability distribution in a continuous action space; random sampling based on the action distribution parameters to obtain kernel parameter adjustment actions includes: sampling based on the mean and standard deviation of the probability distribution to obtain continuous parameter adjustment values as kernel parameter adjustment actions.
[0010] In this embodiment, within the continuous action space, the reinforcement learning agent can adaptively adjust the sampling randomness based on the confidence level of the current state according to the mean and standard deviation, thereby more smoothly approaching the optimal configuration point, improving the accuracy of the recommended kernel parameters, and thus improving system performance.
[0011] In some embodiments, the action distribution parameters include the probabilities of selectable actions in a discrete action space; random sampling based on the action distribution parameters to obtain kernel parameter adjustment actions includes: sampling multiple predefined discrete adjustment instructions based on probabilities, and randomly selecting one of the instructions as the kernel parameter adjustment action.
[0012] In this embodiment of the application, within the discrete action space, multiple predefined discrete adjustment instructions are sampled based on probability, and one of the instructions is randomly selected as the kernel parameter adjustment action. Since discrete actions usually correspond to verified and safe adjustment ranges, the risk of system crash due to outlier output values is reduced, and the safety of recommended kernel parameters is improved.
[0013] In some embodiments, the preset parameter recommendation model includes a Bayesian recommendation model; generating recommended kernel parameters based on the current state vector using the preset parameter recommendation model includes: generating corresponding performance prediction values and prediction uncertainties for each candidate parameter combination in the entire kernel parameter combination space of the Bayesian recommendation model based on the mapping relationship learned between the current state vector and the Bayesian recommendation model; and using the performance prediction values and prediction uncertainties as the target kernel parameter combination that maximizes the preset acquisition function in the entire kernel parameter combination space as the recommended kernel parameters.
[0014] In this embodiment, the preset parameter recommendation model is a Bayesian recommendation model. Under this model, the optimal solution can be automatically found, avoiding the problems of experience dependence, inefficiency, and difficulty in handling multi-dimensional coupling relationships inherent in traditional manual tuning or rule-based methods. Furthermore, by optimizing within the entire kernel parameter combination space based on the current state vector, it avoids getting trapped in local optima and improves the accuracy of the recommended kernel parameters.
[0015] In some embodiments, based on the mapping relationship learned by the current state vector and the Bayesian recommendation model, a corresponding performance prediction value and prediction uncertainty are generated for each candidate parameter combination in the entire kernel parameter combination space of the Bayesian recommendation model. This includes: pairing the current state vector with each candidate parameter combination in the entire kernel parameter combination space to form a conditional input pair; using the mapping relationship learned by the Bayesian recommendation model, predicting each conditional input pair to obtain the corresponding performance prediction mean as the performance prediction value and the corresponding prediction variance as the prediction uncertainty.
[0016] In this embodiment, prediction is made by using the mapping relationship learned by the Bayesian recommendation model for each condition input pair, making the recommendation process interpretable. That is, it is possible to trace which candidate parameters are predicted to be optimal in a given state. Therefore, the accuracy of the recommendation process is improved, thereby improving the accuracy of the recommendation kernel parameters.
[0017] In some embodiments, the preset acquisition function includes a desired improvement function or an upper confidence bound function.
[0018] This application embodiment improves the accuracy of the generated recommended kernel parameters by using the expected improvement function or the upper confidence boundary function as the preset acquisition function.
[0019] In some embodiments, security verification is performed on the recommended kernel parameters, and the verified recommended kernel parameters are used as the tuning parameters of the target system. This includes: comparing and verifying the recommended kernel parameters with a predefined security policy rule base; if it is determined that each parameter in the recommended kernel parameters has passed the verification, then the recommended kernel parameters are used as the tuning parameters of the target system.
[0020] In this embodiment, the recommended kernel parameters are further verified for security, thereby constraining the tuning range, avoiding high-risk operations, and enhancing system reliability.
[0021] In some embodiments, generating a current state vector based on current performance metric data and kernel parameters to be tuned includes: standardizing the current performance metric data and kernel parameters to be tuned to generate standard performance metric parameters and standard kernel parameters to be tuned; and concatenating the standard performance metric parameters and standard kernel parameters to be tuned to generate a current state vector.
[0022] In this embodiment, by combining the "current performance indicators" reflecting the real-time performance of the target system with the "kernel parameter values" reflecting the current configuration information to form a state vector, the preset parameter recommendation model can fully understand the "complete instantaneous state" of the target system. Therefore, its recommendations are no longer static or general, but rather highly personalized optimal configuration suggestions for a specific runtime of the target system, enabling more accurate adaptation to complex and ever-changing real-world workloads. This provides a solid foundation for generating recommended kernel parameters.
[0023] In a second aspect, embodiments of this application provide an electronic device, including: a processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the machine-readable instructions, when executed by the processor, are capable of performing the method steps of any embodiment of the first aspect.
[0024] Thirdly, embodiments of this application provide a computer-readable storage medium, including: computer program instructions stored on the computer-readable storage medium, wherein the computer program instructions are executed by a processor to perform the method steps of any embodiment of the first aspect.
[0025] Fourthly, embodiments of this application provide a computer program product, including: computer program instructions, which are executed by a processor to perform the method steps of any embodiment of the first aspect.
[0026] Other features and advantages of this application will be set forth in the following description and will be apparent in part from the description or may be learned by practicing embodiments of this application. Attached Figure Description
[0027] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 A flowchart illustrating a kernel parameter tuning method provided in an embodiment of this application; Figure 2 This is a schematic diagram of the electronic device structure provided in an embodiment of this application. Detailed Implementation
[0029] The embodiments of the technical solution of this application will now be described in detail with reference to the accompanying drawings. These embodiments are only used to more clearly illustrate the technical solution of this application and are therefore merely examples, and should not be used to limit the scope of protection of this application.
[0030] It should be noted that all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.
[0031] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.
[0032] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.
[0033] Currently, Linux kernel parameter tuning, as a core part of system performance optimization, still faces significant limitations in practice. Traditional tuning methods mainly rely on the personal experience of system administrators or engineers and statically preset scripts, manually or periodically adjusting kernel parameters such as sysctl to adapt to system operating requirements.
[0034] Specifically, existing tuning methods are mostly based on fixed rule templates or offline benchmark tests of historical loads, and the parameter configurations used are often a set of static values or simple conditional rules. These configurations cannot perceive in real time changes in the actual system load, dynamic adjustments of business priorities, fluctuations in hardware resource status, and changes in the resource competition relationship between different applications.
[0035] For example, in network-intensive scenarios, if parameters such as TCP buffer size and connection tracking table size cannot dynamically scale with the number of connections and data traffic, it may lead to a decrease in throughput or connection failure. At the memory management level, fixed settings such as dirty page write-back policies may cause an increase in response latency or I / O bottlenecks when business pressure changes suddenly.
[0036] Therefore, as application scenarios become increasingly complex, especially in modern computing environments characterized by high concurrency, drastic traffic fluctuations, diverse business types, and heterogeneous hardware resources, this static, experience-driven tuning model is no longer sufficient to meet the demands of dynamic and refined performance management.
[0037] Due to the lack of adaptive and predictive tuning capabilities, the system often experiences resource allocation imbalances, intensified competition, and performance fluctuations during peak load periods or when services are deployed in a mixed manner, resulting in poor system performance.
[0038] To address the aforementioned issues, this application provides a kernel parameter tuning method. This method generates recommended kernel parameters through a parameter recommendation model, integrates security constraints to perform security verification on the recommended kernel parameters, and uses the verified recommended kernel parameters as the kernel parameters of the target system to support the operation of the target system. This enables the system to cope with dynamically changing loads and environments, thereby improving system performance.
[0039] Figure 1 This is a flowchart illustrating a kernel parameter tuning method provided in an embodiment of this application. Figure 1 As shown, the method includes: Step S101: Obtain the current performance index data of the target system and the kernel parameters to be tuned.
[0040] Performance metrics data refer to various metrics related to the performance of the target system. Current performance metrics data include resource utilization, system health, and business performance metrics.
[0041] Resource utilization specifically includes CPU utilization, memory utilization, swap usage, disk I / O throughput, and network bandwidth.
[0042] System health specifically includes CPU queue length, network packet loss rate, TCP retransmission rate, and memory page fault rate.
[0043] Business performance metrics specifically include application layer throughput (QPS / TPS), average response time, percentile latency (e.g., P95, P99 Latency), availability, and error rate.
[0044] Kernel parameters are a series of configurable variables used by the operating system kernel of a target system during startup and operation to control its behavior and adjust resource allocation and management strategies. The setting of kernel parameters affects the performance metrics of the target system.
[0045] Kernel parameters include network parameters, virtual memory parameters, file system parameters, and process scheduling parameters.
[0046] In the above implementation process, a lightweight monitoring agent is deployed on the target system to continuously and with low overhead collect various indicators related to the performance of the target system, thereby obtaining the current performance indicator data of the target system.
[0047] Obtain the current kernel parameters of the target system as kernel parameters to be tuned by reading the virtual file under / proc / sys / or executing the sysctl -a command.
[0048] Step S102: Generate the current state vector based on the current performance metrics data and the kernel parameters to be tuned.
[0049] Considering the different dimensions and units of various performance metrics and kernel parameters to be tuned, in order to facilitate the subsequent processing of these data by the preset parameter recommendation model, it is necessary to standardize the current performance metrics and kernel parameters to be tuned, thereby generating standard performance metrics and standard kernel parameters to be tuned.
[0050] Then, the standard performance index parameters and the standard kernel parameters to be tuned are concatenated to form a data structure that can comprehensively and digitally represent the "global state" of the entire system at a specific moment, and generate the current state vector.
[0051] For example, the specific form of the state vector is as follows: The state vector s_t at time step t can be represented as: s_t = [M_t||P_t], where s_t represents the state vector at time step t. || denotes the vector concatenation operation. M_t represents the standard performance metric vector. P_t represents the standard kernel parameter vector to be tuned.
[0052] The standard performance index vector is M_t=[m1,m2,...,mX], where each element m xThis represents a specific performance metric. For example: m1 represents cpu_utilization (normalized CPU utilization), m2 represents memory_usage (normalized memory usage), m3 represents disk_iops (disk IOPS normalized to the maximum possible IOPS), m4 represents network_throughput (network throughput normalized to bandwidth), m5 represents p95_latency (normalized 95th percentile latency), and m6 represents tcp_retransmit_rate (TCP retransmission rate).
[0053] The standard kernel parameter vector to be tuned is P_t=[p1,p2,...,pY], where each element p y This represents the current value of a kernel parameter. For example, p1 represents the current value of vm.swappiness (e.g., 60), p2 represents the current value of net.ipv4.tcp_max_syn_backlog (e.g., 1024), and p3 represents the current value of kernel.sched_min_granularity_ns.
[0054] Ultimately, the state vector s_t is a one-dimensional vector with dimensions X+Y, which simultaneously contains the system's performance (M_t) and the current kernel parameter configuration settings (P_t).
[0055] In this process, by combining the "current performance metrics" reflecting the real-time status of the target system with the "kernel parameter values" reflecting the current configuration information to form a state vector, the preset parameter recommendation model can fully understand the "complete instantaneous state" of the target system. Therefore, its recommendations are no longer static or general, but rather highly personalized optimal configuration suggestions tailored to a specific runtime of the target system, enabling more accurate adaptation to complex and ever-changing real-world workloads. This provides a solid foundation for generating recommended kernel parameters.
[0056] Step S103: Using a preset parameter recommendation model, generate recommended kernel parameters based on the current state vector; wherein, the preset parameter recommendation model is trained and generated based on historical performance index data and corresponding historical kernel parameters.
[0057] Step S104: Perform security verification on the recommended kernel parameters, and use the verified recommended kernel parameters as the tuning parameters for the target system to support the operation of the target system.
[0058] In the above implementation process, the current state vector is input into the preset parameter recommendation model, and after processing by the preset parameter recommendation model, the recommended kernel parameters are output.
[0059] After obtaining the recommended kernel parameters, the recommended kernel parameters are security verified, and the verified recommended kernel parameters are dynamically applied to the Linux kernel running on the target system via sysctl -w or by writing to the / proc / sys / virtual file system.
[0060] In this embodiment, a current state vector is generated based on current performance metrics and the kernel parameters to be tuned. This current state vector reflects the system performance of the target system under the kernel parameters to be tuned. Using a preset parameter recommendation model, recommended kernel parameters are generated based on this current state vector. This allows for automatic adjustment of kernel parameters according to the dynamic changes of the target system, improving system stability. Furthermore, the recommended kernel parameters undergo security verification to constrain the tuning range and enhance system reliability. By combining parameter recommendation and security verification, system performance is improved.
[0061] In some embodiments, the preset parameter recommendation model includes a reinforcement learning recommendation model; generating recommendation kernel parameters based on the current state vector using the preset parameter recommendation model includes: generating action distribution parameters based on the current state vector through the policy network of the reinforcement learning recommendation model; randomly sampling according to the action distribution parameters to obtain kernel parameter adjustment actions; and generating recommendation kernel parameters based on kernel parameter adjustment actions.
[0062] In the above implementation process, the policy network of the reinforcement learning model is trained based on historical performance index data and corresponding historical kernel parameters. Specifically, the policy network is trained through continuous interaction with simulated or real environments. In each iteration, the agent observes state s_t, samples action a_t according to policy π(a|s_t), executes the action, and then the environment transitions to a new state s_{t+1}, returning a reward r_t. Using policy gradient algorithms (such as PPO, SAC), the weight parameters of the policy network are updated according to the goal of maximizing cumulative reward, making it inclined to choose actions that can obtain higher long-term rewards.
[0063] After the reinforcement learning recommendation model is trained, the current state vector is input into the policy network of the reinforcement learning recommendation model. The policy network extracts high-level abstract features of the state through multi-layer nonlinear transformations (such as fully connected layers and ReLU activation functions) to understand the complex relationship between the current system performance and kernel parameters.
[0064] The output layer of the policy network generates action distribution parameters based on the action space design. Specifically: For continuous action spaces (e.g., adjusting vm.swappiness from 60 to 55.3): the network output layer typically has two parallel "heads". One head outputs the mean (μ) of the adjustment amount for each kernel parameter to be tuned, and the other head outputs the corresponding standard deviation (σ). For example, in a continuous space, if the policy network outputs a mean μ = 55.0 and a standard deviation σ = 2.0, then the actual action executed might be a value sampled from an N(55.0, 2.0) distribution, such as 54.8 or 56.1.
[0065] That is, in some embodiments, the action distribution parameters include a probability distribution in a continuous action space; random sampling based on the action distribution parameters to obtain kernel parameter adjustment actions includes: sampling based on the mean and standard deviation of the probability distribution to obtain continuous parameter adjustment values as kernel parameter adjustment actions.
[0066] In this process, the action distribution parameters are used to define the probability distribution in the continuous action space; the output layer of the policy network includes a first subheader for outputting the action mean and a second subheader for outputting the action standard deviation.
[0067] The random sampling based on action distribution parameters includes: sampling from a Gaussian distribution parameterized by mean and standard deviation to obtain continuous parameter adjustment values as kernel parameter adjustment actions. These continuous parameter adjustment values are then calculated with the corresponding current kernel parameter values to obtain recommended kernel parameters.
[0068] Within the continuous action space, the kernel parameters can be adjusted with minute, arbitrary precision. Furthermore, based on the mean and standard deviation, the reinforcement learning agent can adaptively adjust the sampling randomness according to the confidence level of the current state, thereby more smoothly approaching the optimal configuration point, improving the accuracy of the recommended kernel parameters, and thus improving system performance.
[0069] For the discrete action space (e.g., "increase by 10%", "decrease by 10%", "remain unchanged"): the network output layer is a Softmax layer that outputs a probability value (e.g., "+10%", "-10%", "0%)" for each predefined discrete action, representing the likelihood of choosing that action in the current state.
[0070] That is, in some embodiments, the action distribution parameters include the probabilities of selectable actions in a discrete action space; random sampling based on the action distribution parameters to obtain kernel parameter adjustment actions includes: sampling multiple predefined discrete adjustment instructions based on probabilities, and randomly selecting one of the instructions as the kernel parameter adjustment action.
[0071] The predefined discrete adjustment instructions include at least one of increasing by a preset percentage, decreasing by a preset percentage, and keeping it unchanged.
[0072] Within the discrete action space, multiple predefined discrete adjustment instructions are sampled based on probability, and one instruction is randomly selected as the kernel parameter adjustment action. Since discrete actions usually correspond to verified and safe adjustment ranges, the risk of system crash due to outlier output values is reduced, and the safety of recommended kernel parameters is improved.
[0073] Therefore, regardless of whether it's a continuous or discrete action space, the policy network doesn't directly output a specific action value, but rather a probability distribution. For continuous actions, it randomly samples from a Gaussian distribution parameterized by (μ, σ) to obtain the specific action value. For example, sampling from N(-4.7, 1.5) yields -5.1. For discrete actions, it randomly samples from the probability distribution output by Softmax to select a specific action instruction.
[0074] In this process, the random sampling mechanism ensures that the reinforcement learning algorithm will not always choose the action that is currently considered optimal, but will have the opportunity to try suboptimal or new actions that may bring higher long-term rewards.
[0075] Finally, the sampled action values (continuous values or discrete instructions) are decoded into specific, executable system kernel parameter adjustment suggestions. Continuous values can be directly used as new parameter settings or increments. Discrete instructions need to be converted into specific arithmetic operations on the current parameter values.
[0076] In this embodiment, the preset parameter recommendation model is a reinforcement learning recommendation model, under which parameter tuning is modeled as a decision-making process. The policy network maximizes the cumulative reward during continuous state transitions, enabling the recommendation to not only focus on the immediate effect of a single adjustment but also consider the long-term impact of parameter adjustments on the subsequent states of the system, thus avoiding "short-sighted" behavior. The recommendation kernel parameters generated in this way are beneficial to the long-term stability and performance optimization of the system.
[0077] In some embodiments, the preset parameter recommendation model includes a Bayesian recommendation model; generating recommended kernel parameters based on the current state vector using the preset parameter recommendation model includes: generating corresponding performance prediction values and prediction uncertainties for each candidate parameter combination in the entire kernel parameter combination space of the Bayesian recommendation model based on the mapping relationship learned between the current state vector and the Bayesian recommendation model; and using the performance prediction values and prediction uncertainties as the target kernel parameter combination that maximizes the preset acquisition function in the entire kernel parameter combination space as the recommended kernel parameters.
[0078] In the above implementation process, a Bayesian recommendation model is pre-trained based on historical performance index data and corresponding historical kernel parameters.
[0079] The specific training process is as follows: Obtain the training dataset, where each historical record in the training dataset includes a historical state vector, the recommended kernel parameters under that historical state vector, and the corresponding historical performance results. The historical state vector consists of historical kernel parameters and corresponding historical performance metrics.
[0080] The Bayesian recommendation model learns a complex mapping relationship F(S_extended, X_new)->Y from the training dataset, where S_extended represents the historical state vector, X_new represents the recommended kernel parameters under that historical state vector, and Y represents the performance result. Based on this mapping relationship, a learning pattern is determined, for example: "When the system is under high memory usage and the current cache parameters are small, increasing the cache parameters often brings significant performance improvements"; or "When the current parameters are already quite aggressive, further increasing the parameters may yield minimal benefits or lead to instability."
[0081] After the Bayesian recommendation model is trained, the current state vector is input into the Bayesian recommendation model. At this time, the Bayesian recommendation model finds a brand-new combination of parameters for the current state vector to achieve the best prediction performance.
[0082] Specifically, the current state vector is paired with each candidate parameter combination in the entire kernel parameter combination space of the Bayesian recommendation model to form a conditional input pair. Using the mapping relationship already learned by the Bayesian recommendation model, prediction is made for each conditional input pair to obtain the corresponding performance prediction mean as the performance prediction value and the corresponding prediction variance as the prediction uncertainty. Based on the performance prediction value and the prediction uncertainty, the target kernel parameter combination that maximizes the preset acquisition function is selected as the recommendation kernel parameter in the entire kernel parameter combination space.
[0083] In one implementation, the Bayesian recommendation model is a Gaussian Process (GP) model. A Gaussian Process defines a prior distribution for the objective function. After accumulating some tried parameter combinations and their corresponding real performance data (i.e., observation points), the Gaussian Process can provide a predicted value (mean) and a measure of uncertainty (variance) for any point in the entire parameter space (i.e., an untried parameter combination) based on these observation points. Preset acquisition functions include the expected improvement function or the upper confidence bound function.
[0084] The Expected Improvement (EI) function measures the expected improvement a point can achieve relative to its current known optimum. It balances the search for areas with good predictive performance with the exploration of areas with high uncertainty.
[0085] The Upper Confidence Bound (UCB) is defined as UCB(x) = μ(x) + κ * σ(x), where μ(x) is the mean predicted by the Gaussian process model, σ(x) is the standard deviation, and κ is the balancing parameter. Bayesian recommendation models select the point that maximizes the UCB value, directly encouraging exploration in regions of high uncertainty.
[0086] In this embodiment, the preset parameter recommendation model is a Bayesian recommendation model. Under this model, the optimal solution can be automatically found, avoiding the problems of experience dependence, inefficiency, and difficulty in handling multi-dimensional coupling relationships inherent in traditional manual tuning or rule-based methods. Furthermore, by optimizing within the entire kernel parameter combination space based on the current state vector, it avoids getting trapped in local optima and improves the accuracy of the recommended kernel parameters.
[0087] In some embodiments, security verification is performed on the recommended kernel parameters, and the verified recommended kernel parameters are used as the tuning parameters of the target system. This includes: comparing and verifying the recommended kernel parameters with a predefined security policy rule base; if it is determined that each parameter in the recommended kernel parameters has passed the verification, then the recommended kernel parameters are used as the tuning parameters of the target system.
[0088] In the above implementation process, the target system loads the security policy rule base from a predefined configuration file (such as a YAML or JSON file). The security policy rule base explicitly defines the legal value range for each kernel parameter.
[0089] For example, kernel parameters include: vm.swappiness: minimum value 10, maximum value 80; net.ipv4.tcp_max_syn_backlog: minimum value 1024, maximum value 65536; and kernel.yama.ptrace_scope: allowed values are [1, 2, 3], and setting it to 0 is prohibited.
[0090] Then, the recommended kernel parameters are validated parameter by parameter. For example, the recommended kernel parameters are a_t=[p1_new, p2_new, ..., pY_new], and each kernel parameter in this vector is traversed.
[0091] For the i-th parameter p_i_new, the validation logic is as follows: If the security policy rule base defines a list of allowed values for p_i, check if p_i_new is in that list. If not, the validation fails. If the security policy rule base defines a minimum value (min) and a maximum value (max) for p_i, check if p_i_new satisfies min <= p_i_new <= max. If not, the validation fails.
[0092] If all recommended kernel parameters pass their respective rule checks, then the recommended kernel parameters pass the validation and are allowed to be executed.
[0093] If any of the recommended kernel parameters violates the corresponding rule, the recommended kernel parameter will be marked as an unqualified parameter and fed back to the preset parameter recommendation model for model optimization.
[0094] Specifically, when the recommended kernel parameter fails the verification, the target system does not simply discard the parameter, but transforms it into a special learning signal called constraint violation penalty, and integrates it into the update mechanism of the preset parameter recommendation model.
[0095] In reinforcement learning prediction models, the unqualified parameter (current state vector s_t, recommended kernel parameter a_t) is paired as a "bad example" experience tuple and assigned a very high negative reward r_penalty. For example, r_penalty = -100. This experience (s_t, a_t, r_penalty, s_{t+1}) is stored in an experience replay buffer. During model updates, the policy network learns that taking action a_t in state s_t will lead to extremely poor consequences, thus avoiding similar actions that would be rejected by safety rules in the future.
[0096] In a Bayesian prediction model, this unqualified parameter and its extremely low performance score (representing infeasibility) are added to the observation dataset. This makes the Bayesian surrogate model aware that the region is "bad" or "forbidden," thus affecting the calculation of the acquisition function and preventing the recommendation of nearby points in the future.
[0097] In this embodiment, the recommended kernel parameters are further verified for security, thereby constraining the tuning range, avoiding high-risk operations, and enhancing system reliability.
[0098] Figure 2 This is a schematic diagram of the electronic device structure provided in the embodiments of this application, such as... Figure 2As shown, the electronic device includes a processor 201, a memory 202, and a bus 203; wherein the processor 201 and the memory 202 communicate with each other via the bus 203. The processor 201 is used to call program instructions in the memory 202 to execute the methods provided in the above-described method embodiments.
[0099] Processor 201 can be an integrated circuit chip with signal processing capabilities. The aforementioned processor 201 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor.
[0100] The memory 202 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable red-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0101] This application provides a computer program product, including: computer program instructions, which are executed by a processor to perform the methods provided in the above-described method embodiments.
[0102] This application provides a computer-readable storage medium, including: computer program instructions stored on the computer-readable storage medium, which, when executed by a processor, perform the methods provided in the above-described method embodiments.
[0103] Computer-readable storage media can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0104] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0105] Furthermore, the units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0106] Furthermore, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0107] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A kernel parameter tuning method, characterized in that, The method includes: Obtain the current performance metrics data and kernel parameters to be tuned for the target system; Generate a current state vector based on the current performance metrics data and the kernel parameters to be tuned; A preset parameter recommendation model is used to generate recommended kernel parameters based on the current state vector; wherein, the preset parameter recommendation model is trained and generated based on historical performance index data and corresponding historical kernel parameters; The recommended kernel parameters are subjected to security verification, and the verified recommended kernel parameters are used as the tuning parameters of the target system to support the operation of the target system.
2. The method according to claim 1, characterized in that, in, The preset parameter recommendation model includes a reinforcement learning recommendation model; The step of using a preset parameter recommendation model to generate recommendation kernel parameters based on the current state vector includes: The policy network of the reinforcement learning recommendation model generates action distribution parameters based on the current state vector. Random sampling is performed based on the action distribution parameters to obtain kernel parameter adjustment actions; Based on the kernel parameter adjustment actions, the recommended kernel parameters are generated.
3. The method according to claim 2, characterized in that, in, The action distribution parameters include the probability distribution in the continuous action space; The step of randomly sampling based on the action distribution parameters to obtain kernel parameter adjustment actions includes: Sampling is performed based on the mean and standard deviation of the probability distribution to obtain continuous parameter adjustment values as the kernel parameter adjustment action.
4. The method according to claim 2, characterized in that, in, The action distribution parameters include the probabilities of selectable actions in the discrete action space; The step of randomly sampling based on the action distribution parameters to obtain kernel parameter adjustment actions includes: Based on the probability, multiple predefined discrete adjustment instructions are sampled, and one instruction is randomly selected as the kernel parameter adjustment action.
5. The method according to claim 1, characterized in that, in, The preset parameter recommendation model includes a Bayesian recommendation model; The step of using a preset parameter recommendation model to generate recommendation kernel parameters based on the current state vector includes: Based on the mapping relationship learned by the current state vector and the Bayesian recommendation model, a corresponding performance prediction value and prediction uncertainty are generated for each candidate parameter combination in the entire kernel parameter combination space of the Bayesian recommendation model. Based on the performance prediction value and the prediction uncertainty, the target kernel parameter combination that maximizes the preset acquisition function is selected as the recommended kernel parameter in the entire kernel parameter combination space.
6. The method according to claim 5, characterized in that, The process of generating corresponding performance prediction values and prediction uncertainties for each candidate parameter combination in the entire kernel parameter combination space of the Bayesian recommendation model, based on the mapping relationship learned by the current state vector and the Bayesian recommendation model, includes: The current state vector is paired with each candidate parameter combination in the entire kernel parameter combination space to form a conditional input pair; Using the mapping relationship already learned by the Bayesian recommendation model, prediction is performed on each of the conditional input pairs to obtain the corresponding performance prediction mean as the performance prediction value, and the corresponding prediction variance as the prediction uncertainty.
7. The method according to claim 5, characterized in that, in, The preset acquisition function includes the expected improvement function or the upper confidence bound function.
8. The method according to claim 1, characterized in that, The step of performing security verification on the recommended kernel parameters and using the verified recommended kernel parameters as the tuning parameters of the target system includes: The recommended kernel parameters are compared and verified against a predefined security policy rule base. If each parameter in the recommended kernel parameters passes the verification, then the recommended kernel parameters are used as the tuning parameters for the target system.
9. The method according to any one of claims 1-8, characterized in that, The step of generating the current state vector based on the current performance metric data and the kernel parameters to be tuned includes: The current performance metrics data and the kernel parameters to be tuned are standardized to generate standard performance metrics parameters and standard kernel parameters to be tuned. The standard performance index parameters and the standard kernel parameters to be tuned are concatenated to generate the current state vector.
10. An electronic device, characterized in that, include: A processor and a memory, the memory storing machine-readable instructions executable by the processor, which, when executed by the processor, perform the method as described in any one of claims 1 to 9.