Database connection pool management method, device, equipment and medium

By matching the operational information of the database connection pool with the standard vectors stored in the target database, the candidate adjustment scheme with the highest semantic similarity is selected. This solves the problem of reliance on human experience in existing technologies, realizes fast and accurate configuration adjustment of the database connection pool, and improves the timeliness and execution efficiency of configuration adjustment.

CN122285631APending Publication Date: 2026-06-26AVATR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
AVATR CO LTD
Filing Date
2026-04-30
Publication Date
2026-06-26

Smart Images

  • Figure CN122285631A_ABST
    Figure CN122285631A_ABST
Patent Text Reader

Abstract

This application relates to the field of database management technology, and discloses a method, apparatus, device, and medium for managing a database connection pool. The method includes: matching the operational information of the database connection pool with various standard vectors stored in a target database to obtain at least one candidate standard vector that matches the operational information; the target database includes adjustment schemes and standard vectors stored in a correspondence relationship; the standard vectors are generated based on the connection configuration parameters of the database connection pool configured during operation according to the corresponding adjustment scheme; selecting the candidate adjustment scheme with the highest semantic similarity to the operational information from the candidate adjustment schemes corresponding to the candidate standard vectors as the target adjustment scheme; and adjusting the current connection configuration parameters of the database connection pool based on the target adjustment scheme. This application can improve the accuracy and timeliness of connection pool configuration adjustments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image recognition technology, specifically to a method, apparatus, device, and medium for managing a database connection pool. Background Technology

[0002] As a core resource scheduling component between the database and applications, the proper configuration of the database connection pool significantly impacts the stability and response efficiency of the business system. In related technologies, database connection pools often employ static parameter configuration or manual tuning based on simple thresholds. Relying solely on human experience or single-dimensional data to determine adjustment strategies can easily lead to mismatches between the adjustment plan and actual operational needs, making it difficult to quickly and accurately match the optimal configuration for the connection pool. Summary of the Invention

[0003] In view of the above problems, embodiments of this application provide a database connection pool management method, apparatus, device and medium to solve the problem in the related art that the configuration of database connection pools relies on manual experience and single-dimensional data, the adjustment scheme does not match the actual operation requirements, and it is impossible to quickly and accurately match the optimal configuration.

[0004] According to one aspect of the embodiments of this application, a method for managing a database connection pool is provided, the method comprising: The operation information of the database connection pool is matched with various standard vectors stored in the target database to obtain at least one candidate standard vector that matches the operation information; the target database includes adjustment schemes and standard vectors stored in a correspondence relationship; the standard vector is generated according to the connection configuration parameters of the database connection pool configured during operation according to the corresponding adjustment scheme. From the candidate adjustment schemes corresponding to the candidate standard vectors, select the candidate adjustment scheme with the greatest semantic similarity to the running information as the target adjustment scheme; The current connection configuration parameters of the database connection pool are adjusted based on the target adjustment scheme.

[0005] According to another aspect of the embodiments of this application, a database connection pool management device is provided, including: The first processing module is used to match the operation information of the database connection pool with each standard vector stored in the target database to obtain at least one candidate standard vector that matches the operation information; the target database includes adjustment schemes and standard vectors stored in a correspondence relationship; the standard vector is generated according to the connection configuration parameters of the database connection pool configured during operation according to the corresponding adjustment scheme. The second processing module is used to select the candidate adjustment scheme with the highest semantic similarity to the running information from the candidate adjustment schemes corresponding to the candidate standard vector as the target adjustment scheme; The third processing module is used to adjust the current connection configuration parameters of the database connection pool based on the target adjustment scheme.

[0006] According to another aspect of the embodiments of this application, an electronic device is provided, including: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other through the communication bus; the memory is used to store at least one executable instruction, which causes the processor to perform some or all of the steps in the above method.

[0007] According to another aspect of the embodiments of this application, a computer-readable storage medium is provided, the storage medium storing at least one executable instruction, which, when executed on a processor, causes the processor to perform some or all of the steps in the above method.

[0008] This application embodiment matches the operational information of the database connection pool with various standard vectors stored in the target database to obtain candidate standard vectors in the target database that match the operational information of the database connection pool. The target database includes adjustment schemes and standard vectors stored in a correspondence relationship. Given candidate standard vectors, adjustment schemes corresponding to the candidate standard vectors can be obtained based on the correspondence relationship and used as candidate adjustment schemes. From the candidate adjustment schemes, the one with the highest semantic similarity to the operational information is selected as the target adjustment scheme, thereby adjusting the current connection configuration parameters of the database connection pool according to the target adjustment scheme. This application embodiment establishes an association between standard vectors and adjustment schemes, solving the problem of relying on manual experience or single-dimensional data to judge adjustment strategies in related technologies. It has the technical effect of making configuration adjustment judgments more objective and reasonable, and eliminating reliance on manual experience. This application embodiment accurately matches adjustment schemes through a two-layer screening mechanism, solving the problem of mismatch between adjustment schemes and actual operational needs in related technologies. It has the technical effect of quickly and accurately matching the optimal configuration for the connection pool. It solves the problems of low efficiency and slow response of manual tuning in related technologies, and has the technical effect of improving the timeliness and execution efficiency of connection pool configuration adjustments.

[0009] The above description is merely an overview of the technical solutions of the embodiments of this application. In order to better understand the technical means of the embodiments of this application and to implement them in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the embodiments of this application more obvious and understandable, specific implementation methods of this application are described below. Attached Figure Description

[0010] The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 A flowchart illustrating the database connection pool management method provided in this application is shown; Figure 2 A schematic diagram of an embodiment of the database connection pool management device of this application is shown; Figure 3 A schematic diagram of an embodiment of the electronic device provided in this application is shown. Detailed Implementation

[0011] Exemplary embodiments of the present application will now be described in more detail with reference to the accompanying drawings. Although exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be implemented in various forms and should not be limited to the embodiments set forth herein.

