CN112732441B - Connection method, device and system of multi-element dynamic connection pool - Google Patents

Connection method, device and system of multi-element dynamic connection pool Download PDF

Info

Publication number
CN112732441B
CN112732441B CN202110018352.XA CN202110018352A CN112732441B CN 112732441 B CN112732441 B CN 112732441B CN 202110018352 A CN202110018352 A CN 202110018352A CN 112732441 B CN112732441 B CN 112732441B
Authority
CN
China
Prior art keywords
connection
pool
idle
resources
connection pool
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.)
Active
Application number
CN202110018352.XA
Other languages
Chinese (zh)
Other versions
CN112732441A (en
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.)
Zhongyang Health Technology Group Co ltd
Original Assignee
Zhongyang Health Technology Group 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 Zhongyang Health Technology Group Co ltd filed Critical Zhongyang Health Technology Group Co ltd
Priority to CN202110018352.XA priority Critical patent/CN112732441B/en
Publication of CN112732441A publication Critical patent/CN112732441A/en
Application granted granted Critical
Publication of CN112732441B publication Critical patent/CN112732441B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5011Pool

Landscapes

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

Abstract

The invention discloses a method, a device and a system for connecting a multi-element dynamic connection pool, wherein the method comprises the following steps: searching a connection pool corresponding to the target service database in the connection pool group according to the target service database in the connection resource access request; judging the idle connection resources of the connection pool and the total connection number of the connection pool group; if the connection pool has idle connection resources, the idle connection resources are sent to a target service database; if the idle connection resources do not exist and the total number of the connections of the connection pool group exceeds the minimum connection threshold, the idle connection resources exceeding the minimum connection threshold are closed, or the idle connection pool is removed when the connection maximum threshold is exceeded, new connection resources are created, and the new connection resources are sent to the target service database. The connection group uniformly manages each connection pool and connection resources of the connection pools; the maximum connection threshold and the minimum connection threshold avoid the problem that the connection resources of the database are in shortage when the connection resources are created because the number of connections in each connection pool is fixed.

Description

