[go: up one dir, main page]

CN119474046A - A dynamic database connection pool adjustment method and system - Google Patents

A dynamic database connection pool adjustment method and system Download PDF

Info

Publication number
CN119474046A
CN119474046A CN202410536392.7A CN202410536392A CN119474046A CN 119474046 A CN119474046 A CN 119474046A CN 202410536392 A CN202410536392 A CN 202410536392A CN 119474046 A CN119474046 A CN 119474046A
Authority
CN
China
Prior art keywords
connection
connections
connection pool
pool
index
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410536392.7A
Other languages
Chinese (zh)
Inventor
于亮
梁腾翔
孙哲
林东煦
祝家鑫
洪少博
范振兴
杨海军
黄贺亮
许铭芮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huaneng Information Technology Co Ltd
Original Assignee
Huaneng Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huaneng Information Technology Co Ltd filed Critical Huaneng Information Technology Co Ltd
Priority to CN202410536392.7A priority Critical patent/CN119474046A/en
Publication of CN119474046A publication Critical patent/CN119474046A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/217Database tuning
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3442Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for planning or managing the needed capacity
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/80Database-specific techniques

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a method and a system for adjusting a dynamic database connection pool, which relate to the technical field of computers and comprise the steps of collecting running state data of a target dynamic database connection pool in real time and sending the running state data to a configuration center, wherein the configuration center determines a connection number adjustment index based on the received running state data of the connection pool and then combines a connection request of the current target dynamic database connection pool, dynamically updates the maximum connection number of the connection pool based on the connection number adjustment index, and informs a connection pool module to update. The configuration center is utilized to acquire the running state data of the target dynamic database connection pool in real time, the connection number adjustment index is obtained by combining with the connection request calculation, and the maximum connection number of the connection pool is dynamically updated by utilizing the connection number adjustment index, so that the service capacity of the connection pool outside is effectively improved, and the running stability of a business system is ensured.

Description