[0012] It is understood that before using the technical solutions disclosed in the various embodiments of this application, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this application in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0013] Figure 1 A flowchart illustrating the database connection pool management method of this application is shown. Figure 1 As shown, the management method for this database connection pool includes the following steps: Step 110: Match the running information of the database connection pool with the standard vectors stored in the target database to obtain at least one candidate standard vector that matches the running information.

[0014] In this embodiment, the target database includes adjustment schemes and standard vectors stored in a correspondence relationship. The standard vectors are generated based on the connection configuration parameters of the database connection pool configured according to the corresponding adjustment scheme during operation.

[0015] In this embodiment, the operation information of the database connection pool is obtained, and the operation information is converted into vector form to obtain behavior vectors. The vector similarity between the behavior vectors and each standard vector in the target database is calculated, and the top preset number of standard vectors with high vector similarity are selected as candidate standard vectors.

[0016] In this embodiment, the standard vector and the behavior vector are vectors of the same dimension to ensure the effectiveness of the similarity calculation. The preset number can be set and modified according to actual needs; as an example, the preset number can be 5.

[0017] In this embodiment, the database connection pool is a resource scheduling component between the application and the database, including but not limited to mainstream connection pools such as HikariCP, Druid, and Tomcat JDBC Pool, which are used to manage the creation, allocation, and recycling of database connections, reducing the overhead of establishing and destroying database connections.

[0018] In this embodiment, the runtime information is a collection of comprehensive status, performance, configuration, and statistical data generated by the database connection pool during operation. As an example, runtime information may include: core configuration information, real-time status information, performance and latency information, cumulative statistics and rate information, etc. As an example, core configuration information may include: maximum number of connections, minimum number of idle connections, idle connection timeout, maximum connection lifespan, and connection acquisition timeout. Real-time status information may include: number of active connections, number of idle connections, total number of connections, number of threads waiting to acquire connections, connection waiting queue length, and number of threads currently waiting for connections. Performance and latency information may include: average connection acquisition time, connection acquisition P99 time, maximum connection acquisition time, average connection holding time, maximum connection holding time, connection acquisition time distribution, and connection usage duration distribution. Cumulative statistics and rate information may include: total number of cumulative created connections, total number of cumulative destroyed connections, connection creation rate, total number of failed connection acquisitions, number of suspected connection leak detections, number of times waiting due to empty pool, and historical maximum concurrent connections.

[0019] As an example, local operational information of the database connection pool can be obtained through JMX and APM monitoring tools. As another example, database-side load metrics can be obtained via network communication, and combined with business event data from the business system to obtain complete operational information of the database connection pool. This business event data includes identifiers of sudden traffic events such as web crawler attacks, and information on peak business access periods.

[0020] As an example, converting runtime information into vector form, the resulting behavior vector specifically includes: The operational information is standardized to obtain standardized operational information, and the values ​​of different dimensions and value ranges are normalized to the interval [0, 1]. When the operational information includes business event data, one-hot encoding can be performed on the non-numerical business event data.

[0021] The standardized operational information is concatenated dimensionally in a preset order to obtain a high-dimensional feature vector.

[0022] High-dimensional feature vectors are reduced in dimensionality and semantically encoded using a pre-trained vector encoding model to generate fixed-dimensional behavior vectors. As an example, the vector encoding model could be a feature extraction model trained on the Transformer architecture.

[0023] As an example, the behavior vector can be a 128-dimensional floating-point vector. The numerical representation of each dimension of the behavior vector corresponds to the fusion result of the semantic and numerical features of the runtime information indicators, such as the ratio of active connections to the maximum number of connections, the normalized value of the time taken to acquire a connection (P99), etc., which are all mapped to different dimensions of the behavior vector.

[0024] This embodiment achieves a quantitative representation of the connection pool's operating status by uniformly converting multi-dimensional and multi-type operational information into standardized behavior vectors, thus solving the problem of scattered operational information dimensions and difficulty in unified analysis in traditional methods.

[0025] In this embodiment, standard vectors can be sorted in descending order of vector similarity, and a predetermined number of standard vectors in the sorting results can be selected as candidate standard vectors. If multiple standard vectors have the same vector similarity and are at a predetermined threshold, all of these standard vectors can be included in the candidate standard vectors. For example, if the predetermined threshold is 5, and the 5th standard vector has the same vector similarity as the 6th standard vector, then the 6th standard vector will also be selected as a candidate standard vector.

[0026] In this embodiment, the adjustment scheme is in text form, the standard vector is in vector form, and the adjustment scheme is an adjustment scheme for the connection configuration parameters of the database connection pool. It is formed by combining MCP operation instructions, including single instructions or combinations of multiple instructions for query, adjustment, cleanup, and control operations. For example, a single instruction adjustment scheme that only executes set_maximum_pool_size, a multi-instruction adjustment scheme that combines evict_suspected_leak and set_minimum_idle, and no processing is also included as an adjustment scheme in the target database.

[0027] As an example, the list of MCPs is shown in Table 1.

[0028] Table 1 MCP List

[0029] In this embodiment, the MCP list includes operation type, action value, and function description, used for standardized definition and unified scheduling of various management, control, and adjustment operations of the database connection pool. The operation type represents the business classification and risk level of the operation performed on the connection pool; the action value represents the unique instruction identifier for identifying, scheduling, and executing the operation within the system; and the function description represents the specific execution function and target object corresponding to the action value.

[0030] The MCP list as a whole represents the standardization and structured encapsulation of query, adjustment, cleanup, and control operations supported by the database connection pool, forming a unified, extensible, and executable set of instructions. This allows the system to directly match and execute the corresponding standard operations based on runtime information, anomaly judgment rules, or parameter adjustment patterns, thereby achieving automated adjustment of database connection pool connection configuration parameters and intelligent management of runtime status.