Connection method, device and system of multi-element dynamic connection pool
Technical Field
The invention relates to the technical field of data source connection pools, in particular to a method, a device and a system for connecting a multivariate dynamic connection pool.
Background
The statements in this section merely provide background information related to the present disclosure and may not necessarily constitute prior art.
With the wide application of the data source connection pool, excellent results are obtained from the aspect of improving the data interaction of the application and the database, the core idea of the connection pool technology is connection multiplexing, and the connection in the connection pool can be efficiently and safely multiplexed by establishing a database connection pool and a set of connection using, distributing and managing strategies, so that the expenses of frequently establishing and closing the database connection are avoided. In addition, because the original connection in the JDBC is encapsulated, the use of the connection by the database application is facilitated, the development efficiency is improved, and because of the existence of the encapsulation layer, the processing logic and the specific database access logic of the application are isolated, so that the multiplexing of the application is possible. The connecting pool mainly comprises three parts: establishing a connection pool, using and managing the connection in the connection pool, and closing the connection pool.
Due to the increase of data application scenes, a plurality of service data are stored in not only a single database, but also a plurality of types of database products, a single data source connection pool has a plurality of defects, and only a plurality of data source connection pools can be created for connecting a plurality of types of databases, so that the management is inconvenient, and therefore, one data source connection pool cannot be connected with the plurality of types of databases at the same time; the number of connections in the pool is fixed and not dynamically changed, which is generally larger than the number of connection access requirements of real system application to the database, so that a part of the connection number is not used, the connection resources of the database are always occupied and cannot be released; with the increase of databases, the number of single data source connection pools is increased, and the CPU and memory resources consumed by the whole service system increase by multiple, so that excessive computer resources are consumed, and the switching efficiency of the data source pools is low.
Disclosure of Invention
In order to solve the problems, the invention provides a method, a device and a system for connecting a plurality of dynamic connection pools, wherein a connection group comprises the connection pools of all service databases, the connection pools and the connection resources of the connection pools are uniformly managed, and different service databases can be connected only by sending connection resource access requests to the connection pool group; meanwhile, the maximum connection threshold and the minimum connection threshold are set, so that the problem that the connection resources of the database are tense when redundant connection resources are created due to the fixed number of connections in each connection pool and the problem that other system applications cannot access the connection pools are avoided.
In order to achieve the purpose, the invention adopts the following technical scheme:
in a first aspect, the present invention provides a method for connecting multiple dynamic connection pools, including:
searching a connection pool corresponding to the target service database in the connection pool group according to the target service database in the connection resource access request;
judging the idle connection resources of the connection pool and the total connection number of the connection pool group;
if the connection pool has idle connection resources, the idle connection resources are sent to a target service database;
if the connection pool has no idle connection resources and the total number of connections of the connection pool group exceeds the minimum connection threshold, the idle connection resources exceeding the minimum connection threshold are closed, or the idle connection pool is removed when the connection pool exceeds the maximum connection threshold, so that new connection resources are created and sent to the target service database.
In a second aspect, the present invention provides a connection device for multiple dynamic connection pools, comprising:
the connection pool matching module is configured to search a connection pool corresponding to the target service database in the connection pool group according to the target service database in the connection resource access request;
the judging module is configured to judge the idle connection resources of the connection pool and the total number of connections of the connection pool group;
the first processing module is configured to send the idle connection resource to the target service database if the idle connection resource exists in the connection pool;
and the second processing module is configured to close the idle connection resources exceeding the minimum connection threshold value or remove the idle connection pool when the connection pool does not have the idle connection resources and the total number of the connections of the connection pool group exceeds the minimum connection threshold value, so as to create new connection resources and send the new connection resources to the target service database.
In a third aspect, the present invention provides an electronic device comprising a memory and a processor, and computer instructions stored on the memory and executed on the processor, wherein when the computer instructions are executed by the processor, the method of the first aspect is performed.
In a fourth aspect, the present invention provides a computer readable storage medium for storing computer instructions which, when executed by a processor, perform the method of the first aspect.
In a fifth aspect, the present invention provides a connection system for multiple dynamic connection pools, comprising: connecting a pool group, a connecting device and a service database;
the connection pool group stores at least one connection pool, and at least one connection resource is stored in the connection pool;
after the connection device executes the connection method in the first aspect, the connection device sends the obtained connection resources to a corresponding service database;
the service database receives connection resources.
Compared with the prior art, the invention has the following beneficial effects:
the multi-element dynamic connection pool can uniformly manage a plurality of connection pools, reduces system application operation, and the connection pool group only needs to analyze database related information corresponding to connection resources according to a connection resource access request sent by system application and automatically searches available connection resources.
In the creation process of the multivariate dynamic connection pool group, the reasonable maximum connection threshold value and the reasonable minimum connection threshold value are automatically set according to computer resources, the use of a CPU (central processing unit) and a memory of the computer resources is reduced, the problems that the database resources are in shortage and other system applications cannot access due to the fact that redundant connection resources are created in each connection pool are avoided, and meanwhile the condition that a server where a service database is located is down is avoided.
In the dynamic management method of the data source of the multi-element dynamic connection pool, the connection resource is searched according to the service database information in the connection resource access request, if the connection resource is idle, the connection resource is directly returned, and if the connection resource is not idle, the connection resource is newly created; under the default condition, the data source empties the idle connection resources which are larger than the connection minimum threshold, and closes and removes the idle connection pool when the connection maximum threshold is exceeded, thereby improving the efficiency of the dynamic switching of the internal connection pool of the data source and shortening the response time of the system application for sending the database connection request to the return of the requested connection resources.
Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, are included to provide a further understanding of the invention, and are incorporated in and constitute a part of this specification, illustrate exemplary embodiments of the invention and together with the description serve to explain the invention and not to limit the invention.
Fig. 1 is a flowchart of a connection method of a multi-element dynamic connection pool provided in embodiment 1 of the present invention;
fig. 2 is a connection architecture topology diagram of a multi-element dynamic connection pool provided in embodiment 1 of the present invention.
The specific implementation mode is as follows:
the invention is further explained by the following embodiments in conjunction with the drawings.
It is to be understood that the following detailed description is exemplary and is intended to provide further explanation of the invention as claimed. Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
It is noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of exemplary embodiments according to the invention. As used herein, the singular is intended to include the plural unless the context clearly dictates otherwise, and furthermore, it should be understood that the terms "comprises" and "comprising," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The embodiments and features of the embodiments of the present invention may be combined with each other without conflict.
Example 1
As shown in fig. 1-2, this embodiment provides a method for connecting multiple dynamic connection pools, including:
s1: searching a connection pool corresponding to the target service database in the connection pool group according to the target service database in the connection resource access request;
s2: judging the idle connection resources of the connection pool and the total connection number of the connection pool group;
s3: if the connection pool has idle connection resources, the idle connection resources are sent to a target service database;
s4: if the connection pool has no idle connection resources and the total number of connections of the connection pool group exceeds the minimum connection threshold, the idle connection resources exceeding the minimum connection threshold are closed, or the idle connection pool is removed when the connection pool exceeds the maximum connection threshold, so that new connection resources are created and sent to the target service database.
In this embodiment, the multivariate dynamization of connection pools means that, in the implementation of a data source, one connection pool in the traditional sense can only access one database in a connection manner, but one connection pool group includes a plurality of small connection resource pools, and the connection pool group is responsible for managing each connection pool and connection resources in the connection pool. For system application, one connection group comprises connection pools of all databases, so that different service databases can be connected for data interaction only by sending a connection resource access request to a connection pool group without paying attention to how the inside of the connection pool group is specifically managed.
All connection resources in the connection pool group are in one-to-one correspondence with connection processes in the external service database, so the embodiment sets a connection maximum threshold and a connection minimum threshold, that is, the total number of connections of all connection pools contained in the connection pool group does not exceed the connection maximum threshold, and simultaneously cannot be less than the connection minimum threshold, thereby avoiding the problems that the connection resources of the database are easy to be tense and other system applications cannot access when redundant connection resources are created because the number of connections in each connection pool is fixed, and the embodiment inherits the principle of how many creation resources are used.
In step S1, the creating process of the connected pool group in this embodiment includes:
s10: creating a connection pool group;
setting a connection maximum threshold, a connection minimum threshold, connection timeout time and idle connection timeout time, and initializing the total number of connection pools and the total number of connections of a connection pool group; specifically, the method comprises the following steps:
s101: in order to facilitate management and monitoring of a plurality of connection pools by a connection pool group, when the connection pool group is established, computer resource information such as CPU physical core number is obtained, and a connection maximum threshold value and a connection minimum threshold value in the connection pool group are set according to the CPU physical core number; the setting of the maximum connection threshold and the minimum connection threshold can ensure that the connection pool group can fully utilize computer resources, provide better concurrency performance, and set thresholds for the connection resources of a plurality of connection pools in the connection pool group so as to reduce the consumption of the connection resources of the database.
S102: the connection timeout time is used for preventing the normal operation of the connection pool group from being blocked when the system resources do not successfully acquire the connection resources.
S103: and the idle connection overtime time is used for ensuring that the connection pool group can timely release redundant idle connection resources and freeing a position to create connection resources for other connection pools.
S104: since the connected pool group has not been created, the total number of connected pools and the total number of connections of the initialized connected pool group are 0.
S11: creating a connection pool within the connection pool group;
when the connection pool group receives a connection resource access request for the first time, searching whether a connection pool corresponding to a target service database exists in the current connection pool group or not by taking a user name, a password, an IP address and the like as search conditions according to target service database information in the connection resource access request;
if not, the connection pool group sends a connection establishing request to a server where the target service database is located, the service database responds to the connection pool group after passing verification, the connection pool group establishes a connection pool of the service database, and a connection resource is established;
at this time, in the data source configuration information of the connected pool group, the total number of the connected pools and the total number of the connections are respectively 1, which represents that the connected pool of one database already exists in the current connected pool group, and the total number of the connection resources in the connected pool is 1.
S12: setting the number of connection pools and the number of connection resources in a connection pool group;
controlling the quantity of connection resources in the connection pool and the quantity of the connection pool according to the connection maximum threshold and the connection minimum threshold; according to the limitation condition of the maximum connection threshold, if the number of connections in each connection pool is 1, the maximum value of the total number of the connection pools in the connection pool group is equal to the maximum connection threshold, and the minimum number of the connection pools is 1;
in this embodiment, the number of connection pools is dynamically changed, and similarly, the number of connections in each connection pool is also dynamically changed, but the total number of connection resources does not exceed the connection maximum threshold, and the maximum number of connection pools does not exceed the maximum threshold.
S13: since the connection pool itself is intended to repeatedly utilize the connection resources that have already been created, in this embodiment, the received connection resources and connection pool are stored in the current thread, so that they can be directly taken out from the buffer during the next access, and the idle connection resources can be quickly searched in many connection pools, thereby ensuring the quick reuse of connection resources in the connection pool group.
To this end, the present embodiment completes creation of a connection pool group, a connection pool, and connection resources, where the connection pool group uniformly performs dynamic management on a plurality of internal connection pools, including creation, switching, closing, removal, and the like; specifically;
the dynamic establishment comprises dynamic establishment of a connection pool and dynamic establishment of connection resources, and is dynamically established according to the access requirement of system application on a service database, so that the problem of excessive consumption of computer CPU resources and memory resources caused by the establishment of all data source connection pools when the system application is initialized is avoided;
dynamically creating a connection pool; the system application sends a connection resource access request of the database to the connection pool group, and then the connection pool is established, and if the request is not sent, the connection pool is not automatically established.
Dynamically creating a connection; after the connection pool group searches the connection pool corresponding to the service database information, firstly, whether idle connection resources exist in the current connection pool is searched, if so, the connection resources are returned, and if not, the connection resources of the service database need to be selected and established;
when creating connection resources, the comparison relationship between the total number of connections of the current connection pool group and the maximum connection threshold and the minimum connection threshold needs to be judged, and according to the comparison result, the idle connection resources of the connection pool group are dynamically closed or the idle connection pool is removed, so that the position is vacated for the newly created connection resources, and the number of connections in the connection pool is dynamically changed.
Dynamically closing and removing connection resources or the whole connection pool; when a system application new service database access request is received, if the total number of connections in the current connection pool group exceeds the maximum connection threshold, automatically retrieving idle connection resources in the connection pool group, if the idle time of the idle connection resources is greater than the idle connection timeout time, releasing the idle connection resources, if only 1 idle connection resource exists in the connection pool at the moment, closing the connection pool, removing the connection pool from the connection pool group, and updating the total number of connection pools and the total number of connections in the connection pool group;
if the total number of connections in the current connection pool exceeds the minimum connection threshold, the idle connection resources in the connection pool are automatically retrieved, and if the idle time of the idle connection resources is greater than the idle connection timeout time, the idle connection resources greater than the minimum connection threshold are closed.
Dynamically switching the connection pool; the data source dynamically searches and switches the connection pool according to the database information carried in the system application request, and returns the connection resources in the corresponding pool to the system application; meanwhile, the connection pool is put into the current thread for storage, and after storage, the next access can default to directly retrieve the idle resources from the connection pool, so that the performance of the connection pool group is improved;
the connection resource can be stored in the current thread, if the connection resource information requested next time is consistent with the information stored in the current thread, the connection resource is preferentially acquired from the current thread, and the response time of retrieving the connection pool from the connection pool group is reduced;
if the database information is inconsistent with the current thread cache, the connection pool group searches the connection pool, finds an idle connection and returns.
In this embodiment, before receiving the connection resource access request, the service database establishes a communication connection with the connection pool; specifically, the method comprises the following steps: the system application sends a connection resource access request to the connection pool group; after receiving the request, the connection pool group processes the request information and sends a communication request to the service database; and the service database verifies the communication request information and establishes communication after the verification is passed.
After communication is established, firstly judging whether a connection pool group exists or not, and if the connection pool group does not exist, establishing the connection pool group; if the connection pool group exists, searching the corresponding connection pool according to the database information in the request parameter, judging whether the connection pool exists, and if not, creating the connection pool group to create the corresponding connection pool according to the database information in the request parameter;
if the connection pool exists or the connection pool is newly created, judging whether idle connection resources exist in the current connection pool or not, if the idle connection resources exist in the connection pool, returning the idle connection resources, and ending the response returned by the multivariate dynamic data source;
if no idle connection resources exist in the connection pool, judging whether the total connection number of the connection pool exceeds a connection minimum threshold or a connection maximum threshold; if the total number of connections exceeds the minimum connection threshold or the maximum connection threshold, closing and removing the idle connection resources or the connection pool, and then creating new connection resources;
if not, directly creating new connection resources, and returning the response by the multi-element dynamic data source to finish.
Example 2
This embodiment provides a connecting device of many first dynamic link ponds, includes:
the connection pool matching module is configured to search a connection pool corresponding to the target service database in the connection pool group according to the target service database in the connection resource access request;
the judging module is configured to judge the idle connection resources of the connection pool and the total number of connections of the connection pool group;
the first processing module is configured to send idle connection resources to the target service database if the idle connection resources exist in the connection pool;
and the second processing module is configured to close the idle connection resources exceeding the minimum connection threshold value or remove the idle connection pool when the connection pool does not have the idle connection resources and the total number of the connections of the connection pool group exceeds the minimum connection threshold value, so as to create new connection resources and send the new connection resources to the target service database.
It should be noted that the above modules correspond to steps S1 to S4 in embodiment 1, and the above modules are the same as the examples and application scenarios realized by the corresponding steps, but are not limited to the disclosure of embodiment 1. It should be noted that the modules described above as part of a system may be implemented in a computer system such as a set of computer-executable instructions.
In further embodiments, there is also provided:
a connection system for a plurality of dynamic connection cells, comprising: connecting a pool group, the connecting device and the service database in the embodiment 2;
the connection pool group stores at least one connection pool, and at least one connection resource is stored in the connection pool;
after the connection device executes the connection method described in embodiment 1, sending the obtained connection resources to a corresponding service database;
the service database receives connection resources.
An electronic device comprising a memory and a processor and computer instructions stored on the memory and executed on the processor, the computer instructions when executed by the processor performing the method of embodiment 1. For brevity, further description is omitted herein.
It should be understood that in this embodiment, the processor may be a central processing unit CPU, and the processor may also be other general purpose processors, digital signal processors DSP, application specific integrated circuits ASIC, off-the-shelf programmable gate arrays FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and so on. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory may include both read-only memory and random access memory, and may provide instructions and data to the processor, and a portion of the memory may also include non-volatile random access memory. For example, the memory may also store device type information.
A computer readable storage medium storing computer instructions which, when executed by a processor, perform the method of embodiment 1.
The method in embodiment 1 may be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor. The software modules may be located in ram, flash, rom, prom, or eprom, registers, among other storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor. To avoid repetition, it is not described in detail here.
Those of ordinary skill in the art will appreciate that the various illustrative elements, i.e., algorithm steps, described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The present invention has been described in terms of the preferred embodiment, and it is not intended to be limited to the embodiment. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Although the embodiments of the present invention have been described with reference to the accompanying drawings, it is not intended to limit the scope of the present invention, and it should be understood by those skilled in the art that various modifications and variations can be made without inventive efforts by those skilled in the art based on the technical solution of the present invention.