Dynamic database connection pool adjustment method and system
Technical Field
The invention relates to the technical field of computers, in particular to a method and a system for adjusting a dynamic database connection pool.
Background
Database connection is a key, limited and expensive resource, creating and releasing database connection is a time-consuming operation, frequent execution of such operation occupies a large amount of performance overhead, and further results in a decrease in response speed of the website, and in severe cases, a server crash may be caused, so that in order to save the performance overhead, an application system generally adopts a database connection pool. At present, with the rapid development of services, the configuration of a single fixed database connection pool has hardly satisfied the requirements of the development of services.
Therefore, the invention provides a method and a system for adjusting the connection pool of a dynamic database, which realize the dynamic adjustment of the maximum connection number of the connection pool, so as to effectively improve the service capacity of the connection pool to the outside and ensure the stable operation of a business system.
Disclosure of Invention
The invention provides a method and a system for adjusting a dynamic database connection pool, which are used for acquiring running state data of a target dynamic database connection pool in real time by utilizing a configuration center, calculating a connection number adjustment index in combination with a connection request, dynamically updating the maximum connection number of the connection pool by utilizing the connection number adjustment index, further effectively improving the service capacity of the connection pool to the outside, and ensuring the running stability of a business system.
The invention provides a dynamic database connection pool adjustment method, which comprises the following steps:
step 1, acquiring running state data of a target dynamic database connection pool in real time and sending the running state data to a configuration center;
step 2, the configuration center determines a connection number adjustment index based on the received operation state data of the connection pool and then combines the connection request of the current target dynamic database connection pool;
and 3, adjusting the index based on the connection number, dynamically updating the maximum connection number of the connection pool by the configuration center, and informing the connection pool module to update.
Preferably, the real-time collection of the operation state data of the target dynamic database connection pool and the transmission to the configuration center includes:
Creating a preset connection pool interface;
the target client acquires the running state data of the target dynamic database connection pool in real time by utilizing the preset connection pool interface;
And the configuration center receives the running state data sent by the target client.
Preferably, the configuration center is configured to store and manage connection pool configurations and support dynamic updating of configurations at runtime without restarting the service.
Preferably, the configuration center determines the connection number adjustment index based on the received operation state data of the connection pool and in combination with the connection request of the current target dynamic database connection pool, and includes:
acquiring a connection request of the target dynamic database connection pool, and determining a newly-added connection number;
Extracting the idle connection number in the running state data of the connection pool at the current moment and comparing the idle connection number with the newly-added connection number;
If the idle connection number is not less than the newly added connection number and the difference number is greater than a preset difference number threshold, outputting a connection number adjustment index to be zero;
if the number of idle connections is not less than the number of newly added connections and the difference is not greater than a preset difference threshold, adjusting the running state data at the current moment by using the number of newly added connections to obtain the pre-running state data at the next moment;
extracting the historical newly-increased connection number in a preset time period from a connection request database, and taking the historical newly-increased connection number as first data;
introducing a regression prediction algorithm to predict and obtain a new connection number at the next moment based on the first data;
combining and analyzing the newly-added connection number at the next moment and the pre-running state data as key data to obtain a connection number adjustment index;
if the idle connection number is smaller than the newly added connection number, combining and analyzing the newly added connection number and the running state data at the current moment as key data to obtain a connection number adjustment index.
Preferably, the calculation formula of the connection number adjustment index is as follows:
wherein L is represented as a connection number adjustment index; The maximum connection number of the connection pool at the current moment is expressed; The number of idle connections is expressed as the current moment; the new connection number is expressed as the current moment; The number of released connections is expressed as the current time; Representing the average difference value of the newly added connection number and the released connection number at each moment in the period of time of stabilizing t of the expected connection pool; m is represented as the number of connection numbers with the reference times in the connection pool at the current moment being greater than a preset reference threshold; Representing the utilization quantity of data connection in the connection pool at the current moment; an evaluation impact index expressed as a data connection reference frequency on connection pool stability; a fine tuning coefficient expressed as a connection pool stability adjustment index for the number of connections; Representing the loss factor generated by calculating the connection number adjustment index; Representing a constant.
Preferably, based on the connection number adjustment index, the configuration center dynamically updates the maximum connection number of 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 larger than the preset state adjustment threshold, judging that the maximum connection number of the current target dynamic database connection pool does not need to be updated;
Otherwise, determining that the current target dynamic database connection pool needs to update the maximum connection number of the connection pool, and at this time, calculating a mode selection index by using the connection number adjustment index, wherein the calculation formula of the mode selection index is as follows:
In the formula (I), in the formula (II), Represented as a mode selection index; the connection number adjustment index is expressed as the current t moment; representing as a preset adjustment threshold; expressed as a preset mode selection factor;
if the mode selection index is in the emergency adjustment index interval, determining that the current connection updating mode is an emergency adjustment mode;
if the mode selection index is in the dynamic adjustment index interval, determining that the current connection updating mode is a dynamic adjustment mode;
adjusting the maximum connection number of the current connection pool by using the calculated connection number adjustment index to obtain an optimized maximum connection number;
generating an update notification by a configuration center matched with the current connection pool based on the connection update mode and the optimized maximum connection number;
Decoupling the configuration center of the current connection pool from the service logic;
receiving an update notification generated by the configuration center through a pre-established configuration update interface, and notifying a connection pool module to update by using an asynchronous notification mechanism;
When the connection update mode in the update notification received by the connection pool module is an emergency adjustment mode, updating the maximum connection number to an optimized maximum connection number;
when the connection update mode in the update notification received by the connection pool module is a dynamic adjustment mode, acquiring the number of connection updates each time;
and dynamically updating the maximum connection number by using the updated connection number per time until the maximum connection number is updated to be the optimized maximum connection number.
Preferably, the obtaining the updated number of each connection includes:
Extracting the historical release connection number and the historical deletion connection number of the release connection number in the current key data in a connection pool related database in a historical preset time period, and respectively constructing a release connection curve and a deletion connection curve;
Analyzing the release connection curve and the deletion connection curve to sequentially obtain a release connection change characteristic value and a deletion change characteristic value of the current connection pool;
acquiring a connection number proportion of which the release time is longer than the connection average release time in the key data, and taking the connection number proportion as a first proportion;
Regarding the connection number proportion of which the release time is not more than the connection average release time in the key data as a second proportion;
Combining and calculating the release connection change characteristic value, the first proportion, the second proportion and the deletion change characteristic value to obtain a reusable coefficient of the connection pool;
Calculating to obtain an abnormal waiting coefficient of data connection in the connection pool by using the connection overtime average frequency and the overtime retry connection average times in the key data;
calculating the weighted average of the multiplexing coefficient and the abnormal waiting coefficient of the connection pool to obtain a connection number update index;
Comparing the optimized maximum connection number with the maximum connection number of the connection pool at the current moment to determine a connection difference number;
and analyzing and calculating the connection number updating index and the connection difference number, and determining the number of connection updating each time.
The invention provides a dynamic database connection pool adjustment system, which comprises:
the data acquisition module acquires the running state data of the target dynamic database connection pool in real time and sends the running state data to the configuration center;
The configuration center determines a connection number adjustment index based on the received operation state data of the connection pool and then combines the connection request of the current target dynamic database;
and the adjusting module is used for dynamically updating the maximum connection number of the connection pool by the configuration center based on the connection number adjusting index and notifying the connection pool module to update.
Compared with the prior art, the application has the following beneficial effects:
The configuration center is utilized to acquire the running state data of the target dynamic database connection pool in real time, the connection number adjustment index is obtained by combining with the connection request calculation, and the maximum connection number of the connection pool is dynamically updated by utilizing the connection number adjustment index, so that the service capacity of the connection pool outside is effectively improved, and the running stability of a business system is ensured.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention may be realized and attained by the structure particularly pointed out in the written description and drawings.
The technical scheme of the invention is further described in detail through the drawings and the embodiments.
Drawings
The accompanying drawings are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate the invention and together with the embodiments of the invention, serve to explain the invention. In the drawings:
FIG. 1 is a flowchart of a method for adjusting a dynamic database connection pool according to an embodiment of the present invention;
FIG. 2 is a block diagram of a dynamic database connection pool adjustment system in accordance with an embodiment of the present invention.
Detailed Description
The preferred embodiments of the present invention will be described below with reference to the accompanying drawings, it being understood that the preferred embodiments described herein are for illustration and explanation of the present invention only, and are not intended to limit the present invention.
An embodiment of the present invention provides a method for adjusting a dynamic database connection pool, as shown in fig. 1, including:
step 1, acquiring running state data of a target dynamic database connection pool in real time and sending the running state data to a configuration center;
step 2, the configuration center determines a connection number adjustment index based on the received operation state data of the connection pool and then combines the connection request of the current target dynamic database connection pool;
and 3, adjusting the index based on the connection number, dynamically updating the maximum connection number of the connection pool by the configuration center, and informing the connection pool module to update.
In this embodiment, the database connection pool refers to creating a certain amount of database connection objects and storing them in a memory area when the program is initialized, which allows the application program to reuse an existing database connection instead of reestablishing one, and the running state data includes the number of connected connections, the number of idle connections, the average connection release time, the average connection timeout frequency, the average number of timeout retry connections, and so on.
In the embodiment, the configuration center is used for storing and managing the configuration of the connection pool and supporting the dynamic update configuration in the running process without restarting the service, the connection number adjustment index is used for adjusting the maximum connection number of the connection pool at the current moment to obtain the optimized maximum connection number, and the connection pool module is used for updating the maximum connection number based on the received update notification.
The technical scheme has the beneficial effects that the configuration center is utilized to acquire the running state data of the target dynamic database connection pool in real time, the connection number adjustment index is calculated by combining the connection request, and the maximum connection number of the connection pool is dynamically updated by utilizing the connection number adjustment index, so that the service capacity of the connection pool to the outside is effectively improved, and the running stability of a business system is ensured.
The embodiment of the invention provides a dynamic database connection pool adjustment method, which is used for collecting running state data of a target dynamic database connection pool in real time and sending the running state data to a configuration center, and comprises the following steps:
Creating a preset connection pool interface;
the target client acquires the running state data of the target dynamic database connection pool in real time by utilizing the preset connection pool interface;
And the configuration center receives the running state data sent by the target client.
In this embodiment, the preset connection pool interface is configured to collect, in real time, operation state data of the connection pool of the target dynamic database, where the operation state data includes a number of connected connections, a number of idle connections, an average connection release time, an average connection timeout frequency, an average number of time-out retry connections, and so on.
In this embodiment, the target client refers to a target platform that needs to use database connections, and the configuration center is configured to store and manage connection pool configurations, and support dynamic update of configurations at runtime without restarting the service.
The technical scheme has the advantages that the target client side acquires the running state data of the target dynamic database connection pool in real time by creating the preset connection pool interface, and the reconfiguration center receives the running state data sent by the target client side and provides data support for subsequent dynamic database connection pool adjustment.
The embodiment of the invention provides a method for adjusting a dynamic database connection pool, wherein the configuration center determines a connection number adjustment index based on the received operation state data of the connection pool and in combination with a connection request of a current target dynamic database connection pool, and the method comprises the following steps:
acquiring a connection request of the target dynamic database connection pool, and determining a newly-added connection number;
Extracting the idle connection number in the running state data of the connection pool at the current moment and comparing the idle connection number with the newly-added connection number;
If the idle connection number is not less than the newly added connection number and the difference number is greater than a preset difference number threshold, outputting a connection number adjustment index to be zero;
if the number of idle connections is not less than the number of newly added connections and the difference is not greater than a preset difference threshold, adjusting the running state data at the current moment by using the number of newly added connections to obtain the pre-running state data at the next moment;
extracting the historical newly-increased connection number in a preset time period from a connection request database, and taking the historical newly-increased connection number as first data;
introducing a regression prediction algorithm to predict and obtain a new connection number at the next moment based on the first data;
combining and analyzing the newly-added connection number at the next moment and the pre-running state data as key data to obtain a connection number adjustment index;
if the idle connection number is smaller than the newly added connection number, combining and analyzing the newly added connection number and the running state data at the current moment as key data to obtain a connection number adjustment index.
In this embodiment, the connection request refers to a connection request sent by the target client to the target dynamic database connection pool, where the database connection pool refers to a number of database connection objects created and stored in a memory area during program initialization, and allows the application program to reuse an existing database connection instead of reestablishing one, and the newly added connection number refers to the number of requests for the database connection by the target client at the current time.
In this embodiment, the number of idle connections refers to the number of idle connections in the connection pool, and the preset difference threshold is set in advance.
In this embodiment, the pre-running state data refers to running state data obtained by adjusting running state data at a current moment by using a new connection number, including estimating a connected number, estimating an idle connection number, and the like, the preset time period is set in advance, and the key data refers to the new connection number and the running state data at the current moment, or the new connection number and the pre-running state data at a next moment.
In this embodiment, the connection request database is composed of connection request data, including request time, connection request number, request sending address, etc., the first data refers to a historical newly-added connection number, that is, the historical request number of the target client for the database connection, and the connection number adjustment index is used for adjusting the maximum connection number at the current moment of the connection pool to obtain an optimized maximum connection number.
The technical scheme has the beneficial effects that the configuration center is used for carrying out combination analysis on the operation state data and the connection request of the connection pool, the connection number adjustment index is calculated to adjust the maximum connection number of the connection pool at the current moment, the maximum connection number of the connection request of the current connection pool is accurately obtained, and the effective service capability of the connection pool is further ensured.
The embodiment of the invention provides a dynamic database connection pool adjustment method, wherein the calculation formula of a connection number adjustment index is as follows:
wherein L is represented as a connection number adjustment index; The maximum connection number of the connection pool at the current moment is expressed; The number of idle connections is expressed as the current moment; the new connection number is expressed as the current moment; The number of released connections is expressed as the current time; Representing the average difference value of the newly added connection number and the released connection number at each moment in the period of time of stabilizing t of the expected connection pool; m is represented as the number of connection numbers with the reference times in the connection pool at the current moment being greater than a preset reference threshold; Representing the utilization quantity of data connection in the connection pool at the current moment; an evaluation impact index expressed as a data connection reference frequency on connection pool stability; a fine tuning coefficient expressed as a connection pool stability adjustment index for the number of connections; Representing the loss factor generated by calculating the connection number adjustment index; Representing a constant.
The technical scheme has the beneficial effects that the maximum connection number of the dynamic database connection pool is adjusted by combining the newly added connection number and the running state data to obtain the connection number adjustment index through operation, so that the external service capacity of the connection pool can be effectively improved, and the running stability of a business system is ensured.
The embodiment of the invention provides a method for adjusting a connection pool of a dynamic database, which is used for dynamically updating the maximum connection number of the connection pool by a configuration center based on the connection number adjustment index and notifying a connection pool module to update, and comprises the following steps:
comparing the connection adjustment index with a preset state adjustment threshold, and when the connection adjustment index is not larger than the preset state adjustment threshold, judging that the maximum connection number of the current target dynamic database connection pool does not need to be updated;
Otherwise, determining that the current target dynamic database connection pool needs to update the maximum connection number of the connection pool, and at this time, calculating a mode selection index by using the connection number adjustment index, wherein the calculation formula of the mode selection index is as follows:
In the formula (I), in the formula (II), Represented as a mode selection index; the connection number adjustment index is expressed as the current t moment; representing as a preset adjustment threshold; expressed as a preset mode selection factor;
if the mode selection index is in the emergency adjustment index interval, determining that the current connection updating mode is an emergency adjustment mode;
if the mode selection index is in the dynamic adjustment index interval, determining that the current connection updating mode is a dynamic adjustment mode;
adjusting the maximum connection number of the current connection pool by using the calculated connection number adjustment index to obtain an optimized maximum connection number;
generating an update notification by a configuration center matched with the current connection pool based on the connection update mode and the optimized maximum connection number;
Decoupling the configuration center of the current connection pool from the service logic;
receiving an update notification generated by the configuration center through a pre-established configuration update interface, and notifying a connection pool module to update by using an asynchronous notification mechanism;
When the connection update mode in the update notification received by the connection pool module is an emergency adjustment mode, updating the maximum connection number to an optimized maximum connection number;
when the connection update mode in the update notification received by the connection pool module is a dynamic adjustment mode, acquiring the number of connection updates each time;
and dynamically updating the maximum connection number by using the updated connection number per time until the maximum connection number is updated to be the optimized maximum connection number.
In the embodiment, the preset state adjustment threshold is set in advance, the mode selection index is used for determining a current connection update mode, the connection update mode comprises an emergency adjustment mode and a dynamic adjustment mode, the emergency adjustment mode is used for immediately updating the maximum connection number of the connection pool at the current moment to an optimal maximum connection number, the dynamic adjustment mode is used for updating the maximum connection number for a plurality of times based on the updated connection number each time until the maximum connection number is optimized, and the optimal maximum connection number is obtained by adjusting the maximum connection number of the current connection pool by using the calculated connection number adjustment index.
In this embodiment, the update notification is generated by the configuration center based on the optimized maximum connection number and the selected connection update mode, and is received by a pre-created configuration update interface, where the purpose of decoupling the configuration center from the service logic is to enable the connection pool to independently adjust the maximum connection number according to the update of the configuration center, and the configuration update interface is configured to receive the update notification generated by the configuration center.
In this embodiment, the asynchronous notification mechanism refers to a mechanism that allows a process or thread to be notified when a certain event occurs and can immediately make a corresponding process without blocking, and is used to notify a connection pool module for updating, which is used to update the maximum connection number based on the connection update mode.
The technical scheme has the advantages that the maximum connection number of the current connection pool is adjusted by utilizing the connection number adjustment index to obtain the optimized maximum connection number, the connection update mode is determined, the optimized maximum connection number is combined, the configuration center generates update notification, the update notification generated by the configuration center is received by utilizing the configuration update interface, the connection pool module is notified to accurately update the maximum connection number according to the asynchronous notification mechanism, and the effective improvement of the external service capability of the connection pool can be realized.
The embodiment of the invention provides a method for adjusting a dynamic database connection pool, which comprises the following steps of:
Extracting the historical release connection number and the historical deletion connection number of the release connection number in the current key data in a connection pool related database in a historical preset time period, and respectively constructing a release connection curve and a deletion connection curve;
Analyzing the release connection curve and the deletion connection curve to sequentially obtain a release connection change characteristic value and a deletion change characteristic value of the current connection pool;
acquiring a connection number proportion of which the release time is longer than the connection average release time in the key data, and taking the connection number proportion as a first proportion;
Regarding the connection number proportion of which the release time is not more than the connection average release time in the key data as a second proportion;
Combining and calculating the release connection change characteristic value, the first proportion, the second proportion and the deletion change characteristic value to obtain a reusable coefficient of the connection pool;
Calculating to obtain an abnormal waiting coefficient of data connection in the connection pool by using the connection overtime average frequency and the overtime retry connection average times in the key data;
calculating the weighted average of the multiplexing coefficient and the abnormal waiting coefficient of the connection pool to obtain a connection number update index;
Comparing the optimized maximum connection number with the maximum connection number of the connection pool at the current moment to determine a connection difference number;
and analyzing and calculating the connection number updating index and the connection difference number, and determining the number of connection updating each time.
In this embodiment, the connection pool related database is a database formed by connection pool historical connection data release, connection data deletion, connection pool utilization, connection timeout average frequency, timeout retry connection average number of times and other operation state data, and the historical preset time period is set in advance.
In this embodiment, the history released connection number refers to the number of database connections released by the client at each moment in a history preset time period, and the history deleted connection number refers to the number of connections deleted by the connection pool at each moment in the history preset time period, where the number of references deleted by the connection pool is greater than a specified value.
In the embodiment, the release connection curve is a curve constructed by a historical release connection number of a historical preset time period, the deletion connection curve is a curve constructed by a historical deletion connection number of the historical preset time period, the release connection change characteristic value is used for expressing change characteristics of release connection of the connection pool in a certain time, and the deletion change characteristic value is used for expressing change characteristics of deletion connection of the connection pool in a certain time.
In this embodiment, the first ratio refers to the specific gravity of the number of connections whose release time is greater than the connection average release time in the key data to all the connection numbers in the connection pool, and the second ratio refers to the specific gravity of the number of connections whose release time is not greater than the connection average release time in the key data to all the connection numbers in the connection pool.
In the embodiment, the reusability coefficient is used for expressing the resource multiplexing condition of the connection pool at the current moment, the abnormal waiting coefficient is used for expressing the connection abnormality and the processing condition of the connection pool, the connection number updating index is an index for determining the connection updating number each time based on the analysis and calculation of the connection difference number obtained by combining and analyzing the reusability coefficient and the abnormal waiting coefficient, and the connection difference number is also used for expressing the performance of the connection pool at the current moment, wherein the connection difference number is the number difference between the maximum connection number and the maximum connection number of the connection pool at the current moment.
The technical scheme has the advantages that the connection number updating index is calculated by combining analysis of the connection releasing, connection deleting and exception waiting conditions of the connection pool, the connection number updating index and the difference between the maximum connection number and the maximum connection number of the connection pool at the current moment are analyzed to obtain the connection updating number each time, and further the dynamic updating effect of the maximum connection number in a dynamic adjustment mode is guaranteed.
An embodiment of the present invention provides a dynamic database connection pool adjustment system, as shown in fig. 2, including:
the data acquisition module acquires the running state data of the target dynamic database connection pool in real time and sends the running state data to the configuration center;
The configuration center determines a connection number adjustment index based on the received operation state data of the connection pool and then combines the connection request of the current target dynamic database;
and the adjusting module is used for dynamically updating the maximum connection number of the connection pool by the configuration center based on the connection number adjusting index and notifying the connection pool module to update.
The technical scheme has the beneficial effects that the configuration center is utilized to acquire the running state data of the target dynamic database connection pool in real time, the connection number adjustment index is calculated by combining the connection request, and the maximum connection number of the connection pool is dynamically updated by utilizing the connection number adjustment index, so that the service capacity of the connection pool to the outside is effectively improved, and the running stability of a business system is ensured.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (8)