[0031] In this embodiment, typical operational information related to different operational anomalies can be converted into vector form to obtain a standard vector corresponding to each operational anomaly. The specific implementation method for converting typical operational information related to different operational anomalies into vector form is the same as the implementation method for converting operational information into vector form to obtain behavior vectors described above, and will not be described in detail here.

[0032] For example, when there is an issue of excessive idle connections leading to resource waste, typical operational information indicates that the number of idle connections is much greater than the minimum number of idle connections, or more than twice the minimum number of idle connections. In this case, it is necessary to execute the `evict_idle_connections` operation to actively evict idle connections with timeouts and release redundant resources. Therefore, this typical operational information, such as 50 idle connections and 20 minimum idle connections, can be converted into a vector form as the standard vector corresponding to this abnormal problem. The adjustment scheme for executing `evict_idle_connections` can be used as the corresponding adjustment scheme. Specifically, the idle connection timeout time is reduced to 300,000 milliseconds (5 minutes), and the minimum number of idle connections is reduced to 30.

[0033] In this application embodiment, "no adjustment is required" is also considered as an adjustment scheme in the target database. The text description of this adjustment scheme is "no adjustment is required, maintain the current connection pool configuration parameters".

[0034] In this embodiment of the application, as an example, vector similarity can be cosine similarity. As another example, the specific implementation of calculating the vector similarity between the behavior vector and each standard vector in the target database is as follows: based on the cosine similarity calculation formula... ,in For behavior vectors, For standard vectors, The dot product of two vectors. , These are the magnitudes of the two vectors, respectively. A vectorized computation framework is used to perform batch cosine similarity calculations between the behavior vector and all standard vectors in the target database, yielding a vector similarity value between each standard vector and the behavior vector. The results are rounded to four decimal places.

[0035] This embodiment achieves quantitative matching between behavioral vectors and standard vectors through cosine similarity calculation. Combined with a pre-set number of screening rules, it quickly selects the standard vectors and adjustment schemes corresponding to the typical states most similar to the current running state of the database connection pool from the target database. This solves the problems of low efficiency and strong subjectivity in manual screening of adjustment schemes in traditional methods. It has the technical effect of achieving rapid initial screening of adjustment schemes, narrowing the range of subsequent accurate selection schemes, and improving the matching efficiency of adjustment schemes.

[0036] Step 120: From the candidate adjustment schemes corresponding to the candidate standard vectors, select the candidate adjustment scheme with the highest semantic similarity to the running information as the target adjustment scheme.

[0037] In this embodiment, the adjustment scheme corresponding to the candidate standard vector can be used as a candidate adjustment scheme. There is at least one candidate adjustment scheme. The semantic similarity between the running information and the candidate adjustment schemes can be calculated. The candidate adjustment scheme with the highest semantic similarity is selected as the target adjustment scheme from the adjustment schemes corresponding to the candidate standard vectors (candidate adjustment schemes).

[0038] In this embodiment, when the candidate adjustment scheme requires no adjustment and the current connection pool configuration parameters are maintained, it is not necessary to adjust the current connection configuration parameters of the database connection pool, and steps 120 and 130 below do not need to be executed. This embodiment achieves the conversion from quantized vector to adjustment scheme by establishing a direct mapping between candidate standard vectors and candidate adjustment schemes.

[0039] In this embodiment of the application, as an example, the specific implementation of calculating the semantic similarity between runtime information and candidate adjustment schemes is as follows: The runtime information is converted into natural language description text. The natural language description text of the runtime information and the text of each candidate adjustment scheme are input into the semantic similarity calculation model. The semantic similarity calculation model outputs the semantic similarity between the two, with a value range of [0, 1]. The closer the semantic similarity is to 1, the higher the semantic matching degree between the two. The semantic similarity calculation model is a Siamese network model based on the BERT architecture, which is customized and trained for the semantic features of the database connection pool runtime information and adjustment schemes.

[0040] This embodiment achieves deep semantic analysis of the adaptability of the connection pool's operating status and adjustment schemes by converting the operating information into natural language text and calculating the semantic similarity with the candidate adjustment schemes. It solves the problem that quantitative analysis relying solely on vector similarity cannot take into account both business scenarios and the applicable logic of adjustment schemes. It has the technical effect of accurately judging the adaptability of candidate adjustment schemes to the current operating status from the semantic level, thereby improving the rationality and accuracy of adjustment scheme selection.

[0041] In this embodiment of the application, the adjustment schemes can be sorted in descending order of semantic similarity, and the adjustment scheme with the highest semantic similarity in the sorting results can be selected as the target adjustment scheme.

[0042] Step 130: Adjust the current connection configuration parameters of the database connection pool based on the target adjustment plan.

[0043] In this embodiment, the connection configuration parameters are the same as the parameters corresponding to the operation information. Connection configuration parameters can be the maximum number of connections, the minimum number of idle connections, the idle connection timeout, etc., which will not be described in detail here. The adjusted current connection configuration parameter can be at least one of the above parameters.

[0044] In this embodiment, adjusting the current connection configuration parameters of the database connection pool based on the target adjustment scheme specifically includes: generating a connection configuration instruction according to the target adjustment scheme, and adjusting the current connection configuration parameters of the database connection pool by executing the connection configuration instruction. For example, the connection configuration instruction can change the maximum number of connections from 20 to 120, and the text form of the instruction is {"action": "set_maximum_pool_size", "new_value": 120, "reason": "black_friday_traffic_spike"}.

[0045] In this embodiment, the connection configuration command is an executable command conforming to the MCP protocol specification, containing information such as operation type, adjustment parameters, and execution reason. The current connection configuration parameters of the database connection pool are adjusted by executing the connection configuration command. The execution of the configuration command is implemented through the database connection pool's native configuration interface, ensuring the compatibility and stability of command execution.