Claims (7)

1. A connection method of a multi-element dynamic connection pool is characterized by comprising the following steps:
searching a connection pool corresponding to the target service database in the connection pool group according to the target service database in the connection resource access request;
judging the idle connection resources of the connection pool and the total connection number of the connection pool group;
if the connection pool has idle connection resources, the idle connection resources are sent to a target service database; if the connection pool has no idle connection resources and the total number of connections of the connection pool group exceeds the minimum connection threshold, closing the idle connection resources exceeding the minimum connection threshold, or removing the idle connection pool when the connection pool exceeds the maximum connection threshold, thereby creating new connection resources and sending the new connection resources to the target service database;
setting a connection maximum threshold value, a connection minimum threshold value, connection overtime time and idle connection overtime time in the connection pool group, and initializing the total number of connection pools and the total number of connections of the connection pool group;
when no idle connection resource exists in the connection pool, if the total number of connections of the connection pool group exceeds the maximum connection threshold, retrieving the idle connection resource in the connection pool group, when the idle time of the idle connection resource is greater than the idle connection overtime, releasing the idle connection resource, when only 1 space connection resource exists in the connection pool, closing the idle connection resource, simultaneously removing the connection pool in the connection pool group, and updating the total number of the connection pool and the total number of the connections in the connection pool group;
and when the idle connection resources do not exist in the connection pool, if the total number of the connections in the connection pool exceeds the connection minimum threshold, retrieving the idle connection resources in the connection pool, and closing the idle connection resources which are greater than the connection minimum threshold when the idle time of the idle connection resources is greater than the idle connection timeout time.
2. The method as claimed in claim 1, wherein the connection resource and the connection pool are stored in the current thread after the connection resource is returned to the service database, and an idle connection resource is preferentially retrieved from the connection pool of the current thread when a next connection resource access request is made.
3. The method according to claim 1, wherein if no connection pool corresponding to the target service database is retrieved from the connection pool group, a new connection pool is created; and if the connection resource access request is not received, the connection pool cannot be automatically created.
4. A connecting device for a multi-element dynamic connection pool is characterized by comprising:
the connection pool matching module is configured to search a connection pool corresponding to the target service database in the connection pool group according to the target service database in the connection resource access request;
the judging module is configured to judge the idle connection resources of the connection pool and the total number of connections of the connection pool group;
the first processing module is configured to send the idle connection resource to the target service database if the idle connection resource exists in the connection pool;
the second processing module is configured to close the idle connection resources exceeding the minimum connection threshold value or remove the idle connection pool when the connection pool does not have the idle connection resources and the total number of the connections of the connection pool group exceeds the minimum connection threshold value, so as to create new connection resources and send the new connection resources to the target service database;
setting a connection maximum threshold value, a connection minimum threshold value, connection overtime time and idle connection overtime time in the connection pool group, and initializing the total number of connection pools and the total number of connections of the connection pool group;
when no idle connection resource exists in the connection pool, if the total number of connections of the connection pool group exceeds a maximum connection threshold value, retrieving the idle connection resource in the connection pool group, when the idle time of the idle connection resource is longer than the idle connection timeout time, releasing the idle connection resource, when only 1 space connection resource exists in the connection pool, closing the idle connection resource, simultaneously removing the connection pool from the connection pool group, and updating the total number of the connection pool and the total number of the connections in the connection pool group;
and when the idle connection resources do not exist in the connection pool, if the total number of the connections in the connection pool exceeds the connection minimum threshold, retrieving the idle connection resources in the connection pool, and closing the idle connection resources which are greater than the connection minimum threshold when the idle time of the idle connection resources is greater than the idle connection timeout time.
5. An electronic device comprising a memory and a processor and computer instructions stored on the memory and executed on the processor, the computer instructions when executed by the processor performing the method of any of claims 1-3.
6. A computer-readable storage medium storing computer instructions which, when executed by a processor, perform the method of any one of claims 1 to 3.
7. A connection system for a plurality of dynamic connection cells, comprising: connecting a pool, the connection device of claim 4 and a traffic database;
the connection pool group stores at least one connection pool, and at least one connection resource is stored in the connection pool; after the connection device executes the connection method of any one of claims 1 to 3, sending the obtained connection resource to a corresponding service database;
the service database receives connection resources.
CN202110018352.XA 2021-01-07 2021-01-07 Connection method, device and system of multi-element dynamic connection pool Active CN112732441B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110018352.XA CN112732441B (en) 2021-01-07 2021-01-07 Connection method, device and system of multi-element dynamic connection pool

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110018352.XA CN112732441B (en) 2021-01-07 2021-01-07 Connection method, device and system of multi-element dynamic connection pool

Publications (2)

Publication Number Publication Date
CN112732441A CN112732441A (en) 2021-04-30
CN112732441B true CN112732441B (en) 2022-12-06

Family

ID=75591028

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110018352.XA Active CN112732441B (en) 2021-01-07 2021-01-07 Connection method, device and system of multi-element dynamic connection pool

Country Status (1)

Country Link
CN (1) CN112732441B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11176155B2 (en) * 2019-12-13 2021-11-16 Paypal, Inc Self-adjusting connection pool in a distributed system
CN115132189A (en) * 2022-06-10 2022-09-30 中国第一汽车股份有限公司 Long connection communication connection pool management method based on self-adaptive control strategy
CN115328978B (en) * 2022-06-27 2023-11-17 光大环境科技(中国)有限公司 Connection method of connection pool and server

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2608032A1 (en) * 2011-12-22 2013-06-26 Software AG Resource adapter for establishing a connection between an executive information system (EIS) and at least one client
CN103365929B (en) * 2012-04-10 2016-09-28 阿里巴巴集团控股有限公司 The management method of a kind of data base connection and system
CN103729373B (en) * 2012-10-15 2017-08-04 北京新媒传信科技有限公司 A kind of database broker method and apparatus
CN104281587B (en) * 2013-07-03 2018-05-11 阿里巴巴集团控股有限公司 A kind of method and device for establishing connection
CN103605727B (en) * 2013-11-19 2017-07-28 浪潮电子信息产业股份有限公司 Multiuser database based on connection pool accesses high efficiency optimization method and system
CN104750546B (en) * 2013-12-30 2018-01-30 中国移动通信集团公司 A kind of method and system for adjusting connection pool
CN105512127A (en) * 2014-09-24 2016-04-20 阿里巴巴集团控股有限公司 Method and device for distributing database connection
CN104572974B (en) * 2014-12-31 2018-10-12 北京奇虎科技有限公司 service request processing method and device
CN105956138B (en) * 2016-05-11 2019-07-12 北京百度网讯科技有限公司 The control method and device of database connection
CN106250500A (en) * 2016-07-29 2016-12-21 广州唯品会信息科技有限公司 The dynamic management approach of database connection pool and system
CN106484882A (en) * 2016-10-14 2017-03-08 腾讯科技(深圳)有限公司 A kind of management method of database connection pool and device
CN110297862B (en) * 2019-07-04 2022-10-14 中国联合网络通信集团有限公司 Database access method and database access middleware
CN110471773A (en) * 2019-08-21 2019-11-19 广州趣丸网络科技有限公司 A kind of connection pool dispatching method and device

Also Published As

Publication number Publication date
CN112732441A (en) 2021-04-30

Similar Documents

Publication Publication Date Title
CN112732441B (en) Connection method, device and system of multi-element dynamic connection pool
US20110218981A1 (en) Connection handler and method for providing applications with heterogeneous connection objects
CN110896404B (en) Data processing method and device and computing node
JP2016502370A (en) Method and apparatus for matching flow tables and switch
CN108900626B (en) Data storage method, device and system in cloud environment
CN110677305A (en) Automatic scaling method and system in cloud computing environment
CN103995787A (en) Regulation and control method and device for camera applications
US20240012813A1 (en) Dynamic prefetching for database queries
CN101938516B (en) User-oriented dynamic storage resource distribution method
CN114461668A (en) MYSQL database query method and device based on thread pool
CN114168262A (en) Cloud platform mirror image cache management method based on LRU replacement algorithm
US9558035B2 (en) System and method for supporting adaptive busy wait in a computing environment
CN114691547B (en) Method for deploying instance, instance management node, computing node and computing device
CN113037851A (en) Method for achieving cloud mobile phone system overdivision based on storage
CN107526690B (en) Method and device for clearing cache
US11431795B2 (en) Method, apparatus and storage medium for resource configuration
JPH11120014A (en) Multiprocessor device
CN112346848A (en) Method, device and terminal for managing memory pool
CN113127179A (en) Resource scheduling method and device, electronic equipment and computer readable medium
CN112612834B (en) Database middleware and method for connecting client and server
CN115981670A (en) Container cluster service deployment method, device, server and storage medium
CN111221642A (en) Data processing method and device, storage medium and terminal
CN107168793A (en) A kind of dynamic current method of virtual memory space
CN113258679A (en) Power grid monitoring system channel distribution method based on server instance capacity reduction
CN112579006A (en) Data storage life cycle management method and system

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 12 / F, building 1, Aosheng building, 1166 Xinluo street, hi tech Zone, Jinan City, Shandong Province

Applicant after: Zhongyang Health Technology Group Co.,Ltd.

Address before: 12 / F, building 1, Aosheng building, 1166 Xinluo street, hi tech Zone, Jinan City, Shandong Province

Applicant before: SHANDONG MSUNHEALTH TECHNOLOGY GROUP Co.,Ltd.

GR01 Patent grant
GR01 Patent grant