1.一种动态数据库连接池调整方法,其特征在于,包括:1. A method for adjusting a dynamic database connection pool, comprising: 步骤1:实时采集目标动态数据库连接池的运行状态数据并发送给配置中心;Step 1: Collect the running status data of the target dynamic database connection pool in real time and send it to the configuration center; 步骤2:所述配置中心基于接收到的连接池的运行状态数据,再结合当前目标动态数据库连接池的连接请求,确定连接数调整指数;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; 步骤3:基于所述连接数调整指数,配置中心动态更新连接池最大连接数,并通知连接池模块进行更新。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.根据权利要求1所述的一种动态数据库连接池调整方法,其特征在于,实时采集目标动态数据库连接池的运行状态数据并发送给配置中心,包括:2. A method for adjusting a dynamic database connection pool according to claim 1, characterized in that real-time collection of operating status data of a target dynamic database connection pool and sending the data to a configuration center comprises: 创建预置连接池接口;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.根据权利要求2所述的一种动态数据库连接池调整方法,其特征在于,所述配置中心用于存储和管理连接池配置,以及支持在运行时动态更新配置,无需重启服务。3. A dynamic database connection pool adjustment method 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.根据权利要求1所述的一种动态数据库连接池调整方法,其特征在于,所述配置中心基于接收到的连接池的运行状态数据,再结合当前目标动态数据库连接池的连接请求,确定连接数调整指数,包括: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 running 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.根据权利要求4所述的一种动态数据库连接池调整方法,其特征在于,连接数调整指数的计算公式如下所示:5. A method for adjusting a dynamic database connection pool according to claim 4, characterized in that the calculation formula of the connection number adjustment index is as follows: ;式中,L表示为连接数调整指数;表示为当前时刻连接池的最大连接数;表示为当前时刻的空闲连接数;表示为当前时刻的新增连接数;表示为当前时刻的释放连接数;表示为期望连接池稳定t时段内的每时刻新增连接数与释放连接数的平均差值;表示为当前时刻的连接数新增-释放情况对连接池稳定性的评估影响指数;m表示为当前时刻连接池中引用次数大于预设引用阈值的连接个数;表示为当前时刻连接池中数据连接的利用量;表示为数据连接引用频率对连接池稳定性的评估影响指数;表示为连接池稳定针对连接数调整指数的微调系数;表示为计算连接数调整指数产生的损耗因子;表示常数。 ; 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. 6.根据权利要求1所述的一种动态数据库连接池调整方法,其特征在于,基于所述连接数调整指数,配置中心动态更新连接池最大连接数,并通知连接池模块进行更新,包括: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, comprising: 将所述连接调整指数与预设状态调整阈值进行比较,当所述连接调整指数不大于预设状态调整阈值时,判定当前目标动态数据库连接池无需更新连接池的最大连接数;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: ;式中,表示为模式选择指数;表示为当前t时刻的连接数调整指数;表示为预设调整阈值;表示为预设模式选择因子; ; 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.根据权利要求6所述的一种动态数据库连接池调整方法,其特征在于,获取每次连接更新个数,包括:7. A method for adjusting a dynamic database connection pool according to claim 6, characterized in that obtaining the number of connection updates each time comprises: 从连接池相关数据库中提取当前关键数据中的释放连接数的历史预设时间周期的历史释放连接数、历史删除连接数,并分别构建释放连接曲线、删除连接曲线;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.一种动态数据库连接池调整系统,其特征在于,包括:8. A dynamic database connection pool adjustment system, characterized by 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.
CN202410536392.7A 2024-04-30 2024-04-30 A dynamic database connection pool adjustment method and system Pending CN119474046A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410536392.7A CN119474046A (en) 2024-04-30 2024-04-30 A dynamic database connection pool adjustment method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410536392.7A CN119474046A (en) 2024-04-30 2024-04-30 A dynamic database connection pool adjustment method and system

