Resource configuration optimization method and device, computer equipment and storage medium
By acquiring system operating parameters and historical data, and combining them with predictive models to optimize the connection pool configuration, the problem of insufficient or excessive connection pool configuration is solved, achieving stability and resource utilization efficiency in high-concurrency scenarios, and reducing the frequency of manual maintenance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SUNING COM CO LTD
- Filing Date
- 2026-01-29
- Publication Date
- 2026-05-19
AI Technical Summary
Existing technologies lack dynamic adaptation capabilities in connection pool configuration, leading to insufficient connections and system anomalies during high concurrency, and resource waste during low traffic. Furthermore, relying on manual experience and simple threshold alarms is inefficient.
By acquiring system operating parameters, comprehensively analyzing the connection pool status, and combining historical parameters and predictive models to generate adjustment strategies, the connection pool configuration is dynamically optimized, achieving automation and self-healing capabilities. This ensures rapid scaling up and down in high-concurrency scenarios, reducing the need for manual operation and maintenance.
It improves resource utilization, enhances system stability and response performance, reduces anomaly handling latency, and enables intelligent and self-healing capabilities of the connection pool.
Smart Images

Figure CN122064487A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of resource allocation technology, and in particular to a resource allocation optimization method, apparatus, computer equipment, and storage medium. Background Technology
[0002] In application servers, connection pools are a key component for managing database connections, used to reuse connections to improve system performance. Currently, common connection pool configurations often use a fixed initial number of connections and a fixed maximum number of connections. This static configuration can basically meet the needs in daily scenarios, but it is difficult to cope with traffic fluctuations in actual business operations, and problems are prone to occur, especially in high-concurrency scenarios such as promotional events.
[0003] Current technologies primarily rely on manual experience to set connection pool parameters or use simple threshold alarms for notifications, lacking in-depth analysis and intelligent diagnostics of system operation status. When connection timeouts or request anomalies occur, maintenance personnel typically need to manually intervene to analyze logs and adjust parameters, resulting in untimely and inefficient handling. Furthermore, fixed configurations lead to insufficient connections during high concurrency, causing system anomalies, while idle connections during low traffic result in resource waste, and there is a lack of automatic self-healing and dynamic adaptation capabilities. Summary of the Invention
[0004] This application provides a resource allocation optimization method, apparatus, computer equipment, and storage medium that can improve system resource utilization efficiency and enhance adaptability to business load fluctuations.
[0005] On the one hand, this application provides a resource allocation optimization method, including: In response to the arrival of a preset time, the system's operating parameters are obtained; A comprehensive analysis of the operating parameters is conducted to determine the operating status of the connection pool; If the system is running normally, then retrieve the system's historical operating parameters. Based on historical operating parameters, preset adjustment rules, and prediction models, the resource requirements of the connection pool are analyzed, and a first adjustment strategy and a second adjustment strategy are generated respectively. Then, according to preset decision rules, the first adjustment strategy and the second adjustment strategy are fused to generate a parameter adjustment strategy. Adjust the configuration parameters of the connection pool according to the parameter adjustment strategy; In response to the completion of parameter adjustment, the system collects and verifies the operating parameters. If the system performance degrades or becomes abnormal, the system rolls back the parameters.
[0006] On the other hand, this application provides a resource allocation optimization apparatus, the apparatus comprising: The operating parameter acquisition module is used to acquire the system's operating parameters in response to the arrival of a preset time. The status analysis module is used to perform comprehensive analysis of operating parameters to determine the operating status of the connection pool; The historical parameter acquisition module is used to acquire the system's historical operating parameters when the operating status is normal. The adjustment strategy generation module is used to analyze the resource requirements of the connection pool based on historical operating parameters, preset adjustment rules and prediction models, generate a first adjustment strategy and a second adjustment strategy respectively, and merge the first adjustment strategy and the second adjustment strategy according to preset decision rules to generate a parameter adjustment strategy. The execution module is used to adjust the configuration parameters of the connection pool according to the parameter adjustment strategy; The verification module is used to collect operating parameters and perform verification analysis in response to the completion of parameter adjustment. If the system performance degrades or becomes abnormal, the module will perform a parameter rollback operation.
[0007] In another aspect, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the resource allocation optimization method described in the first aspect.
[0008] In another aspect, this application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the resource allocation optimization method described in the first aspect.
[0009] This application implements a resource allocation optimization method, device, computer equipment, and storage medium. When operating normally, this method generates a rule-driven first adjustment strategy and a prediction-driven second adjustment strategy based on historical operating parameters, preset adjustment rules, and a prediction model. These strategies are then fused using preset decision rules to generate a more robust parameter adjustment strategy, thereby dynamically optimizing the connection pool's configuration parameters. This allows the connection pool to quickly expand to avoid connection exhaustion during business load fluctuations, and also to scale down to release resources in a timely manner, improving resource utilization and enhancing system stability and response performance in high-concurrency scenarios. Simultaneously, after parameter adjustment, operating parameters are collected for verification and analysis. If performance degradation or anomalies are detected, a rollback operation is immediately performed to ensure the adjustment process is safe and controllable, avoiding the introduction of new system risks due to improper adjustments. Overall, this method achieves intelligent, automated, and self-healing capabilities for connection pool configuration, significantly reducing the need for manual operation and maintenance intervention and anomaly handling latency. Attached Figure Description
[0010] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a flowchart of a resource configuration optimization method in one embodiment.
[0012] Figure 2 This is a structural diagram of a resource allocation optimization method in one embodiment.
[0013] Figure 3 This is a diagram showing the internal structure of a computer device in an embodiment of this application. Detailed Implementation
[0014] 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.
[0015] In one embodiment, such as Figure 1 As shown, a resource allocation optimization method is provided, including: S100: In response to the arrival of a preset time, obtain the system's operating parameters; S200: Perform a comprehensive analysis of the operating parameters to determine the operating status of the connection pool; S300: In response to a normal operating status, the system's historical operating parameters are obtained; S400: Based on historical operating parameters, preset adjustment rules and prediction models, analyze the resource requirements of the connection pool, generate a first adjustment strategy and a second adjustment strategy respectively, and merge the first adjustment strategy and the second adjustment strategy according to preset decision rules to generate a parameter adjustment strategy. S500: Adjusts the configuration parameters of the connection pool according to the parameter adjustment strategy; S600: In response to the completion of parameter adjustment, it collects operating parameters and performs verification analysis. If the system performance degrades or becomes abnormal, it performs parameter rollback operation.
[0016] The system includes the following components: Preset Time: Pre-configured timed trigger points, such as at fixed time intervals (e.g., every 5 minutes or hour) or specific scheduling moments; Operating Parameters: Real-time indicators reflecting the current operating status of the application server and connection pool; Historical Operating Parameters: Operating parameter data collected and stored by the system over a past period; Preset Adjustment Rules: Predefined thresholds and adjustment logic based on experience or business characteristics, such as rule-driven adjustment strategies that suggest increasing the number of connections when connection utilization exceeds 80%; Predictive Model: A pre-trained machine learning or statistical model (e.g., a time series prediction model) used to predict connection pool resource demand over a future period based on historical operating parameters; First Adjustment Strategy: A rule-driven adjustment scheme generated by the preset adjustment rules, more conservative and responsive but lacking foresight; Second Adjustment Strategy: A prediction-driven adjustment scheme generated by the predictive model, more forward-looking and able to anticipate upcoming load fluctuations; Preset Decision Rules: Rules used to integrate the first and second adjustment strategies. The method runs on a server-side resource management system.
[0017] Specifically, upon reaching a preset time, the system automatically acquires and comprehensively analyzes operating parameters to quickly determine the connection pool's operating status. The optimization process only begins when the status is normal, avoiding adjustments that could exacerbate risks when the system is already abnormal. Based on historical operating parameters, the system simultaneously triggers preset adjustment rules and predictive models to generate a first and second adjustment strategy in parallel. These strategies are then fused using preset decision rules to obtain a parameter adjustment strategy that combines rule stability with predictive foresight. This allows the connection pool to expand in advance before business load increases and shrink in time after load decreases, achieving higher resource utilization and a lower connection acquisition failure rate. After adjustment, operating parameters are immediately collected for verification and analysis. If a system performance degradation or anomaly is detected, parameter rollback is quickly executed, ensuring the entire optimization process is safe, controllable, and traceable. This significantly improves the stability and self-healing capabilities of applications in high-concurrency and fluctuating load scenarios, while greatly reducing the frequency and latency of manual monitoring and intervention, achieving automated connection pool resource management.
[0018] In one embodiment, based on historical operating parameters, preset adjustment rules, and a prediction model, the resource requirements of the connection pool are analyzed, and a first adjustment strategy and a second adjustment strategy are generated, including: Feature extraction is performed on historical operating parameters to obtain characteristic information of the connection pool load; Based on the comparison between feature information and preset adjustment rules, it is determined whether the current resource status of the connection pool meets the preset adjustment trigger conditions. In response to the fulfillment of the adjustment triggering conditions, the connection pool configuration parameters that need to be adjusted are determined, and the adjustment direction and magnitude are calculated according to the preset adjustment rules to generate the first adjustment strategy; The feature information is input into the prediction model to obtain the resource demand prediction results within a preset future time window. Based on the prediction results, the target values of the connection pool configuration parameters are calculated to generate a second adjustment strategy.
[0019] Among them, the preset future time window refers to the future time range that the prediction model focuses on, such as the next 15 minutes, 1 hour, or the preset prediction horizon based on the business cycle (such as a major promotion period), which is used to assess the upcoming changes in resource demand; the resource demand prediction result is the quantitative prediction value of the number of connections required by the connection pool, the utilization rate, or the peak load output by the prediction model within the future time window; the target value is the ideal target setting value of the connection pool configuration parameters (such as the minimum number of connections and the maximum number of connections) calculated based on the resource demand prediction result, which usually takes into account a certain safety margin to cope with the uncertainty of prediction.
[0020] Specifically, the system extracts key feature information (such as recent peak connection utilization, average waiting time, and load fluctuation trends) from historical operating parameters. It then quickly matches these features with preset adjustment rules, such as checking whether the current utilization has continuously exceeded 80% or whether the waiting queue is too long. Once the trigger condition is met, the system immediately calculates the specific adjustment direction (increase or decrease) and magnitude (e.g., by 10% or a fixed increment of 5 connections) based on the constraint relationship defined in the rule (the minimum number of connections needs to be increased when the utilization is >80%). This quickly generates the first adjustment strategy, enabling immediate correction of current resource shortages or excesses and preventing connection acquisition failures or continuous deterioration of idle resources. At the same time, the system directly inputs the same feature information into a pre-trained prediction model (e.g., a time series model based on ARIMA or LSTM). The model combines historical patterns to output a load peak prediction for the next 15-60 minutes and calculates a target configuration value with a safety margin (if the peak is expected to require 80 connections, the maximum number of connections is set to 90). This generates the second adjustment strategy, enabling the connection pool to pre-expand before the traffic arrives or proactively shrink after the peak subsides to release database pressure. This parallel execution of rule-driven immediate response and prediction-driven advance planning allows adjustment strategies to not only quickly stop current problems but also proactively prevent future risks. It significantly improves the accuracy of resource prediction, response timeliness, and overall utilization efficiency of the connection pool in complex scenarios such as sudden high concurrency and major promotions, while reducing the probability of adjustment errors caused by deviations in a single strategy.
[0021] In one embodiment, in response to meeting the adjustment trigger condition, the connection pool configuration parameters that need to be adjusted are determined, and the adjustment direction and magnitude are calculated according to preset adjustment rules to generate a first adjustment strategy, including: The current resource status of the connection pool is analyzed based on feature information, and the connection pool configuration parameters associated with the current resource status are determined by combining the corresponding resource status constraints in the preset adjustment rules. Based on the degree of deviation of the resource status from the constraint relationship, the adjustment direction and corresponding adjustment magnitude of the connection pool configuration parameters are calculated to obtain the first adjustment strategy for correcting the current connection pool configuration parameters.
[0022] The adjustment trigger conditions refer to the specific conditions that trigger the generation of adjustment strategies under the premise that the connection pool is operating normally, such as the current connection pool utilization rate exceeding a preset threshold, the waiting queue length being too long, or a significant change in future load being predicted; Feature information refers to key feature data extracted from current and historical operating parameters, such as peak connection utilization, average acquisition time, and load fluctuation amplitude, used for resource status analysis; Current resource status refers to the current resource utilization and supply-demand matching of the connection pool as determined by feature information analysis, typically including states such as sufficient, tight, or surplus resources; Resource status constraint relationship refers to the correspondence between the ideal resource status defined in the preset adjustment rules and the connection pool configuration parameters, such as the minimum and maximum connection number range constraints corresponding to "connection utilization rate should be maintained between 60% and 80%"; Adjustment direction refers to the increase or decrease of connection pool configuration parameters, such as increasing the minimum or maximum number of connections (expansion) or decreasing (shrinkage); Adjustment magnitude refers to the specific adjustment value or proportion of the connection pool configuration parameters, such as increasing 10 connections or increasing the maximum number of connections by 20%.
[0023] Specifically, after the adjustment triggering conditions are met, the current resource status is analyzed based on feature information, and combined with the predefined resource status constraints in the preset adjustment rules, the specific connection pool configuration parameters that need to be adjusted are quickly identified, avoiding unnecessary risks caused by blind global adjustments. The adjustment direction and magnitude are accurately calculated based on the degree of deviation of the current resource status from the ideal constraint relationship, generating a highly targeted first adjustment strategy. This enables the connection pool to quickly converge to the ideal resource state. For example, when resources are scarce, the pool can be expanded in a timely manner to reduce the risk of connection acquisition timeouts, and when resources are abundant, the pool can be scaled down appropriately to release idle connections and database resources. This significantly improves the accuracy and real-time performance of rule-driven adjustments, ensuring that the first adjustment strategy is both conservative and reliable as well as efficient and practical. This provides a robust foundation for subsequent integration with prediction-driven strategies and further enhances the resource utilization efficiency and system stability of the entire optimization scheme in high-concurrency and fluctuating scenarios.
[0024] In one embodiment, feature information is input into a prediction model to obtain resource demand prediction results within a preset future time window, and target values for connection pool configuration parameters are calculated based on the prediction results to generate a second adjustment strategy, including: Feature information is input into a pre-trained prediction model to obtain predicted resource demand values within a future time window; Calculate the target values for the connection pool parameters based on the predicted values, and generate a second adjustment strategy based on the target values.
[0025] During operation, the system periodically collects characteristic information from the connection pool and the business side, such as the number of requests per unit time, the number of active connections, the number of idle connections, the number of connection timeouts, and the average response time. This characteristic information is then fed into a pre-trained prediction model, which outputs the resource demand prediction results within a preset future time window.
[0026] The resource demand forecast results include at least the peak or average connection usage within the future time window. Based on the resource demand forecast results and according to preset parameter calculation rules, the system obtains target values for connection pool configuration parameters (such as maximum pool size, minimum pool size, etc.). Then, based on these target values, a second adjustment strategy is generated to automatically adjust the connection pool configuration parameters in subsequent timeframes. Through this process, the connection pool configuration can be dynamically optimized in advance based on predicted load, avoiding passive adjustments only after congestion occurs, thereby improving system stability and resource utilization under load fluctuations.
[0027] In one embodiment, a parameter adjustment strategy is generated by fusing the first adjustment strategy and the second adjustment strategy according to a preset decision rule, including: Based on the preset decision-making rules, the adjustment directions of the first adjustment strategy and the second adjustment strategy are determined; Since the adjustment directions of the first adjustment strategy and the second adjustment strategy are consistent, the corresponding adjustment magnitudes are combined and calculated to determine the parameter adjustment strategy; In response to the inconsistency between the adjustment directions of the first adjustment strategy and the second adjustment strategy, the adjustment strategy with higher credibility or higher priority is selected as the parameter adjustment strategy according to the preset decision rules. The established parameter adjustment strategy is constrained to limit the magnitude of each adjustment and ensure that the legal value range of the connection pool configuration parameters is met.
[0028] Specifically, the system judges the adjustment direction of the first and second adjustment strategies according to preset decision rules, quickly determining whether they are consistent. When the adjustment directions are consistent, the final parameter adjustment strategy is determined by merging the corresponding adjustment magnitudes (such as weighted average or taking the larger value to be conservative), thereby strengthening the commonly recognized adjustment strength and avoiding insignificant optimization effects due to insufficient magnitude of a single strategy. When the adjustment directions are inconsistent, the system selects a strategy with higher credibility or higher priority according to preset decision rules (such as prioritizing rule-driven strategies to ensure immediate security, or prioritizing predictive strategies to reflect foresight), and directly uses it as the parameter adjustment strategy, thereby resolving conflicts and preventing risks introduced by aggressive adjustments. Finally, the determined parameter adjustment strategies are uniformly constrained to limit the magnitude of a single adjustment and force all connection pool configuration parameters to fall within the legal value range, avoiding connection pool instability or invalid configuration due to excessive adjustments. This fusion process, which involves conditional judgment, merging, or selection followed by constraint, ensures that the final parameter adjustment strategy inherits the reliability and immediacy of rule-driven approaches while incorporating the forward-looking optimization capabilities of prediction-driven approaches. Through strict security constraints, it significantly reduces the probability of adjustment errors, achieving more balanced and controllable dynamic optimization of the connection pool under complex load scenarios. This significantly improves the overall resource utilization efficiency, system stability, and adaptability of the data source.
[0029] Suppose the first adjustment strategy suggests increasing the maximum number of connections from 50 to 65 (magnitude +15), and the second adjustment strategy suggests increasing it to 70 (magnitude +20). Since both strategies are aligned, the final adjustment to 68 can be calculated by weighted averaging or taking the larger value after merging. If the first adjustment strategy suggests increasing to 65, while the second adjustment strategy suggests decreasing to 45 (directional conflict), then the decision rule prioritizes the increase in the first adjustment strategy to ensure immediate relief from current resource constraints. The final determined adjustment magnitude will also be subject to constraints, such as a maximum allowable increase of 10 at a time. In this case, the actual parameter adjustment strategy will only increase to 60, thus safely completing the optimization.
[0030] In one embodiment, the method further includes: In response to an abnormal operating status, the configuration parameters of the connection pool are adjusted according to the preset emergency handling strategy.
[0031] Among them, the preset emergency handling strategy is a set of predefined rapid intervention measures for abnormal operation of the connection pool. It usually includes emergency operations such as conservative expansion (such as temporarily and significantly increasing the maximum number of connections), restarting the connection pool, clearing failed connections or switching to a backup data source. The aim is to quickly alleviate the anomaly and restore system availability, rather than pursuing optimal resource utilization.
[0032] Specifically, when a comprehensive analysis of operational parameters determines that the connection pool's operational status is abnormal (such as connection leaks, severe database response timeouts, or a rapid backlog in the waiting queue), the system no longer enters the conventional prediction and rule-based optimization process. Instead, it immediately switches to a pre-defined emergency handling strategy, directly implementing predefined conservative adjustments to the connection pool configuration parameters. For example, this might involve automatically and temporarily increasing the maximum number of connections to quickly replenish available connections, clearing long-idle or failed connections to release resources, or, in extreme cases, triggering a connection pool restart to re-establish healthy connections. This emergency handling prioritizes preventing system crashes and large-scale connection acquisition failures, thus buying time for subsequent manual intervention or root cause analysis. Once the emergency adjustments are complete, the system can return to the regular monitoring loop, gradually entering the refined optimization process after the status returns to normal. This clear separation of normal and abnormal paths gives the optimization method stronger fault tolerance and rapid recovery capabilities in the face of sudden failures or extreme loads, reducing the risk of service interruptions caused by connection pool anomalies.
[0033] In one embodiment, a comprehensive analysis of operating parameters is performed to determine the operating status of the connection pool. These operating parameters include at least: connection pool operating data, business performance data, database performance data, and middleware log monitoring data, including: Determine the connection utilization rate and connection waiting time of the connection pool based on the connection pool operation data; Determine business concurrency and request response time based on business performance data; Determine database connection utilization, as well as processor and memory utilization, based on database performance data; According to the middleware log monitoring data, the error rate and number of connection timeouts that could not be obtained were statistically analyzed. The connection pool health index is calculated using a preset weighted model based on connection utilization, connection wait time, business concurrency, request response time, database connection utilization, processor and memory utilization, error rate, and number of connection timeouts. The connection pool health index is compared with a preset threshold to determine whether the connection pool is operating normally or abnormally.
[0034] The connection pool includes: operation data (collected directly from connection pool monitoring metrics, such as current active connections, idle connections, and waiting queue length); business performance data (indicators reflecting application layer business processing, such as current concurrent requests, average request response time, and throughput); connection utilization (the proportion of used connections in the connection pool to the total available connections, used to measure the scarcity of connection resources); connection waiting time (the average or peak waiting time in the waiting queue when requesting a connection; excessively long waiting times indicate insufficient connection supply); middleware, as an intermediary component between the application and the database, records connection acquisition failures, connection timeouts, and other anomalies through logs and monitoring information to help determine the connection pool's operational status; it also provides a connection pool management interface for dynamically adjusting connection pool configuration parameters; connection pool parameters can be adjusted through the management interface provided by the middleware; and a predefined weighted model (a predefined calculation formula or algorithm).
[0035] Specifically, the system collects key indicators from multiple data sources, including calculating connection utilization and connection waiting time based on connection pool operation data, evaluating business concurrency and request response time based on business performance data, obtaining database connection utilization and processor memory utilization from database performance data, and statistically analyzing error rate and connection timeout counts through middleware log monitoring data. These indicators cover the entire chain from connection pool internal supply, business demand pressure, database resource bottlenecks to actual abnormal performance, avoiding misjudgment based on a single dimension. Subsequently, these quantitative indicators are input into a preset weighted model. For example, connection waiting time and error rate are given higher weights to highlight serious problems, while processor memory utilization is given a medium weight to reflect underlying constraints. A unified connection pool health index is calculated through weighted summation or machine learning fusion. Finally, this index is compared with a preset threshold (e.g., above 80 points is normal) to quickly determine whether the operating status is normal or abnormal. This multi-source data fusion judgment mechanism enables the system to detect hidden problems such as progressive connection leaks or indirect effects caused by database-side bottlenecks as early as possible, rather than relying solely on surface indicators, thereby significantly improving the sensitivity and reliability of status determination; when an anomaly is determined, it can immediately switch to the emergency handling path to avoid amplifying the risk, and only when it is determined to be normal will it enter the refined optimization process to ensure safe adjustments.
[0036] In one embodiment, in response to the completion of parameter adjustment, operating parameters are collected and verified. If system performance degrades or becomes abnormal, a parameter rollback operation is performed, including: Before adjusting the connection pool's configuration parameters according to the parameter adjustment strategy, save the current configuration parameters of the connection pool as a rollback configuration; In response to the completion of configuration parameter writing, the operating parameters associated with the connection pool are collected within the preset observation period according to the preset sampling period; Calculate at least one performance evaluation data based on the operating parameters, and compare the at least one performance evaluation data with a preset performance threshold to obtain the comparison result; When the comparison result meets the rollback trigger condition, the connection pool configuration parameters are restored to the rollback configuration.
[0037] Among them, rollback configuration: a copy of the current configuration parameters of the connection pool saved before adjustment, used to quickly restore the original state in case of verification failure; preset observation period: a fixed time window for monitoring the effect after the parameter adjustment is completed, such as 5-15 minutes; preset sampling period: the interval between collecting running parameters within the observation period, such as once every 30 seconds.
[0038] Specifically, before executing the parameter adjustment strategy, the system first saves the current connection pool configuration parameters as a rollback configuration. After the adjustment is written, the system continuously collects operating parameters at a preset sampling period within a preset observation period, and calculates at least one performance evaluation data (such as average waiting time or error rate) in real time based on this. The calculated performance evaluation data is compared with a preset performance threshold. If the comparison result meets the rollback trigger condition (such as the waiting time increasing by more than 50% compared to before the adjustment or the error rate exceeding the threshold), the configuration parameters are immediately restored to the rollback configuration, achieving rapid rollback. This verification and rollback closed loop effectively prevents performance degradation caused by erroneous adjustments or unexpected environmental changes, ensuring that each optimization is carried out within a controllable range, avoiding the continuous negative impact of adjustment errors on the production system, and improving the fault tolerance and overall stability of the connection pool dynamic optimization.
[0039] Suppose the system increases the maximum number of connections from 50 to 70 according to a parameter adjustment strategy, with a rollback configuration of 50 saved before the adjustment. During the subsequent 10-minute observation period, operating parameters are sampled every minute. If the average connection wait time increases from 80ms before the adjustment to 300ms, and the connection acquisition failure rate exceeds 5% (exceeding a preset performance threshold), and the comparison results meet the rollback trigger conditions, the system automatically restores the maximum number of connections to 50 and records the adjustment failure log for subsequent analysis. Conversely, if the wait time decreases to 50ms and the failure rate is below 1%, the verification is successful, the new configuration is retained, and the rollback configuration is cleared.
[0040] In one embodiment, generating a corresponding parameter adjustment strategy includes: Adjustment constraints are set for connection pool capacity, connection pool active connection limit and timeout control parameters respectively. When the time interval between two adjacent adjustments to the same configuration parameter is less than the preset minimum adjustment interval, the configuration parameter is not included in the parameter adjustment strategy. When the deviation between the target configuration value and the current configuration parameter exceeds a preset threshold, the corresponding configuration parameter is added to the parameter adjustment strategy. The target configuration values of each configuration parameter added to the parameter adjustment strategy are limited to a preset resource safety range.
[0041] Among them, adjustment constraints are restriction rules for key configurations such as connection pool capacity, active connection limit, and timeout control parameters, which are used to prevent instability caused by frequent adjustments or excessive deviations.
[0042] Preset minimum adjustment interval: The minimum time interval between two consecutive adjustments to the same configuration parameter, such as 5-10 minutes, to avoid oscillations caused by repeated adjustments in a short period of time; Preset threshold: A threshold used to determine whether the deviation between the target configuration value and the current configuration parameter is significant, such as a deviation exceeding 20% or a fixed value of 10 connections; Preset resource safety range: The upper and lower limit ranges predefined for each configuration parameter to ensure that the adjustment does not exceed the system's resource capacity.
[0043] Specifically, the system sets adjustment constraints for connection pool capacity, active connection limit, and timeout control parameters. When the time interval between two consecutive adjustments to the same parameter is less than the preset minimum adjustment interval, the parameter is excluded from adjustment in this instance to prevent frequent changes from causing connection pool oscillations. Only when the deviation between the target configuration value and the current configuration parameter exceeds a preset threshold is the corresponding parameter included in the parameter adjustment strategy, avoiding unnecessary intervention for minor deviations. All included parameters are uniformly limited to target configuration values within a preset resource safety range to ensure that excessive expansion will not exhaust database resources or excessive shrinkage will not affect business operations. This multi-layered constraint mechanism effectively filters out inefficient or high-risk adjustments, making the final parameter adjustment strategy more reasonable and conservative, significantly reducing adjustment frequency and resource overflow probability, and achieving the stability and long-term reliability of dynamic connection pool optimization.
[0044] In one embodiment, such as Figure 2 As shown, this application provides a resource allocation optimization device, which includes: an operating parameter acquisition module 210, a status analysis module 220, a historical parameter acquisition module 230, an adjustment strategy generation module 240, an execution module 250, and a verification module 260, including: The operating parameter acquisition module 210 is used to acquire the operating parameters of the system in response to the arrival of a preset time; The status analysis module 220 is used to perform comprehensive analysis of operating parameters to determine the operating status of the connection pool; The historical parameter acquisition module 230 is used to acquire the historical operating parameters of the system in response to the normal operating status. The adjustment strategy generation module 240 is used to analyze the resource requirements of the connection pool based on historical operating parameters, preset adjustment rules and prediction models, generate a first adjustment strategy and a second adjustment strategy respectively, and merge the first adjustment strategy and the second adjustment strategy according to preset decision rules to generate a parameter adjustment strategy. Execution module 250 is used to adjust the configuration parameters of the connection pool according to the parameter adjustment strategy; The verification module 260 is used to collect operating parameters and perform verification analysis in response to the completion of parameter adjustment. If the system performance degrades or becomes abnormal, it performs parameter rollback operation.
[0045] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above-described resource allocation optimization method embodiments at runtime.
[0046] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0047] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described resource allocation optimization method embodiments.
[0048] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in connection with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both, such as Figure 3 As shown, to clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described in terms of functionality in the above description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0049] The resource allocation optimization method provided in this application has been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and its core ideas. It should be noted that those skilled in the art can make several improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A resource allocation optimization method, characterized in that, include: In response to the arrival of a preset time, the system's operating parameters are obtained; The operating parameters are comprehensively analyzed to determine the operating status of the connection pool; If the operating status is normal, then the historical operating parameters of the system are obtained; Based on the historical operating parameters, preset adjustment rules, and prediction models, the resource requirements of the connection pool are analyzed, and a first adjustment strategy and a second adjustment strategy are generated respectively. Then, according to preset decision rules, the first adjustment strategy and the second adjustment strategy are fused to generate a parameter adjustment strategy. The configuration parameters of the connection pool are adjusted according to the parameter adjustment strategy. Upon completion of parameter adjustment, the system collects and verifies the operating parameters. If system performance degrades or becomes abnormal, a parameter rollback operation is performed.
2. The resource allocation optimization method according to claim 1, characterized in that, Based on the historical operating parameters, preset adjustment rules, and prediction models, the resource requirements of the connection pool are analyzed, and a first adjustment strategy and a second adjustment strategy are generated, including: Feature extraction is performed on the historical operating parameters to obtain the characteristic information of the connection pool load; Based on the comparison between the feature information and the preset adjustment rules, it is determined whether the current resource status of the connection pool meets the preset adjustment triggering conditions. In response to the fulfillment of the adjustment triggering conditions, the connection pool configuration parameters that need to be adjusted are determined, and the adjustment direction and magnitude are calculated according to the preset adjustment rules to generate the first adjustment strategy; The feature information is input into the prediction model to obtain the resource demand prediction result within a preset future time window. Based on the prediction result, the target value of the connection pool configuration parameter is calculated to generate a second adjustment strategy.
3. The resource allocation optimization method according to claim 2, characterized in that, In response to the fulfillment of the adjustment trigger condition, the connection pool configuration parameters that need to be adjusted are determined, and the adjustment direction and magnitude are calculated according to preset adjustment rules to generate a first adjustment strategy, including: Based on the feature information, the current resource status of the connection pool is analyzed, and combined with the corresponding resource status constraint relationship in the preset adjustment rules, the connection pool configuration parameters associated with the current resource status are determined. Based on the degree of deviation of the resource status from the constraint relationship, the adjustment direction and corresponding adjustment magnitude of the connection pool configuration parameters are calculated to obtain the first adjustment strategy for correcting the current connection pool configuration parameters.
4. The resource allocation optimization method according to claim 2, characterized in that, The step of fusing the first adjustment strategy and the second adjustment strategy according to preset decision rules to generate a parameter adjustment strategy includes: According to the preset decision rules, the adjustment directions of the first adjustment strategy and the second adjustment strategy are determined; In response to the fact that the adjustment directions of the first adjustment strategy and the second adjustment strategy are consistent, the corresponding adjustment magnitudes are combined and calculated to determine the parameter adjustment strategy; In response to the inconsistency between the adjustment directions of the first adjustment strategy and the second adjustment strategy, an adjustment strategy with higher credibility or higher priority is selected as the parameter adjustment strategy according to a preset decision rule. The determined parameter adjustment strategy is constrained to limit the magnitude of a single adjustment and ensure that the legal value range of the connection pool configuration parameters is met.
5. The resource allocation optimization method according to claim 1, characterized in that, The method further includes: In response to the abnormal operating status, the configuration parameters of the connection pool are adjusted according to the preset emergency handling strategy.
6. The resource allocation optimization method according to claim 1, characterized in that, A comprehensive analysis of the operating parameters is performed to determine the operating status of the connection pool. These operating parameters include at least: connection pool operating data, business performance data, database performance data, and middleware log monitoring data, including: The connection utilization rate and connection waiting time of the connection pool are determined based on the connection pool operation data. The business concurrency and request response time are determined based on the business performance data. Determine the database connection utilization, processor and memory utilization based on the database performance data; Based on the middleware log monitoring data, the error rate and number of connection timeouts that could not be obtained are statistically analyzed. Based on the connection utilization, connection waiting time, business concurrency, request response time, database connection utilization, processor and memory utilization, error rate, and connection timeout count, a connection pool health index is calculated using a preset weighted model. The connection pool health index is compared with a preset threshold to determine whether the connection pool is operating normally or abnormally.
7. The resource allocation optimization method according to claim 1, characterized in that, Upon completion of parameter adjustment, the system collects and verifies the operating parameters. If system performance degrades or becomes abnormal, a parameter rollback operation is performed, including: Before adjusting the configuration parameters of the connection pool according to the parameter adjustment strategy, the current configuration parameters of the connection pool are saved as a rollback configuration; In response to the completion of configuration parameter writing, the operating parameters associated with the connection pool are collected within a preset observation period according to a preset sampling period; Calculate at least one performance evaluation data based on the operating parameters, and compare the at least one performance evaluation data with a preset performance threshold to obtain a comparison result; When the comparison result meets the rollback trigger condition, the configuration parameters of the connection pool are restored to the rollback configuration.
8. A resource allocation optimization device, characterized in that, The device includes: The operating parameter acquisition module is used to acquire the system's operating parameters in response to the arrival of a preset time. The status analysis module is used to perform comprehensive analysis of the operating parameters to determine the operating status of the connection pool; The historical parameter acquisition module is used to acquire the historical operating parameters of the system in response to the normal operating status. The adjustment strategy generation module is used to analyze the resource requirements of the connection pool based on the historical operating parameters, preset adjustment rules and prediction models, generate a first adjustment strategy and a second adjustment strategy respectively, and perform fusion processing on the first adjustment strategy and the second adjustment strategy according to preset decision rules to generate a parameter adjustment strategy. An execution module is used to adjust the configuration parameters of the connection pool according to the parameter adjustment strategy; The verification module is used to collect the operating parameters and perform verification analysis in response to the completion of parameter adjustment. If the system performance degrades or becomes abnormal, the module performs a parameter rollback operation.
9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
10. 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 7.