Dynamic database connection pool adjusting method and system
Through the configuration center, the operating status data of the database connection pool is collected in real time and the connection number adjustment index is calculated in combination with the connection request, the maximum number of connections in the connection pool is dynamically updated, which solves the problem that a single fixed connection pool configuration cannot meet the business development, and improves service capabilities and System stability.
Patent Information
- Application Number
- CN202410536392.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-30
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-04-30
AI Technical Summary
A single fixed database connection pool configuration is difficult to meet the needs of business development, resulting in insufficient external service capabilities of the connection pool and affecting the stability of the business system.
Through the configuration center, the operating status data of the dynamic database connection pool is collected in real time, the connection number adjustment index is calculated in combination with the connection request, and the maximum connection number of connections is dynamically updated.
It effectively improves the external service capabilities of the connection pool and ensures the stable operation of the business system.
Smart Images

Figure CN119474046A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a dynamic database connection pool adjustment method and system. Background Art
[0002] Database connection is a critical, limited and expensive resource. Creating and releasing database connection is a time-consuming operation. Frequent such operations will take up a lot of performance overhead, which will lead to a decrease in the response speed of the website. In serious cases, it may cause the server to crash. In order to save performance overhead, the application system generally uses a database connection pool. At present, with the rapid development of business, the configuration of a single fixed database connection pool can hardly meet the needs of business development.
[0003] Therefore, the present invention provides a dynamic database connection pool adjustment method and system to achieve dynamic adjustment of the maximum number of connections in the connection pool, so as to effectively improve the external service capability of the connection pool and ensure the stable operation of the business system. Summary of the invention
[0004] The present invention provides a dynamic database connection pool adjustment method and system, which are used to obtain the operating status data of the target dynamic database connection pool through real-time collection by a configuration center, calculate the connection number adjustment index in combination with the connection request, and then dynamically update the maximum number of connections in the connection pool using the connection number adjustment index, thereby effectively improving the external service capability of the connection pool and ensuring the stable operation of the business system.
[0005] The present invention provides a dynamic database connection pool adjustment method, comprising: Step 1: Collect the running status data of the target dynamic database connection pool in real time and send it to the configuration center; Step 2: The configuration center determines the connection number adjustment index based on the received operation status data of the connection pool and the connection request of the current target dynamic database connection pool; Step 3: Based on the connection number adjustment index, the configuration center dynamically updates the maximum number of connections in the connection pool and notifies the connection pool module to update.
[0006] Preferably, real-time collection of the running status data of the target dynamic database connection pool and sending it to the configuration center includes: Create a preset connection pool interface; The target client uses the preset connection pool interface to collect the operation status data of the target dynamic database connection pool in real time; The configuration center receives the running status data sent by the target client.
[0007] Preferably, the configuration center is used to store and manage connection pool configurations, and supports dynamic updating of configurations at runtime without restarting the service.
[0008] Preferably, the configuration center determines the connection number adjustment index based on the received running status data of the connection pool and in combination with the connection request of the current target dynamic database connection pool, including: Obtaining a connection request from the target dynamic database connection pool and determining the number of newly added connections; Extract the number of idle connections in the running status data of the connection pool at the current moment and compare it with the number of newly added connections; If the number of idle connections is not less than the number of newly added connections, and the difference is greater than the preset difference threshold, the output connection number adjustment index is zero; If the number of idle connections is not less than the number of newly added connections, and the difference is not greater than the preset difference threshold, the running status data at the current moment is adjusted using the number of newly added connections to obtain the pre-running status data at the next moment; Extracting the number of historical newly added connections within a preset time period from the connection request database and treating it as the first data; Introducing a regression prediction algorithm to predict the number of newly added connections at the next moment based on the first data; The number of newly added connections at the next moment and the pre-operation status data are combined and analyzed as key data to obtain a connection number adjustment index; If the number of idle connections is less than the number of newly added connections, the number of newly added connections and the running status data at the current moment are combined and analyzed as key data to obtain a connection number adjustment index.
[0009] Preferably, the calculation formula of the connection number adjustment index is as follows: ; Where L represents the connection number adjustment index; Indicates the maximum number of connections in the connection pool at the current moment; Represents the number of idle connections at the current moment; Indicates the number of new connections at the current moment; Indicates the number of released connections at the current moment; It is expressed as the average difference between the number of newly added connections and the number of released connections at each moment in the expected connection pool stability period t; It is represented by the impact index of the number of connections added and released at the current moment on the stability of the connection pool; m is represented by the number of connections in the connection pool at the current moment whose reference count is greater than the preset reference threshold; Represents the utilization of data connections in the connection pool at the current moment; It is expressed as the impact index of the data connection reference frequency on the connection pool stability. Indicates the fine-tuning coefficient for the connection number adjustment index to stabilize the connection pool; represents the loss factor generated for calculating the connection number adjustment index; Represents a constant.
[0010] Preferably, based on the connection number adjustment index, the configuration center dynamically updates the maximum number of connections in the connection pool and notifies the connection pool module to update, including: Comparing the connection adjustment index with a preset state adjustment threshold, and when the connection adjustment index is not greater than the preset state adjustment threshold, determining that the current target dynamic database connection pool does not need to update the maximum number of connections in the connection pool; Otherwise, it is determined that the current target dynamic database connection pool needs to update the maximum number of connections in the connection pool. At this time, the mode selection index is calculated using the connection number adjustment index, where the calculation formula of the mode selection index is as follows: ; In the formula, Expressed as the mode selection index; It is expressed as the connection number adjustment index at the current time t; It is indicated as a preset adjustment threshold; It is represented as the preset mode selection factor; If the mode selection index is in the emergency adjustment index interval, determining that the current connection update mode is the emergency adjustment mode; If the mode selection index is in the dynamic adjustment index interval, determining that the current connection update mode is the dynamic adjustment mode; The maximum number of connections in the current connection pool is adjusted using the calculated connection number adjustment index to obtain the optimized maximum number of connections; Based on the connection update mode and the optimized maximum number of connections, the configuration center matching the current connection pool generates an update notification; Decouple the configuration center of the current connection pool from the business logic; Receive the update notification generated by the configuration center through the pre-created configuration update interface, and then use the asynchronous notification mechanism to notify the connection pool module to update; When the connection update mode in the update notification received by the connection pool module is the emergency adjustment mode, the maximum number of connections is updated to the optimized maximum number of connections; When the connection update mode in the update notification received by the connection pool module is the dynamic adjustment mode, obtaining the number of connection updates each time; The maximum number of connections is dynamically updated using the number of connections updated each time until it is updated to the optimized maximum number of connections.
[0011] Preferably, obtaining the number of updates for each connection includes: Extract the historical number of released connections and the historical number of deleted connections in the preset time period of the current key data from the connection pool related database, and construct a released connection curve and a deleted connection curve respectively; Analyze the connection release curve and the connection deletion curve to obtain the connection release change characteristic value and the deletion change characteristic value of the current connection pool in turn; The proportion of connections whose release time is greater than the average release time of connections in the key data is obtained and regarded as the first proportion; The proportion of the number of connections whose release time is not greater than the average release time of the connections in the key data is regarded as the second proportion; The release connection change characteristic value, the first ratio, the second ratio and the deletion change characteristic value are combined and calculated to obtain a reusability coefficient of the connection pool; The abnormal waiting coefficient of the data connection in the connection pool is calculated by using the average connection timeout frequency and the average number of timeout retry connections in the key data; The connection number update index is obtained by calculating the weighted average of the reusability coefficient and the abnormal waiting coefficient of the connection pool; Compare the optimized maximum number of connections with the maximum number of connections in the connection pool at the current moment to determine the connection difference; The connection number update index and the connection difference are analyzed and calculated to determine the number of connection updates each time.
[0012] The present invention provides a dynamic database connection pool adjustment system, comprising: Data collection module: collects the running status data of the target dynamic database connection pool in real time and sends it to the configuration center; Index analysis module: The configuration center determines the connection number adjustment index based on the received operation status data of the connection pool and the connection request of the current target dynamic database; Adjustment module: Based on the connection number adjustment index, the configuration center dynamically updates the maximum number of connections in the connection pool and notifies the connection pool module to update.
[0013] Compared with the prior art, the present invention has the following beneficial effects: By using the configuration center to collect the operating status data of the target dynamic database connection pool in real time, the connection number adjustment index is calculated in combination with the connection request, and then the connection number adjustment index is used to dynamically update the maximum number of connections in the connection pool, thereby effectively improving the external service capabilities of the connection pool and ensuring the stable operation of the business system.
[0014] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description and the accompanying drawings.
[0015] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings: Figure 1 A flow chart of a dynamic database connection pool adjustment method according to an embodiment of the present invention; Figure 2 The present invention is a structural diagram of a dynamic database connection pool adjustment system in an embodiment of the present invention. DETAILED DESCRIPTION
[0017] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0018] The embodiment of the present invention provides a method for adjusting a dynamic database connection pool. Figure 1 As shown, including: Step 1: Collect the running status data of the target dynamic database connection pool in real time and send it to the configuration center; Step 2: The configuration center determines the connection number adjustment index based on the received operation status data of the connection pool and the connection request of the current target dynamic database connection pool; Step 3: Based on the connection number adjustment index, the configuration center dynamically updates the maximum number of connections in the connection pool and notifies the connection pool module to update.
[0019] In this embodiment, the database connection pool refers to creating a certain amount of database connection objects when the program is initialized and storing them in a memory area, which allows the application to reuse an existing database connection instead of re-establishing one; the operating status data includes the number of connections, the number of idle connections, the average connection release time, the average frequency of connection timeouts, and the average number of timeout retries, etc.
[0020] In this embodiment, the configuration center is used to store and manage the connection pool configuration, and supports dynamic configuration updates at runtime without restarting the service; the connection number adjustment index is used to adjust the maximum number of connections in the connection pool at the current moment to obtain the optimized maximum number of connections; the connection pool module is used to update the maximum number of connections based on the received update notification.
[0021] The beneficial effect of the above technical solution is: by utilizing the configuration center to collect the operating status data of the target dynamic database connection pool in real time, combining the connection request to calculate the connection number adjustment index, and then using the connection number adjustment index to dynamically update the maximum number of connections in the connection pool, thereby effectively improving the external service capabilities of the connection pool and ensuring the stable operation of the business system.
[0022] The embodiment of the present invention provides a dynamic database connection pool adjustment method, which collects the running status data of the target dynamic database connection pool in real time and sends it to the configuration center, including: Create a preset connection pool interface; The target client uses the preset connection pool interface to collect the operation status data of the target dynamic database connection pool in real time; The configuration center receives the running status data sent by the target client.
[0023] In this embodiment, the preset connection pool interface is used to collect the operating status data of the target dynamic database connection pool in real time, wherein the operating status data includes the number of connections, the number of idle connections, the average connection release time, the average connection timeout frequency, the average number of timeout retries, etc.
[0024] In this embodiment, the target client refers to the target platform that needs to use the database connection; the configuration center is used to store and manage the connection pool configuration, and supports dynamic configuration updates at runtime without restarting the service.
[0025] The beneficial effect of the above technical solution is: by creating a preset connection pool interface, the target client collects the operating status data of the target dynamic database connection pool in real time, and then the configuration center receives the operating status data sent by the target client to provide data support for subsequent dynamic database connection pool adjustments.
[0026] An embodiment of the present invention provides a method for adjusting a dynamic database connection pool, wherein the configuration center determines a connection number adjustment index based on received operation status data of the connection pool and in combination with a connection request of a current target dynamic database connection pool, including: Obtaining a connection request from the target dynamic database connection pool and determining the number of newly added connections; Extract the number of idle connections in the running status data of the connection pool at the current moment and compare it with the number of newly added connections; If the number of idle connections is not less than the number of newly added connections, and the difference is greater than the preset difference threshold, the output connection number adjustment index is zero; If the number of idle connections is not less than the number of newly added connections, and the difference is not greater than the preset difference threshold, the running status data at the current moment is adjusted using the number of newly added connections to obtain the pre-running status data at the next moment; Extracting the number of historical newly added connections within a preset time period from the connection request database and treating it as the first data; Introducing a regression prediction algorithm to predict the number of newly added connections at the next moment based on the first data; The number of newly added connections at the next moment and the pre-operation status data are combined and analyzed as key data to obtain a connection number adjustment index; If the number of idle connections is less than the number of newly added connections, the number of newly added connections and the running status data at the current moment are combined and analyzed as key data to obtain a connection number adjustment index.
[0027] In this embodiment, a connection request refers to a connection request sent by a target client to a target dynamic database connection pool; a database connection pool refers to a certain amount of database connection objects created when a program is initialized and stored in a memory area, which allows an application to reuse an existing database connection instead of establishing a new one; the number of newly added connections refers to the number of requests for database connections from the target client at the current moment.
[0028] In this embodiment, the number of idle connections refers to the number of idle connections in the connection pool; the preset difference threshold is set in advance.
[0029] In this embodiment, the pre-operation status data refers to the operation status data obtained by adjusting the operation status data at the current moment using the number of newly added connections, including the estimated number of connections, the estimated number of idle connections, etc.; the preset time period is set in advance; the key data refers to the number of newly added connections and the operation status data at the current moment, or the number of newly added connections and pre-operation status data at the next moment.
[0030] In this embodiment, the connection request database is composed of connection request data, including request time, number of connection requests, request sending address, etc.; the first data refers to the historical number of new connections, that is, the historical number of requests for database connections by the target client; the connection number adjustment index is used to adjust the maximum number of connections in the connection pool at the current moment to obtain the optimized maximum number of connections.
[0031] The beneficial effect of the above technical solution is: through the configuration center, the running status data and connection requests of the connection pool are combined and analyzed, and the connection number adjustment index is calculated to adjust the maximum number of connections of the connection pool at the current moment, and the maximum number of connections to meet the connection requests of the current connection pool is accurately obtained, thereby ensuring the effective service capacity of the connection pool.
[0032] The embodiment of the present invention provides a dynamic database connection pool adjustment method, and the calculation formula of the connection number adjustment index is as follows: ; Where L represents the connection number adjustment index; Indicates the maximum number of connections in the connection pool at the current moment; Represents the number of idle connections at the current moment; Indicates the number of new connections at the current moment; Indicates the number of released connections at the current moment; It is expressed as the average difference between the number of newly added connections and the number of released connections at each moment in the expected connection pool stability period t; It is represented by the impact index of the number of connections added and released at the current moment on the stability of the connection pool; m is represented by the number of connections in the connection pool at the current moment whose reference count is greater than the preset reference threshold; Represents the utilization of data connections in the connection pool at the current moment; It is expressed as the impact index of the data connection reference frequency on the connection pool stability. Indicates the fine-tuning coefficient for the connection number adjustment index to stabilize the connection pool; represents the loss factor generated for calculating the connection number adjustment index; Represents a constant.
[0033] The beneficial effect of the above technical solution is: by combining the number of new connections and the operating status data to obtain the connection number adjustment index, the maximum number of connections in the dynamic database connection pool can be adjusted, thereby effectively improving the external service capabilities of the connection pool to ensure the stable operation of the business system.
[0034] An embodiment of the present invention provides a dynamic database connection pool adjustment method, based on the connection number adjustment index, a configuration center dynamically updates the maximum number of connections in the connection pool and notifies the connection pool module to update, including: Comparing the connection adjustment index with a preset state adjustment threshold, and when the connection adjustment index is not greater than the preset state adjustment threshold, determining that the current target dynamic database connection pool does not need to update the maximum number of connections in the connection pool; Otherwise, it is determined that the current target dynamic database connection pool needs to update the maximum number of connections in the connection pool. At this time, the mode selection index is calculated using the connection number adjustment index, where the calculation formula of the mode selection index is as follows: ; In the formula, Expressed as the mode selection index; It is expressed as the connection number adjustment index at the current time t; It is indicated as a preset adjustment threshold; It is represented as the preset mode selection factor; If the mode selection index is in the emergency adjustment index interval, determining that the current connection update mode is the emergency adjustment mode; If the mode selection index is in the dynamic adjustment index interval, determining that the current connection update mode is the dynamic adjustment mode; The maximum number of connections in the current connection pool is adjusted using the calculated connection number adjustment index to obtain the optimized maximum number of connections; Based on the connection update mode and the optimized maximum number of connections, the configuration center matching the current connection pool generates an update notification; Decouple the configuration center of the current connection pool from the business logic; Receive the update notification generated by the configuration center through the pre-created configuration update interface, and then use the asynchronous notification mechanism to notify the connection pool module to update; When the connection update mode in the update notification received by the connection pool module is the emergency adjustment mode, the maximum number of connections is updated to the optimized maximum number of connections; When the connection update mode in the update notification received by the connection pool module is the dynamic adjustment mode, obtaining the number of connection updates each time; The maximum number of connections is dynamically updated using the number of connections updated each time until it is updated to the optimized maximum number of connections.
[0035] In this embodiment, the preset state adjustment threshold is set in advance; the mode selection index is used to determine the current connection update mode, wherein the connection update mode includes two modes: emergency adjustment mode and dynamic adjustment mode; the emergency adjustment mode refers to immediately updating the maximum number of connections in the connection pool at the current moment to the optimized maximum number of connections; the dynamic adjustment mode refers to updating the maximum number of connections multiple times based on the number of connections updated each time until the maximum number of connections is optimized; the optimized maximum number of connections is obtained by adjusting the maximum number of connections in the current connection pool using the calculated connection number adjustment index.
[0036] In this embodiment, the update notification refers to the update notification generated by the configuration center based on the optimized maximum number of connections and the selected connection update mode, and is received by a pre-created configuration update interface; the purpose of decoupling the configuration center from the business logic is to enable the connection pool to independently adjust the maximum number of connections based on the update of the configuration center; the configuration update interface is used to receive the update notification generated by the configuration center.
[0037] In this embodiment, the asynchronous notification mechanism refers to a mechanism that allows a process or thread to be notified when an event occurs and to immediately take corresponding action without blocking, and is used to notify the connection pool module to update; the connection pool module is used to update the maximum number of connections based on the connection update mode.
[0038] The beneficial effects of the above technical solution are: by using the connection number adjustment index to adjust the maximum number of connections in the current connection pool, the optimized maximum number of connections is obtained; the connection update mode is determined and combined with the optimized maximum number of connections, the configuration center generates an update notification; the configuration update interface is used to receive the update notification generated by the configuration center, and then the connection pool module is notified according to the asynchronous notification mechanism to accurately update the maximum number of connections, which can effectively improve the external service capabilities of the connection pool.
[0039] The embodiment of the present invention provides a dynamic database connection pool adjustment method, which obtains the number of connection updates each time, including: Extract the historical number of released connections and the historical number of deleted connections in the preset time period of the current key data from the connection pool related database, and construct a released connection curve and a deleted connection curve respectively; Analyze the connection release curve and the connection deletion curve to obtain the connection release change characteristic value and the deletion change characteristic value of the current connection pool in turn; The proportion of connections whose release time is greater than the average release time of connections in the key data is obtained and regarded as the first proportion; The proportion of the number of connections whose release time is not greater than the average release time of the connections in the key data is regarded as the second proportion; The release connection change characteristic value, the first ratio, the second ratio and the deletion change characteristic value are combined and calculated to obtain a reusability coefficient of the connection pool; The abnormal waiting coefficient of the data connection in the connection pool is calculated by using the average connection timeout frequency and the average number of timeout retry connections in the key data; The connection number update index is obtained by calculating the weighted average of the reusability coefficient and the abnormal waiting coefficient of the connection pool; Compare the optimized maximum number of connections with the maximum number of connections in the connection pool at the current moment to determine the connection difference; The connection number update index and the connection difference are analyzed and calculated to determine the number of connection updates each time.
[0040] In this embodiment, the connection pool related database is a database composed of operation status data such as connection pool historical release connection data, deletion connection data, connection pool utilization, average connection timeout frequency, and average number of timeout retry connections; the historical preset time period is set in advance.
[0041] In this embodiment, the historical number of released connections refers to the number of database connections released by clients at each moment within a historical preset time period; the historical number of deleted connections refers to the number of connections whose reference counts are greater than a specified value deleted by the connection pool at each moment within a historical preset time period.
[0042] In this embodiment, the connection release curve is a curve constructed by the number of historical released connections in a historical preset time period; the connection deletion curve is a curve constructed by the number of historical deleted connections in a historical preset time period; the connection release change characteristic value is used to express the change characteristics of the released connections of the connection pool within a certain period of time; the deletion change characteristic value is used to express the change characteristics of the deleted connections of the connection pool within a certain period of time.
[0043] In this embodiment, the first ratio refers to the proportion of connections whose release time is greater than the average release time of connections in the key data to all connections in the connection pool; the second ratio refers to the proportion of connections whose release time is not greater than the average release time of connections in the key data to all connections in the connection pool.
[0044] In this embodiment, the reusability coefficient is used to describe the resource reuse of the connection pool at the current moment; the exception waiting coefficient is used to describe the connection exception and processing of the connection pool; the connection number update index refers to an index obtained by analyzing and calculating the number of connection updates each time based on the analysis of the reusability coefficient and the exception waiting coefficient and the connection difference, and can also be used to describe the performance of the connection pool at the current moment, where the connection difference refers to the difference between the optimized maximum number of connections and the maximum number of connections in the connection pool at the current moment.
[0045] The beneficial effects of the above technical solution are: by combining the analysis of the release and deletion of connections in the connection pool and the abnormal waiting processing, the connection number update index is calculated; the difference between the connection number update index and the optimized maximum number of connections and the maximum number of connections in the connection pool at the current moment is analyzed to obtain the number of connections updated each time, thereby ensuring the dynamic update effect of the maximum number of connections in the dynamic adjustment mode.
[0046] The embodiment of the present invention provides a dynamic database connection pool adjustment system, such as Figure 2 As shown, including: Data collection module: collects the running status data of the target dynamic database connection pool in real time and sends it to the configuration center; Index analysis module: The configuration center determines the connection number adjustment index based on the received operation status data of the connection pool and the connection request of the current target dynamic database; Adjustment module: Based on the connection number adjustment index, the configuration center dynamically updates the maximum number of connections in the connection pool and notifies the connection pool module to update.
[0047] The beneficial effect of the above technical solution is: by utilizing the configuration center to collect the operating status data of the target dynamic database connection pool in real time, combining the connection request to calculate the connection number adjustment index, and then using the connection number adjustment index to dynamically update the maximum number of connections in the connection pool, thereby effectively improving the external service capabilities of the connection pool and ensuring the stable operation of the business system.
[0048] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for adjusting a dynamic database connection pool, characterized in that: include: Step 1: Collect the running status data of the target dynamic database connection pool in real time and send it to the configuration center; Step 2: The configuration center determines the connection number adjustment index based on the received operation status data of the connection pool and the connection request of the current target dynamic database connection pool; Step 3: Based on the connection number adjustment index, the configuration center dynamically updates the maximum number of connections in the connection pool and notifies the connection pool module to update.
2. A method for adjusting a dynamic database connection pool according to claim 1, characterized in that: Collect the running status data of the target dynamic database connection pool in real time and send it to the configuration center, including: Create a preset connection pool interface; The target client uses the preset connection pool interface to collect the operation status data of the target dynamic database connection pool in real time; The configuration center receives the running status data sent by the target client.
3. A method for adjusting a dynamic database connection pool according to claim 2, characterized in that: The configuration center is used to store and manage connection pool configurations, and supports dynamic configuration updates at runtime without restarting the service.
4. A method for adjusting a dynamic database connection pool according to claim 1, characterized in that: The configuration center determines the connection number adjustment index based on the received operation status data of the connection pool and the connection request of the current target dynamic database connection pool, including: Obtaining a connection request from the target dynamic database connection pool and determining the number of newly added connections; Extract the number of idle connections in the running status data of the connection pool at the current moment and compare it with the number of newly added connections; If the number of idle connections is not less than the number of newly added connections, and the difference is greater than the preset difference threshold, the output connection number adjustment index is zero; If the number of idle connections is not less than the number of newly added connections, and the difference is not greater than the preset difference threshold, the running status data at the current moment is adjusted using the number of newly added connections to obtain the pre-running status data at the next moment; Extracting the number of historical newly added connections within a preset time period from the connection request database and treating it as the first data; Introducing a regression prediction algorithm to predict the number of newly added connections at the next moment based on the first data; The number of newly added connections at the next moment and the pre-operation status data are combined and analyzed as key data to obtain a connection number adjustment index; If the number of idle connections is less than the number of newly added connections, the number of newly added connections and the running status data at the current moment are combined and analyzed as key data to obtain a connection number adjustment index.
5. A method for adjusting a dynamic database connection pool according to claim 4, characterized in that: The calculation formula of the connection adjustment index is as follows: ; Where L represents the connection number adjustment index; Indicates the maximum number of connections in the connection pool at the current moment; Represents the number of idle connections at the current moment; Indicates the number of newly added connections at the current moment; Indicates the number of released connections at the current moment; It is expressed as the average difference between the number of newly added connections and the number of released connections at each moment in the expected connection pool stability period t; It is represented by the impact index of the number of connections added and released at the current moment on the stability of the connection pool; m is represented by the number of connections in the connection pool at the current moment whose reference count is greater than the preset reference threshold; Represents the utilization of data connections in the connection pool at the current moment; It is expressed as the impact index of the data connection reference frequency on the connection pool stability. Indicates the fine-tuning coefficient for the connection number adjustment index to stabilize the connection pool; represents the loss factor generated for calculating the connection number adjustment index; Represents a constant.
6. A method for adjusting a dynamic database connection pool according to claim 1, characterized in that: Based on the connection number adjustment index, the configuration center dynamically updates the maximum number of connections in the connection pool and notifies the connection pool module to update, including: Comparing the connection adjustment index with a preset state adjustment threshold, and when the connection adjustment index is not greater than the preset state adjustment threshold, determining that the current target dynamic database connection pool does not need to update the maximum number of connections in the connection pool; Otherwise, it is determined that the current target dynamic database connection pool needs to update the maximum number of connections in the connection pool. At this time, the mode selection index is calculated using the connection number adjustment index, where the calculation formula of the mode selection index is as follows: ; In the formula, Expressed as the mode selection index; It is expressed as the connection number adjustment index at the current time t; It is indicated as a preset adjustment threshold; It is represented as the preset mode selection factor; If the mode selection index is in the emergency adjustment index interval, determining that the current connection update mode is the emergency adjustment mode; If the mode selection index is in the dynamic adjustment index interval, determining that the current connection update mode is the dynamic adjustment mode; The maximum number of connections in the current connection pool is adjusted using the calculated connection number adjustment index to obtain the optimized maximum number of connections; Based on the connection update mode and the optimized maximum number of connections, the configuration center matching the current connection pool generates an update notification; Decouple the configuration center of the current connection pool from the business logic; Receive the update notification generated by the configuration center through the pre-created configuration update interface, and then use the asynchronous notification mechanism to notify the connection pool module to update; When the connection update mode in the update notification received by the connection pool module is the emergency adjustment mode, the maximum number of connections is updated to the optimized maximum number of connections; When the connection update mode in the update notification received by the connection pool module is the dynamic adjustment mode, obtaining the number of connection updates each time; The maximum number of connections is dynamically updated using the number of connections updated each time until it is updated to the optimized maximum number of connections.
7. A method for adjusting a dynamic database connection pool according to claim 6, characterized in that: Get the number of updates for each connection, including: Extract the historical number of released connections and the historical number of deleted connections in the preset time period of the current key data from the connection pool related database, and construct a released connection curve and a deleted connection curve respectively; Analyze the connection release curve and the connection deletion curve to obtain the connection release change characteristic value and the deletion change characteristic value of the current connection pool in turn; The proportion of connections whose release time is greater than the average release time of connections in the key data is obtained and regarded as the first proportion; The proportion of the number of connections whose release time is not greater than the average release time of the connections in the key data is regarded as the second proportion; The release connection change characteristic value, the first ratio, the second ratio and the deletion change characteristic value are combined and calculated to obtain a reusability coefficient of the connection pool; The abnormal waiting coefficient of the data connection in the connection pool is calculated by using the average connection timeout frequency and the average number of timeout retry connections in the key data; The connection number update index is obtained by calculating the weighted average of the reusability coefficient and the abnormal waiting coefficient of the connection pool; Compare the optimized maximum number of connections with the maximum number of connections in the connection pool at the current moment to determine the connection difference; The connection number update index and the connection difference are analyzed and calculated to determine the number of connection updates each time.
8. A dynamic database connection pool adjustment system, characterized in that: include: Data collection module: collects the running status data of the target dynamic database connection pool in real time and sends it to the configuration center; Index analysis module: The configuration center determines the connection number adjustment index based on the received operation status data of the connection pool and the connection request of the current target dynamic database; Adjustment module: Based on the connection number adjustment index, the configuration center dynamically updates the maximum number of connections in the connection pool and notifies the connection pool module to update.
Citation Information
Patent Citations
Connection pool based efficient multiuser database access optimization method and framework
CN103605727A
Dynamic management method and system of database connection pool
CN106250500A
Management system of cluster database connection pool
CN112069237A
Database connection management system and method based on LSM tree
CN117762982A
System and method for supporting live addition of a tenant in a connection pool environment
US20180048717A1
Cited By
Intelligent identification system for information technology consultation
CN119961013A
An intelligent recognition system for information technology consulting
CN119961013B
High-concurrency communication service platform and method
CN120455524A