[0046] This embodiment automates the adjustment of connection pool configuration parameters by converting the target adjustment scheme into standardized MCP protocol configuration commands and executing them. This solves the problems of delayed response and error-proneness in traditional manual parameter adjustments. It achieves automated and standardized execution of connection pool configuration adjustments, improving the timeliness and accuracy of adjustments and effectively avoiding errors and delays caused by manual operation. Furthermore, executing commands based on the connection pool's native configuration interface ensures compatibility with various mainstream connection pools, enhancing the versatility of the solution.

[0047] In one alternative approach, the database connection pool management method further includes obtaining the database connection pool's operational information before matching the database connection pool's operational information with the various standard vectors stored in the target database.

[0048] Obtaining operational information about the database connection pool specifically includes: When an abnormal operation is detected in the database connection pool, obtain the operational information of the database connection pool.

[0049] Alternatively, the database connection pool's operational information can be retrieved periodically at preset time intervals.

[0050] In this embodiment, a preset anomaly determination rule can be used to determine whether a database connection pool has an operational anomaly. When it is determined that the database connection pool has an operational anomaly, the obtained operational information of the database connection pool can be core operational information only related to the anomaly, or it can be all operational information. If it is core operational information, the efficiency of information collection and subsequent analysis can be improved; if it is all operational information, a comprehensive assessment of the anomaly can be achieved. When it is determined that the database connection pool does not have an operational anomaly, it is not necessary to obtain the operational information of the database connection pool, and it is not necessary to adjust the current connection configuration parameters, thus reducing system resource consumption. As an example, the anomaly determination rule is a combination of multiple indicator thresholds based on the connection pool operational information, such as the state where the number of active connections ≥ the maximum number of connections and the number of threads waiting to acquire connections > 0 for 5 seconds, the number of suspected connection leak detections > 0 and the maximum connection holding time > 10 × the average connection holding time, and the increase in the total number of connection acquisition failures within 1 minute exceeding a preset threshold, etc. When the operational information meets any of the anomaly determination rules, it is determined that the connection pool has an operational anomaly.

[0051] In this embodiment, the preset time interval can be set and modified according to actual needs, and is not limited in this application. For example, it can be set to 10 seconds, 30 seconds, 1 minute, etc. In this embodiment, the operating information of the database connection pool can also be obtained in real time, and the connection configuration parameters can be adjusted in real time based on this.

[0052] In this embodiment, a pre-constructed target large model can be obtained. The running information and candidate adjustment schemes are input into the target large model to obtain the target adjustment scheme. The target large model is used to perform the step of selecting the candidate adjustment scheme with the highest semantic similarity to the running information from the candidate adjustment schemes corresponding to the candidate standard vectors as the target adjustment scheme. Specifically, the target large model is used to perform the step of calculating the semantic similarity between the running information and the candidate adjustment schemes, and selecting the candidate adjustment scheme with the highest semantic similarity from the candidate adjustment schemes as the target adjustment scheme.

[0053] In this embodiment of the application, the target large model is a dedicated model obtained by fine-tuning and training based on a large language model base combined with domain data of database connection pool management. The large language model base includes, but is not limited to, LLaMA series models. The dataset for fine-tuning and training includes samples of operation information of database connection pool, samples of adjustment schemes, and samples of matching relationships between operation information and adjustment schemes. Furthermore, the model is fine-tuned in a lightweight manner using the LLaMA Factory tool to ensure the inference efficiency and adaptability of the model.

[0054] In this embodiment, the running information can be converted into natural language description text, and the text of the candidate adjustment scheme and the natural language description text of the running information can be input into the target large model to obtain the target adjustment scheme.

[0055] This embodiment addresses the issues of poor generalization ability and inability to handle complex semantic information in traditional machine learning models by introducing a customized, large-scale target model. It leverages the powerful semantic understanding and reasoning capabilities of a large model to improve the accuracy of semantic similarity calculation and the rationality of target adjustment scheme selection. Simultaneously, it achieves end-to-end intelligent processing of similarity calculation and scheme selection, simplifying the computational process. Furthermore, the large-scale model, fine-tuned based on domain data, better suits the business scenario of database connection pool management, effectively avoiding the knowledge obsolescence and illusion problems of general-purpose large models, and improving the reliability of adjustment scheme selection.

[0056] In an alternative approach, step 130 adjusts the current connection configuration parameters of the database connection pool based on the target tuning scheme, including: Send the target adjustment plan to the target agent.

[0057] The target agent parses the target adjustment scheme to generate connection configuration instructions, and executes the connection configuration instructions to adjust the current connection configuration parameters of the database connection pool.

[0058] In this embodiment, the target intelligent agent is an intelligent agent component embedded in the application, which has the capabilities of network communication, instruction parsing, operation execution, and status feedback. It can connect to the target large model through the network, receive the target adjustment scheme output by the target large model, and interact with the database connection pool through the MCP protocol to perform configuration adjustment operations.

[0059] In this embodiment, the specific implementation of adjusting the current connection configuration parameters of the database connection pool by parsing the target adjustment scheme to generate connection configuration instructions and executing the connection configuration instructions is as follows: The target agent performs semantic parsing on the received target adjustment scheme, extracting core information such as operation type, adjustment parameters, and execution reason from the scheme. According to the MCP protocol specification, the core information is converted into standardized connection configuration instructions, the instruction format of which is compatible with the operation interface of the database connection pool. The connection configuration instructions are sent to the management interface of the database connection pool via the MCP protocol, triggering the configuration parameter adjustment operation. The operation execution result returned by the connection pool is received. If the execution is successful, the adjustment is completed; if the execution fails, the reason for the failure is recorded and an alarm is triggered, while the execution status is reported back to the management system.

[0060] This embodiment resolves the compatibility issue between the adjustment scheme and the connection pool operation interface by using a target intelligent agent to parse and execute the target adjustment scheme. This achieves end-to-end automation of configuration adjustment, leveraging the agent's professional parsing and execution capabilities to ensure a high degree of consistency between configuration commands and the target adjustment scheme, thus improving the efficiency and success rate of configuration adjustment. Furthermore, the deployment method of embedding the intelligent agent into the application reduces network transmission latency and enhances the real-time performance of the adjustment operation. In addition, the agent's status feedback function enables closed-loop monitoring of the adjustment operation, facilitating timely detection and handling of execution failures, thereby improving the reliability of connection pool management.

[0061] In this embodiment, the target big model, the target intelligent agent, and the database connection pool are connected via a combination of network communication and local calls, forming a database connection pool management system. The target intelligent agent is embedded in the application deploying the database connection pool, directly obtaining the database connection pool's operational information through local process calls, ensuring real-time information acquisition and low latency. The target intelligent agent establishes a remote connection with the target big model via the TCP / IP network protocol, enabling the transmission and interaction of target adjustment schemes. The database connection pool establishes an operational interaction connection with the target intelligent agent via the MCP protocol, receiving and executing configuration commands sent by the target intelligent agent. This achieves intelligent collaboration throughout the entire database connection pool management process, significantly improving overall management efficiency.

[0062] In an alternative approach, the database connection pool management method further includes the following steps before matching the operational information of the database connection pool with the various standard vectors stored in the target database: Obtain typical operational information related to different operational anomalies.

[0063] Typical operational information is converted into vector form to obtain a standard vector corresponding to each type of operational anomaly.

[0064] Obtain the corresponding adjustment plan for each type of runtime exception. The adjustment plan is used to resolve the corresponding runtime exception.

[0065] The target database is determined based on the standard vector and adjustment scheme corresponding to each type of operational anomaly.

[0066] In this application embodiment, the abnormal operation problems include connection pool fullness leading to request blocking, connection leakage, slow SQL causing excessive connection holding time, too many idle connections leading to resource waste, excessive connection creation rate leading to high database pressure, too many connection acquisition failures, sudden business traffic leading to insufficient connection resources, and unreasonable connection pool parameter configuration leading to excessive response latency.

[0067] In this application embodiment, as an example, typical operational information related to request blocking caused by a full connection pool includes a fixed maximum number of connections, an active number of connections equal to the maximum number of connections, an idle number of connections of 0, a number of threads waiting to acquire connections > 0, a connection waiting queue length > 0, a rapid increase in the number of times waiting due to an empty pool, and a significant increase in the average time to acquire a connection and the P99 time to acquire a connection. The corresponding adjustment scheme is to perform the operation of setting the maximum number of connections, increasing the maximum number of connections, or, in combination with the business scenario, temporarily control connection acquisition by pausing the acquisition of new connections.

[0068] In this embodiment of the application, as an example, typical operational information related to connection leakage is that the number of suspected connection leakage detections is >0, the maximum holding time of the connection is much greater than the average holding time of the connection, the number of idle connections continues to decrease, the number of active connections remains at a high level for a long time and there are no business requests to support it. The corresponding adjustment scheme is to perform the operation of expelling suspected leaking connections, expelling the suspected leaking connections, and recording the stack information of the expelled connections.

[0069] In this application embodiment, as an example, typical operational information related to slow SQL causing excessively long connection holding time includes a significant increase in the average and maximum connection holding time, an excessively high proportion of the interval exceeding 1 second in the connection usage duration distribution, and a high level of active connections. The corresponding adjustment solution is to perform operations to evict suspected leaked connections and clean up long-held connections, while cooperating with the business system to investigate slow SQL issues.

[0070] In this application embodiment, as an example, typical operational information related to excessive idle connections leading to resource waste includes: the number of idle connections being much greater than the minimum number of idle connections, the number of idle connections being greater than the minimum number of idle connections × 2, the business access volume being at a low peak, and the connection creation rate being 0. The corresponding adjustment scheme is to perform an idle connection eviction operation to actively evict idle connections that have exceeded the idle connection timeout time, or to perform a minimum idle number setting operation to reduce the minimum number of idle connections.

[0071] In this embodiment of the application, determining the target database based on the standard vector and adjustment scheme corresponding to each type of operational anomaly specifically includes: A unique identifier is established for each type of operational anomaly, and the identifier, standard vector, and adjustment plan are stored in a field structure. The standard vector corresponding to the healthy operating state and the adjustment plan for "no adjustment required" are also stored in the target database to form a complete target database.

[0072] In this embodiment, the target database can be updated by adding new samples of operational anomalies, updating typical operational information and adjustment schemes for existing anomalies, and optimizing the generation method of standard vectors. This expands the coverage scenarios of the target database and improves its adaptability to different business scenarios and connection pool anomalies. The update timing can be set to monthly regular updates or immediate updates when new connection pool operational anomalies are encountered.

[0073] This embodiment constructs a target database based on actual operational anomalies, achieving scenario-based and practical matching between standard vectors and adjustment schemes. This solves the problem of traditional solutions lacking real-world scenario support for adjustment schemes, ensuring a high degree of consistency between the adjustment schemes in the target database and actual connection pool anomalies. This provides a real and effective reference for subsequent scheme selection, improving the accuracy of adjustment scheme matching. Simultaneously, it supports dynamic updates to the target database, enabling continuous optimization and scenario coverage expansion. This allows the connection pool management solution to adapt to constantly changing business scenarios and new anomalies, enhancing the solution's scalability.

[0074] In one alternative approach, after adjusting the current connection configuration parameters of the database connection pool based on the target adjustment scheme, the database connection pool management method further includes steps Sa1 to Sa6.

[0075] Step Sa1: Obtain real-time operational information of the adjusted database connection pool.

[0076] In this embodiment, within a preset monitoring window period after the target adjustment scheme is completed, real-time operational information of the database connection pool is acquired according to a high-frequency acquisition rule. As an example, the high-frequency acquisition rule could be to acquire real-time operational information once per second.

[0077] Step Sa2: Determine whether to adjust the target adjustment plan based on real-time operation information.

[0078] In this embodiment, corresponding adjustment judgment rules can be set for different operational information. For example, if the real-time operational information is the maximum number of connections and the number of active connections, and the maximum number of connections has increased after adjustment but the number of active connections remains equal to the maximum number of connections, then the target adjustment scheme is determined to be adjusted. If the maximum number of connections increases after adjustment but the number of active connections falls back to a reasonable range of the maximum number of connections, then the original target adjustment scheme is determined to remain unchanged, and no adjustment is made to the target adjustment scheme. The adjustment judgment rules can be set and adjusted according to actual needs, and will not be described in detail here.

[0079] Step Sa3: If it is determined based on real-time operational information that the target adjustment plan should not be adjusted, the original target adjustment plan should be maintained unchanged.

[0080] Alternatively, step Sa4: When determining the adjustment plan for the target based on real-time operating information, determine the configuration adjustment parameters based on the degree of difference between the real-time operating information and the original operating information.

[0081] In this embodiment, the degree of difference can be the difference between real-time operating information and original operating information, or the ratio of the difference to the value of the original operating information. In this embodiment, parameter adjustment strategies corresponding to different degrees of difference can be preset. The corresponding parameter adjustment strategy is selected based on the degree of difference between the real-time operating information and the original operating information, and the configuration adjustment parameters are obtained based on the parameter adjustment strategy. The configuration adjustment parameters include: the connection configuration parameters to be adjusted, the adjustment direction, and the adjustment magnitude.

[0082] As an example, if the difference between the number of active connections in the adjusted real-time operation information and the number of active connections in the original operation information is close to 0 (i.e., the number of active connections does not decrease significantly), the corresponding parameter adjustment strategy is to continue to increase the maximum number of connections and the adjustment amount is 1.5 times the original adjustment amount. Then the configuration adjustment parameters are: the connection configuration parameter to be adjusted is the maximum number of connections, the adjustment direction is to increase, and the adjustment amount is 1.5 times the original adjustment amount.

[0083] Step Sa5: Adjust the target adjustment scheme according to the configuration adjustment parameters to obtain the adjusted target adjustment scheme, and update the target database according to the adjusted target adjustment scheme.

[0084] In this embodiment, the original target adjustment scheme is adapted and modified based on configuration adjustment parameters. If the original target adjustment scheme is a single instruction operation to set the maximum number of connections, the parameter values ​​in the instruction are updated according to the adjustment direction and adjustment magnitude in the configuration adjustment parameters to generate the adjusted target adjustment scheme. For example, if the original scheme increases the maximum number of connections from 20 to 30, and the configuration adjustment parameter is that the adjustment magnitude is 1.5 times the original adjustment magnitude, then the adjusted scheme increases the maximum number of connections from 30 to 45. The adjusted target adjustment scheme is associated with the corresponding original operating information, real-time operating information, difference data, and configuration adjustment parameters to generate a new scheme sample. The typical operating information of this sample is used to generate a standard vector according to the aforementioned vector transformation method. The standard vector and the adjusted target adjustment scheme are stored in the target database to complete the dynamic update of the target database and enrich the scheme reserves in the target database for this type of abnormal scenario.

[0085] Step Sa6: Adjust the connection configuration parameters of the database connection pool again according to the adjusted target adjustment plan.

[0086] In this embodiment of the application, the specific implementation method for adjusting the connection configuration parameters of the database connection pool again according to the adjusted target adjustment scheme is the same as the above implementation method for adjusting the current connection configuration parameters of the database connection pool based on the target adjustment scheme, and will not be described in detail here.

[0087] In one alternative approach, after adjusting the current connection configuration parameters of the database connection pool based on the target adjustment scheme, the database connection pool management method further includes steps Sb1 to Sb4.

[0088] Step Sb1: Obtain the adjustment records and store them in the adjustment record list.

[0089] In this embodiment, the adjustment record includes operational information, connection configuration parameters before adjustment, connection configuration parameters after adjustment, and a timestamp indicating that the current connection configuration parameters were adjusted. The adjustment record list may include a preset number of adjustment records or adjustment records within a preset time period (e.g., 30 days). The preset number and preset time period can be set and modified according to actual needs.

[0090] Step Sb2: Analyze the adjustment record list to determine the parameter adjustment pattern.

[0091] In this embodiment of the application, as an example, the parameter adjustment rules specifically include: a gradient adaptation rule for the parameter adjustment range. For example, the parameter adjustment range is determined based on the degree of difference between real-time operation information and original operation information. The greater the difference (e.g., the number of active connections is always at full capacity), the greater the adjustment range (maximum not exceeding 1 times the original parameter value). If the difference is small (e.g., the number of active connections is slightly higher than a reasonable range), a small adjustment is adopted (the adjustment range is 10%-20% of the original parameter value) to avoid excessive parameter fluctuations affecting the stability of the connection pool.

[0092] Step Sb3: Determine the preset trigger conditions and the corresponding adjustment schemes based on the parameter adjustment rules.

[0093] In this embodiment of the application, as an example, the preset triggering conditions and corresponding adjustment schemes are as follows: Preset trigger condition 1: When the number of active connections monitored in real time is greater than or equal to 80% of the maximum number of connections, and this state lasts for more than 5 minutes, the maximum number of connections will be increased by 20% to ensure that the connection supply meets the business needs.

[0094] Preset trigger condition 2: When the number of idle connections detected in real time is ≥ 3 times the minimum number of idle connections and the duration exceeds 10 minutes, the idle connection cleanup operation is triggered, and the idle connection timeout time is shortened by 50% to reduce resource waste.

[0095] Preset trigger condition 3: When the number of connection leak detections is ≥3 times / hour, a connection leak handling operation is triggered, and the minimum number of idle connections is reduced to avoid invalid connections consuming resources. Each preset trigger condition corresponds to a unique adjustment plan to ensure the targeting and accuracy of the adjustment.

[0096] Step Sb4: When the operation information of the database connection pool is detected to meet the preset trigger conditions, the current connection configuration parameters of the database connection pool are adjusted according to the adjustment scheme corresponding to the preset trigger conditions.

[0097] This application embodiment provides comprehensive and accurate data support for extracting parameter adjustment patterns by fully collecting and storing adjustment records containing operational information, configuration parameters before and after adjustments, and timestamps, thus avoiding blind adjustments without a basis. By analyzing the adjustment records and summarizing the parameter adjustment patterns, the adjustment range corresponding to different degrees of difference is clarified, ensuring the rationality of parameter adjustments and preventing excessive parameter fluctuations from affecting the stable operation of the connection pool. By setting quantifiable preset trigger conditions and corresponding adjustment schemes, combined with real-time operational status monitoring, automated adjustment of connection configuration parameters is achieved without manual intervention, significantly reducing manual maintenance costs while ensuring the targeted and accurate nature of adjustment operations. The entire process forms a closed loop of adjustment, recording, analysis, triggering, and readjustment, effectively improving the operational stability, adaptability, and management efficiency of the database connection pool.

[0098] Figure 2 A schematic diagram of an embodiment of the database connection pool management device of this application is shown. Figure 2 As shown, the database connection pool management device 200 includes: The first processing module 210 is used to match the operational information of the database connection pool with various standard vectors stored in the target database to obtain at least one candidate standard vector that matches the operational information. The target database includes adjustment schemes and standard vectors stored in a correspondence relationship. The standard vectors are generated based on the connection configuration parameters of the database connection pool configured during operation according to the corresponding adjustment scheme.

[0099] The second processing module 220 is used to select the candidate adjustment scheme with the highest semantic similarity to the running information from the candidate adjustment schemes corresponding to the candidate standard vector as the target adjustment scheme.

[0100] The third processing module 230 is used to adjust the current connection configuration parameters of the database connection pool based on the target adjustment scheme.

[0101] In one alternative approach, the third processing module 230 is specifically used to send the target adjustment scheme to the target agent.

[0102] The target agent parses the target adjustment scheme to generate connection configuration instructions, and executes the connection configuration instructions to adjust the current connection configuration parameters of the database connection pool.

[0103] In an alternative embodiment, the database connection pool management device 200 further includes a fourth processing module for obtaining typical operational information related to different operational anomalies before matching the operational information of the database connection pool with the various standard vectors stored in the target database.

[0104] Typical operational information is converted into vector form to obtain a standard vector corresponding to each type of operational anomaly.

[0105] Obtain the corresponding adjustment plan for each type of runtime exception. The adjustment plan is used to resolve the corresponding runtime exception.

[0106] The target database is determined based on the standard vector and adjustment scheme corresponding to each type of operational anomaly.

[0107] In an alternative embodiment, the database connection pool management device 200 further includes a fifth processing module, configured to acquire the database connection pool's operational information when an operational anomaly is detected, before matching the database connection pool's operational information with the various standard vectors stored in the target database. Alternatively, The system periodically retrieves operational information about the database connection pool at preset time intervals.

[0108] In an alternative embodiment, the database connection pool management device 200 further includes a sixth processing module for acquiring a pre-built target large model.

[0109] The runtime information and candidate adjustment schemes are input into the target large model to obtain the target adjustment scheme. The target large model is used to perform the step of selecting the candidate adjustment scheme with the highest semantic similarity to the runtime information from the candidate adjustment schemes corresponding to the candidate standard vectors as the target adjustment scheme.

[0110] In an alternative approach, the database connection pool management method further includes a seventh processing module, used to obtain real-time operating information of the adjusted database connection pool after adjusting the current connection configuration parameters of the database connection pool based on the target adjustment scheme.

[0111] Determine whether to adjust the target adjustment plan based on real-time operational information.

[0112] If, based on real-time operational information, it is determined that the target adjustment plan should not be adjusted, the original target adjustment plan should be maintained unchanged. Alternatively, When determining the adjustment plan for the target based on real-time operation information, the configuration adjustment parameters are determined according to the degree of difference between the real-time operation information and the original operation information.

[0113] The target adjustment scheme is adjusted according to the configuration adjustment parameters to obtain the adjusted target adjustment scheme, and the target database is updated according to the adjusted target adjustment scheme.

[0114] The connection configuration parameters of the database connection pool were adjusted again based on the revised target adjustment plan.

[0115] In an optional approach, the database connection pool management method further includes an eighth processing module, used to obtain adjustment records and store the adjustment records in an adjustment record list after adjusting the current connection configuration parameters of the database connection pool based on the target adjustment scheme. The adjustment records include runtime information, connection configuration parameters before adjustment, connection configuration parameters after adjustment, and a timestamp indicating that the current connection configuration parameters were adjusted.

[0116] Analyze the adjustment record list to determine the parameter adjustment patterns.

[0117] Based on the parameter adjustment rules, determine the preset trigger conditions and the corresponding adjustment schemes.

[0118] When the database connection pool's operational information is detected to meet the preset trigger conditions, the current connection configuration parameters of the database connection pool are adjusted according to the adjustment scheme corresponding to the preset trigger conditions.

[0119] Figure 3 The diagram shows a structural schematic of an embodiment of the electronic device of this application. The specific embodiments of this application do not limit the specific implementation of the electronic device.

[0120] like Figure 3 As shown, the electronic device may include: a processor 302, a communications interface 304, a memory 306, and a communications bus 308.

[0121] The processor 302, communication interface 304, and memory 306 communicate with each other via communication bus 308. Communication interface 304 is used to communicate with other network elements, such as clients or other servers. The processor 302 executes program 310, specifically performing the relevant steps described in the above embodiment of the database connection pool management method.

[0122] Specifically, program 310 may include program code, which includes computer-executable instructions.

[0123] Processor 302 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application. The electronic device includes one or more processors, which may be processors of the same type, such as one or more CPUs, or processors of different types, such as one or more CPUs and one or more ASICs.

[0124] Memory 306 is used to store program 310. Memory 306 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.

[0125] This application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the database connection pool management method in any of the above method embodiments.

[0126] The algorithms or displays provided herein are not inherently related to any particular computer, virtual system, or other device. Furthermore, the embodiments in this application are not directed to any particular programming language.

[0127] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of this application may be practiced without these specific details. Similarly, for the purpose of simplification and aiding understanding of one or more aspects of the invention, in the above description of exemplary embodiments of this application, various features of the embodiments are sometimes grouped together in a single embodiment, figure, or description thereof. The claims, which follow the detailed description, are hereby expressly incorporated into that detailed description, wherein each claim itself is a separate embodiment of this application.

[0128] Those skilled in the art will understand that the modules in the device of the embodiment can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiment can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components, except that at least some of such features and / or processes or units are mutually exclusive.

[0129] It should be noted that the above embodiments are illustrative of this application and not restrictive, and those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. This application can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be construed as limiting the order of execution.

Claims

1. A method for managing a database connection pool, characterized in that, The method includes: The operation information of the database connection pool is matched with various standard vectors stored in the target database to obtain at least one candidate standard vector that matches the operation information; the target database includes adjustment schemes and standard vectors stored in a correspondence relationship; the standard vector is generated according to the connection configuration parameters of the database connection pool configured during operation according to the corresponding adjustment scheme. From the candidate adjustment schemes corresponding to the candidate standard vectors, select the candidate adjustment scheme with the greatest semantic similarity to the running information as the target adjustment scheme; The current connection configuration parameters of the database connection pool are adjusted based on the target adjustment scheme.

2. The method according to claim 1, characterized in that, The adjustment of the current connection configuration parameters of the database connection pool based on the target adjustment scheme includes: Send the target adjustment plan to the target agent; The target agent parses the target adjustment scheme to generate connection configuration instructions and executes the connection configuration instructions, thereby adjusting the current connection configuration parameters of the database connection pool.

3. The method according to claim 1, characterized in that, Before matching the database connection pool's runtime information with the various standard vectors stored in the target database, the following steps are also included: Obtain typical operational information related to different operational anomalies; The typical operational information is converted into vector form to obtain a standard vector corresponding to each operational anomaly. Obtain the adjustment plan corresponding to each of the aforementioned operational anomalies; the adjustment plan is used to resolve the corresponding operational anomaly. The target database is determined based on the standard vector and adjustment scheme corresponding to each of the aforementioned operational anomalies.

4. The method according to claim 1, characterized in that, Before matching the database connection pool's runtime information with the various standard vectors stored in the target database, the following steps are also included: When an operational anomaly is detected in the database connection pool, the operational information of the database connection pool is obtained; or, The system periodically retrieves operational information about the database connection pool at preset time intervals.

5. The method according to claim 1, characterized in that, The method further includes: Obtain a pre-built target large model; The running information and the candidate adjustment scheme are input into the target large model to obtain the target adjustment scheme; the target large model is used to perform the step of selecting the candidate adjustment scheme with the highest semantic similarity to the running information from the candidate adjustment schemes corresponding to the candidate standard vector as the target adjustment scheme.

6. The method according to claim 1, characterized in that, After adjusting the current connection configuration parameters of the database connection pool based on the target adjustment scheme, the method further includes: Obtain the real-time operating information of the adjusted database connection pool; Based on the real-time operational information, determine whether to adjust the target adjustment plan; If, based on the real-time operational information, it is determined that the target adjustment plan should not be adjusted, the original target adjustment plan shall remain unchanged; or... When determining the adjustment scheme for the target based on the real-time operation information, the configuration adjustment parameters are determined based on the degree of difference between the real-time operation information and the original operation information. The target adjustment scheme is adjusted according to the configuration adjustment parameters to obtain the adjusted target adjustment scheme, and the target database is updated according to the adjusted target adjustment scheme. The connection configuration parameters of the database connection pool are adjusted again according to the revised target adjustment plan.

7. The method according to claim 1, characterized in that, After adjusting the current connection configuration parameters of the database connection pool based on the target adjustment scheme, the method further includes: Obtain the adjustment record and store the adjustment record in the adjustment record list; the adjustment record includes the running information, the connection configuration parameters before the adjustment, the connection configuration parameters after the adjustment, and the timestamp of the current connection configuration parameters being adjusted. The adjustment record list is analyzed to determine the parameter adjustment pattern; Based on the parameter adjustment rules, determine the preset trigger conditions and the corresponding adjustment schemes for the preset trigger conditions; When the operation information of the database connection pool is detected to meet the preset triggering conditions, the current connection configuration parameters of the database connection pool are adjusted according to the adjustment scheme corresponding to the preset triggering conditions.

8. A database connection pool management device, characterized in that, The device includes: The first processing module is used to match the operation information of the database connection pool with each standard vector stored in the target database to obtain at least one candidate standard vector that matches the operation information; the target database includes adjustment schemes and standard vectors stored in a correspondence relationship; the standard vector is generated according to the connection configuration parameters of the database connection pool configured during operation according to the corresponding adjustment scheme. The second processing module is used to select the candidate adjustment scheme with the highest semantic similarity to the running information from the candidate adjustment schemes corresponding to the candidate standard vector as the target adjustment scheme; The third processing module is used to adjust the current connection configuration parameters of the database connection pool based on the target adjustment scheme.

9. An electronic device, characterized in that, include: The processor, memory, communication interface, and communication bus are provided, wherein the processor, memory, and communication interface communicate with each other via the communication bus. The memory is used to store at least one executable instruction that causes the processor to perform the operation of the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The storage medium stores at least one executable instruction, which, when executed on a processor, causes the processor to perform the operation of the method as described in any one of claims 1-7.