Publications (1)

Publication Number Publication Date
CN119474046A true CN119474046A (en) 2025-02-18

Family

ID=94576327

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410536392.7A Pending CN119474046A (en) 2024-04-30 2024-04-30 A dynamic database connection pool adjustment method and system

Country Status (1)

Country Link
CN (1) CN119474046A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119961013A (en) * 2025-04-10 2025-05-09 南通云途星企智能科技有限公司 An intelligent recognition system for information technology consultation

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119961013A (en) * 2025-04-10 2025-05-09 南通云途星企智能科技有限公司 An intelligent recognition system for information technology consultation
CN119961013B (en) * 2025-04-10 2025-07-18 南通云途星企智能科技有限公司 Intelligent recognition system for information technology consultation

Similar Documents

Publication Publication Date Title
JP4912401B2 (en) System and method for adaptively collecting performance and event information
US7620635B2 (en) Data mining agents for efficient hardware utilization
US20200012602A1 (en) Cache allocation method, and apparatus
CN113971066A (en) A Kubernetes cluster resource dynamic adjustment method and electronic device
US20200351207A1 (en) Method and system of limiting traffic
CN113010260A (en) Elastic expansion method and system for container quantity
CN111782692B (en) Frequency control method and device
JP7192645B2 (en) Information processing device, distributed processing system and distributed processing program
CN119474046A (en) A dynamic database connection pool adjustment method and system
JP5329756B2 (en) Tracking space usage in the database
WO2024119793A1 (en) Scheduling method, system and device based on cache affinity, and medium
CN116578408A (en) An operation resource scheduling method supporting intelligent manufacturing software
CN119201399B (en) Task data configuration method and device, electronic equipment and storage medium
CN117729204B (en) A K8S container scheduling method and system based on monitoring perception
CN120086003A (en) Method and device for supporting elastic scalability of computing resources in intelligent computing center
CN118796348A (en) Business request processing method, device, equipment, storage medium and program product
CN115442307A (en) Distributed key-based current limiting method, system and computer-readable storage medium
CN111563069A (en) Probe configuration method and system of industrial control equipment
CN120104069B (en) Data synchronization method and device, storage medium and electronic device
CN114647632B (en) Method, system and storage medium for database load control
CN120336007B (en) Distributed cache optimization method, device, electronic device and storage medium
US20210248116A1 (en) Scalable querying for distributed systems
CN117827874A (en) Data query method and electronic device
JPH0698361A (en) Call processing data area management system
CN120075143A (en) Service adjustment method, network device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination