Distributed data node access method, device, equipment, system and medium

By using connection pools to manage idle backend connections in a distributed database architecture, the problem of network resource waste caused by the binding of the proxy layer to the client and data node connection is solved, and more efficient network resource utilization and distributed data nodes are achieved. Access performance improvements.

CN119203217AActive Publication Date: 2024-12-27CHINA UNIONPAY

Patent Information

Application Number
CN202411238259.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-04
Publication Date
2024-12-27
Estimated Expiration
2044-09-04

AI Technical Summary

Technical Problem

In a distributed database architecture, the front-end and back-end connections between the proxy layer and the client and the data node are always bound, resulting in waste of network resources, especially when the connection is idle, it cannot be unbined, thus Limits the number of backend connections and improves access efficiency.

Method used

By setting up a connection pool, manage free backend connections, and when receiving the database operation statement, get the free connection from the connection pool for use. When the database operation statement is not turned on or the transaction has been closed, the connection is put back In the pool, make it reusable and unbind the front-end connection and the back-end connection.

Benefits of technology

Through the multiplexing mechanism of the connection pool, network resource waste is reduced, network resource utilization efficiency is improved, front-end connection number is restricted, and maximum performance and access efficiency of distributed data node clusters are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119203217A_ABST
    Figure CN119203217A_ABST
Patent Text Reader

Abstract

The invention discloses a distributed data node access method, device, equipment, system and medium, and belongs to the field of data processing. The method comprises the following steps: determining a target data node accessed by a database operation statement according to the database operation statement transmitted by a client through established front-end connection; an idle back-end connection is obtained from a preset connection pool as a target connection, the connection pool comprises the idle back-end connection, and the target connection is subjected to checking synchronization processing so that the target connection can be normally used; sending a database operation statement to the target data node by using the target connection; and under the condition that the database operation statement does not open the database transaction or closes the database transaction, putting the target connection into the connection pool as an idle back-end connection. According to the embodiment of the invention, waste of network resources can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a method, device, equipment, system and medium for accessing distributed data nodes. Background Art

[0002] The distributed database architecture includes a proxy layer and data nodes. The proxy layer can establish a front-end connection with the client, receive database operation statements from the front-end connection, establish a back-end connection with the data node, route the database operation statements to the corresponding data node, receive the response from the data node, and process the response and feed it back to the client. The front-end connection between the proxy layer and the client and the back-end connection between the proxy layer and the data node are bound, that is, for a front-end connection, the proxy layer will establish one or more back-end connections to remain bound to the front-end connection until the front-end connection is disconnected.

[0003] However, since the front-end connection and the back-end connection always remain bound during the entire life cycle of the front-end connection between the proxy layer and the client, the binding state will not be released even if the front-end connection and the back-end connection are in idle state. Therefore, a large number of back-end connections need to be established, resulting in a waste of network resources. Summary of the invention

[0004] The embodiments of the present application provide a method, device, equipment, system and medium for accessing a distributed data node, which can reduce the waste of network resources.

[0005] In a first aspect, an embodiment of the present application provides a method for accessing a distributed data node, including: determining a target data node accessed by a database operation statement based on a database operation statement transmitted by a client through an established front-end connection; obtaining an idle back-end connection from a preset connection pool as a target connection, the connection pool including idle back-end connections, and the target connection is checked and synchronized so that the target connection can be used normally; using the target connection to send a database operation statement to a target data node; and when the database operation statement does not open a database transaction or has closed the database transaction, placing the target connection as an idle back-end connection into the connection pool.

[0006] In the second aspect, an embodiment of the present application provides an access device for a distributed data node, including: a receiving module, used to determine the target data node accessed by a database operation statement based on the database operation statement transmitted by the client through an established front-end connection; a connection processing module, used to obtain an idle back-end connection as a target connection from a preset connection pool, the connection pool includes idle back-end connections, and the target connection is checked and synchronized so that the target connection can be used normally; a sending module, used to use the target connection to send a database operation statement to the target data node; the connection processing module is also used to put the target connection into the connection pool as an idle back-end connection when the database operation statement does not open a database transaction or has closed the database transaction.

[0007] In a third aspect, an embodiment of the present application provides a proxy device, comprising: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the distributed data node access method of the first aspect is implemented.

[0008] In a fourth aspect, an embodiment of the present application provides a distributed data node access system, including: a client; a proxy device of the third aspect, the proxy device being communicatively connected to the client; and a data node being communicatively connected to the proxy device.

[0009] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium having computer program instructions stored thereon, and when the computer program instructions are executed by a processor, the distributed data node access method of the first aspect is implemented.

[0010] In a sixth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the distributed data node access method of the first aspect.

[0011] The embodiment of the present application provides a method, device, equipment, system and medium for accessing a distributed data node. When receiving a database operation statement transmitted by a user through a front-end connection, the target data node accessed by the database operation can be parsed, and an idle back-end connection is obtained from a preset connection pool including idle back-end connections as the target connection used to send the database operation statement to the target data node, and the database operation statement is sent through the target connection. In the case where the database operation statement does not open a database transaction or has closed the database transaction, the target connection is restored to an idle state and is placed in a connection pool as an idle back-end connection, so that the idle back-end connections in the connection pool can be reused by different clients and different front-end connections. Through the reuse of idle back-end connections in the connection pool, the binding of the front-end connection and the back-end connection can be released, the coupling of the front-end connection and the back-end connection can be reduced, the idle back-end connection can be fully utilized, the waste of network resources can be reduced, and the utilization efficiency of network resources can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0013] Figure 1 A schematic diagram of an example of an application architecture for accessing distributed data nodes provided in an embodiment of the present application;

[0014] Figure 2 A flowchart of a method for accessing a distributed data node provided in an embodiment of the present application;

[0015] Figure 3 A flowchart of a method for accessing a distributed data node provided by another embodiment of the present application;

[0016] Figure 4 A schematic diagram of an example architecture of a two-level connection pool provided in an embodiment of the present application;

[0017] Figure 5 A schematic diagram of an example of a first linked list provided in an embodiment of the present application;

[0018] Figure 6 A schematic diagram of an example of a second linked list provided in an embodiment of the present application;

[0019] Figure 7 A flowchart of an example of a client accessing a data node through a proxy layer provided in an embodiment of the present application;

[0020] Figure 8 A schematic diagram of the structure of a distributed data node access device provided in one embodiment of the present application;

[0021] Fig. 9 A schematic diagram of the structure of a proxy device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0022] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are intended only to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by showing examples of the present application. It should be noted that the acquisition, storage, use, and processing of information and data in the embodiments of the present application are authorized by users or relevant agencies, in compliance with the relevant provisions of national laws and regulations.

[0023] The distributed database architecture includes a proxy layer and a data node. The proxy layer can establish a front-end connection with the client, receive database operation statements from the front-end connection, establish a back-end connection with the data node, route the database operation statements to the corresponding data node, receive the response from the data node, and process the response and feed it back to the client. The front-end connection between the proxy layer and the client and the back-end connection between the proxy layer and the data node are bound, that is, for a front-end connection, the proxy layer will establish one or more back-end connections to remain bound to the front-end connection until the front-end connection is disconnected. However, since the front-end connection and the back-end connection always remain bound during the entire life cycle of the front-end connection between the proxy layer and the client, the binding state will not be released even if the front-end connection and the back-end connection are in an idle state, so a large number of back-end connections need to be established, resulting in a waste of network resources. In some scenarios where there are requirements for the operating performance of distributed data nodes and restrictions on the number of back-end connections, the number of front-end connections will also be limited, making the access efficiency to distributed data nodes low.

[0024] The present application provides a method, device, equipment, system, medium and program product for accessing a distributed data node, and a connection pool including an idle backend connection is set, and the idle backend connection is in a holding state in the connection pool, but not in a binding state. When a database operation statement transmitted by a client through a front-end connection is received, an idle backend connection can be obtained from the connection pool, and the idle backend connection in the connection pool is used to send the database operation statement to the data node to perform the database operation. In the case where the database operation statement does not open a database transaction or has closed a database transaction, the backend connection that sends the database operation statement can be put into the connection pool again for subsequent transmission of the database operation statement, so as to realize the reuse of the idle backend connection in the connection pool. Through the reuse of the idle backend connection in the connection pool, the binding of the front-end connection and the backend connection can be released, the coupling of the front-end connection and the back-end connection can be reduced, the idle backend connection can be fully utilized, the waste of network resources can be reduced, and the utilization efficiency of network resources can be improved. In addition, since the idle backend connection is fully utilized, the limited backend connection can support more front-end connections, thereby reducing the limit on the number of front-end connections, improving the maximum performance of the distributed data node cluster, and improving the access efficiency to the distributed data nodes.

[0025] To facilitate understanding, here we first briefly introduce the application architecture of the distributed data node access method, device, equipment, system, medium and program product provided by the present application. Figure 1 A schematic diagram of an example of an application architecture for accessing distributed data nodes provided in an embodiment of the present application, such as Figure 1 As shown, the client 11 can establish a front-end connection with the proxy layer 12. The client 11 can establish a front-end connection with the proxy layer through, but not limited to, JAVA database connection (Java DataBase Connectivity, JDBC) and common application programming interface (Common Application Programming Interface, CAPI).

[0026] The number of proxy layers can be one or more than two. Figure 1 Three proxy layers 12 are shown in FIG. Each proxy layer 12 may be provided with a front-end connection module 121, which may be used to establish a front-end connection with a client 11. The proxy layer 12 may also be provided with a connection pool 14, which includes idle back-end connections, i.e., idle back-end connections. The proxy layer 12 may use these idle back-end connections to transmit database operation statements when necessary. It should be noted that when an idle back-end connection is used by the proxy layer to transmit a database operation statement, it is an occupied back-end connection and is not in an idle state until the back-end connection is in an idle state again when the database transaction is closed, and becomes an idle back-end connection.

[0027] The data node may be a distributed data node architecture, and each data node may be regarded as a database, or each data node may be regarded as a component of a database. Figure 1 Five data nodes 15 are shown. The proxy layer 12 can obtain an idle backend connection in the connection pool 14, and use the idle backend connection to transmit the database operation statement received from the client 11 to the corresponding data node 15. In the embodiment of the present application, the data node 15 can be a multi-copy node structure, for example, the data node 15 can include a master data node, a backup data node and a slave data node to improve the security and reliability of the data.

[0028] The following describes the distributed data node access method, device, equipment, system, medium and program product provided by the present application.

[0029] A first aspect of the present application provides a method for accessing a distributed data node, which can be applied to a proxy layer, that is, the method for accessing a distributed data node can be executed by a proxy layer, and the proxy layer can be specifically implemented as an access device, proxy equipment, etc. of a distributed data node, which is not limited here. Figure 2 A flowchart of a method for accessing a distributed data node provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the distributed data node access method may include steps S201 to S204.

[0030] In step S201, according to the database operation statement transmitted by the client through the established front-end connection, the target data node accessed by the database operation statement is determined.

[0031] After the proxy layer establishes a front-end connection with the client, the client can send a database operation statement to the proxy layer through the front-end connection. The database operation statement is used to perform data operations on the data node. In some examples, the database operation statement may include Structured Query Language (SQL), and SQL may include but is not limited to query statements such as select statements, commit statements such as commit statements, insert statements such as insert statements, and update statements such as update statements.

[0032] The proxy layer can parse the database operation statement to obtain the database partitioning result, which indicates the data node accessed by the database operation statement. The target data node includes the data node accessed by the database operation statement.

[0033] In step S202, an idle backend connection is obtained from a preset connection pool as a target connection.

[0034] The connection pool includes idle backend connections. Further, the connection pool only includes idle backend connections, that is, any backend connection in the connection pool is an idle backend connection, and the backend connections that can be obtained from the connection pool are all idle backend connections. Idle backend connections include backend connections in an idle state, and the backend connection is a connection between the proxy layer and the data node. The idle backend connection does not execute the transmission of the client's database operation statement, is in a waiting state, and can be requested and used at any time. The idle backend connections in the connection pool can be reused. For example, at time t1, the backend connection a1 is obtained from the connection pool, and the backend connection a1 is an idle backend connection. The database operation statement A1 is transmitted using the backend connection a1; at time t2, the database transaction corresponding to the database operation statement A1 has been closed, and the backend connection a1 is idle again, becomes an idle backend connection, and is returned to the connection pool; at time t3, the backend connection a1 in an idle state can be obtained from the connection pool again, and the backend connection a1 is used to transmit the database operation statement A2. The idle backend connections in the connection pool can be reused by multiple database operation statements of multiple clients.

[0035] When a target connection is needed, the connection pool can pop up an idle backend connection as the target connection. The target connection includes a backend connection for sending database operation statements. In order to ensure that the target connection can reliably transmit database operation data, the target connection undergoes a check synchronization process to ensure that the target connection can be used normally. The check synchronization process may include a liveness check process and a synchronization process. The liveness check process can check the activity of the target connection. The idle backend connection used as the target connection is active. If the cluster topology of the target connection changes, the target connection can be considered inactive and the backend connection used as the target connection needs to be replaced. The synchronization process is used to synchronize the properties of the frontend connection and the idle backend connection used as the target connection. The properties may include but are not limited to database setting variables. After the liveness check process determines that the selected backend connection is active and the properties are synchronized with the frontend connection, the selected backend connection can be used as the target connection.

[0036] In some examples, the liveness check process may include: checking the cluster topology of the target connection, if the cluster topology of the target connection changes, releasing the target connection, re-establishing a backend connection with the target data node, and determining the re-established backend connection as a new target connection.

[0037] Changes in the cluster topology of the target connection may include a replica switch of the target data node associated with the target connection and / or a disconnection of the target connection. The data node is a multi-copy structure, such as a data node may include a master data node, a backup data node, and a slave data node. Due to various reasons, the data node providing data may switch among the master data node, the backup data node, and the slave data node. For example, when the backend connection of the target connection is established, it is associated with the master data node of the target data node, but subsequently it is switched from the master data node to the slave data node, that is, the slave data node is currently providing data services. It can be determined that the cluster topology of the target connection has changed at the current moment, and the target connection cannot be used. The useless target connection is released, and a backend connection with the target data node is re-established, and the re-established backend connection is used as the target connection for sending database operation statements. For another example, due to a communication problem at a certain moment, the target data node associated with the target connection is temporarily offline, causing the target connection to be disconnected. Subsequently, the target data node is online again, and the target connection is not connected to the data node again. It can be determined that the topology result of the target connection has changed, and the target connection cannot be used. The useless target connection is released, and a backend connection with the target data node is re-established, and the re-established backend connection is used as the target connection for sending database operation statements. The liveness check process can be implemented by pinging the target data node or sending a query statement, i.e., a select statement, to the target data node.

[0038] In some examples, the liveness check process may include: periodically checking the cluster topology of the idle backend connections in the connection pool, and releasing the idle backend connections if the cluster topology of the idle backend connections changes. The specific content of the change in the cluster topology of the idle backend connections can be found in the relevant description of the change in the cluster topology of the target connection in the above example, which will not be repeated here. By pre-periodically checking the cluster topology of the idle backend connections in the connection pool, the idle backend connections whose cluster topology has changed can be released in time to ensure that the idle backend connections in the connection pool are all usable idle backend connections, thereby avoiding the situation where the idle backend connections are popped out of the connection pool and then found that the cluster topology of the idle backend connections has changed and cannot be used, further shortening the time required to access data nodes and improving the efficiency of accessing data nodes.

[0039] The liveness detection process may also include other processing methods, and all methods capable of detecting the activity of the backend connection are within the protection scope of the embodiments of the present application.

[0040] In some examples, the synchronization process may include, but is not limited to: setting the database setting variables of the target connection to make the database setting variables of the target connection consistent with the database setting variables of the front-end connection. In order to transmit the database operation statement to the target data node through the front-end connection and the back-end connection, the database environment of the front-end connection and the back-end connection needs to be consistent, and the database environment can be adjusted through the database setting variables, i.e., the database set variables. By setting the database setting variables of the target connection to be consistent with the database setting variables of the front-end connection, the database environment of the front-end connection and the target connection can be kept consistent to avoid errors.

[0041] In step S203, a database operation statement is sent to the target data node using the target connection.

[0042] The proxy layer uses the target connection to send database operation statements to the target data node. The database operation statements can perform corresponding data operations on the target data node. The target data node can transmit the response information to the database operation statement to the proxy layer through the target connection, and then the proxy layer transmits it to the client through the front-end connection. In some examples, the proxy layer can filter and merge the response information, splice and package it, and then feed it back to the client through the front-end connection.

[0043] In step S204, when the database operation statement does not open a database transaction or has closed the database transaction, the target connection is placed in a connection pool as an idle backend connection.

[0044] A database transaction is a sequence of database operations that access and possibly operate data. A database transaction consists of database operations performed between the start and end of a transaction. When performing some simple database operations, you can choose not to open a database transaction. In this case, the database operation statement can be regarded as not opening a database transaction. The database operation statement is the statement corresponding to the last database operation in the database operation sequence. After the database operation statement is executed, the database operation sequence is completed, that is, the database transaction ends. In this case, the database operation statement can be regarded as a closed database transaction. In the case where the database operation statement does not open a database transaction and the database operation statement has closed a database transaction, the target connection does not need to continue to remain bound to the front-end connection and can be unbound, that is, the target connection is restored to an idle state, and the target connection that has been restored to an idle state is placed in the connection pool as an idle back-end connection for use again in subsequent processes, thereby realizing the reuse of idle back-end connections in the connection pool.

[0045] When the database operation statement does not close the database transaction, the binding state of the target connection and the front-end connection is maintained, and the target connection is not placed in the connection pool.

[0046] In an embodiment of the present application, when a database operation statement transmitted by a user through a front-end connection is received, the target data node accessed by the database operation can be parsed, and an idle back-end connection is obtained from a preset connection pool including idle back-end connections as the target connection used to send the database operation statement to the target data node, and the database operation statement is sent through the target connection. In the case where the database operation statement does not open a database transaction or has closed a database transaction, the target connection is restored to an idle state and is placed in a connection pool as an idle back-end connection, so that the idle back-end connection in the connection pool can be reused by different clients and different front-end connections. Through the reuse of idle back-end connections in the connection pool, the binding of the front-end connection and the back-end connection can be released, the coupling of the front-end connection and the back-end connection can be reduced, the idle back-end connection can be fully utilized, the waste of network resources can be reduced, and the utilization efficiency of network resources can be improved. Moreover, since the idle back-end connection is fully utilized, the limited back-end connection can support more front-end connections, thereby reducing the limit on the number of front-end connections, improving the maximum performance of the distributed data node cluster, and improving the access efficiency to the distributed data nodes.

[0047] In some embodiments, executing access to distributed data nodes requires occupying threads, and threads can form processes. Correspondingly, the connection pool may include a thread pool and a process pool. The thread pool includes idle backend connections, and further, any backend connection in the thread pool is an idle backend connection. Each thread pool corresponds to a thread, and the idle backend connection in the thread pool is associated with the thread corresponding to the thread pool, and the idle backend connection in the thread pool can only be called by the thread corresponding to the thread pool. The process pool includes idle backend connections, and further, any backend connection in the process pool is an idle backend connection. The idle backend connection in the process pool can be called by any thread in the process corresponding to the process pool. Idle backend connections can be provided by a multi-level connection pool method of thread pools and process pools. Figure 3 A flowchart of a method for accessing a distributed data node provided in another embodiment of the present application is provided. Figure 3 and Figure 2 The difference is that Figure 2 Step S202 in the above example can be specifically broken down into Figure 3 Steps S2021 to S2023 in .

[0048] In step S2021, it is determined whether there is an idle backend connection in the thread pool corresponding to the thread occupied by the database operation statement.

[0049] The thread pool corresponding to the thread can be determined based on the thread occupied by the database operation statement. Any backend connection in the thread pool is an idle backend connection. If there is a backend connection in the thread pool, it means that there is an idle backend connection in the thread pool; if there is no backend connection in the thread pool, it means that there is no idle backend connection in the thread pool.

[0050] In step S2022, if there is an idle backend connection in the thread pool corresponding to the thread occupied by the database operation statement, an idle backend connection is obtained from the thread pool and determined as the target connection.

[0051] If there is an idle backend connection in the thread pool corresponding to the thread, an idle backend connection can be directly popped out from the thread pool as the target connection to transmit the database operation statement. It should be noted that the idle backend connection that is popped out needs to be checked and synchronized. After it is determined to be active and the attributes are synchronized, the idle backend connection is used as the target connection.

[0052] Since the thread pool corresponds to the thread, the idle backend connection in the thread pool is only used by the thread corresponding to the thread pool. Therefore, the thread pool does not need to introduce a lock mechanism. The frontend connection that occupies the thread will preferentially access the thread pool corresponding to the thread through the proxy layer, without the lock waiting step. In other words, the lock waiting step can be skipped from the thread pool, and an idle backend connection can be obtained as the target connection. The speed of obtaining idle backend connections in the thread pool is faster, which can further improve the efficiency of accessing data nodes.

[0053] In step S2023, if the thread pool corresponding to the thread occupied by the database operation statement does not have an idle backend connection, an idle backend connection is obtained from the process pool corresponding to the process to which the thread occupied by the database operation statement belongs and determined as the target connection.

[0054] If there is no idle backend connection in the thread pool corresponding to the thread, an idle backend connection is popped out from the process pool of the process to which the thread belongs as the target connection. It should be noted that the idle backend connection that is popped out needs to be checked and synchronized, and after it is determined to be active and the attributes are synchronized, the idle backend connection is used as the target connection.

[0055] All threads in a process can obtain idle backend connections from the process pool. The process pool can be regarded as a global connection pool, and a lock mechanism needs to be introduced. When obtaining an idle backend connection from the process pool, you need to perform a lock waiting step first, and then obtain an idle backend connection.

[0056] In some examples, the switching timeout can be pre-set, and the switching timeout can be expressed as idle_exchange_timeout. The switching timeout includes the threshold of the idle time required for the idle backend connection to be transferred from the thread pool to the process pool, which can be set according to the scenario, demand, experience, etc. In the case where the idle time of the idle backend connection in the thread pool exceeds the preset switching timeout, the idle backend connection is moved into the process pool. The idle time of the idle backend connection is the time during which the idle backend connection is in an idle state. The idle time of the idle backend connection in the thread pool exceeds the switching timeout, indicating that the work pressure of the thread corresponding to the thread pool is relatively small, that is, the busyness is relatively low. The idle backend connection in the thread pool whose idle time exceeds the switching timeout can be downgraded and moved into the process pool, so that other threads with high busyness can obtain and use it from the process pool when the number of idle backend connections in their own thread pool is insufficient, so as to realize the dynamic allocation of backend connection resources. The thread pool can be reduced in capacity under low work pressure by switching timeout. It should be noted that after the target connection transmits the database operation statement and the response information corresponding to the database operation statement, if the database operation statement does not open the database transaction or has closed the database transaction, the target connection is preferentially placed in the thread pool corresponding to the thread occupied by the database operation statement. By placing the target connection that has completed the session, that is, completed the response to the data operation corresponding to the database operation statement, into the thread pool, the thread pool can be expanded.

[0057] In some examples, the release timeout can be preset, and the release timeout can be expressed as idle_free_timeout. The release timeout includes a threshold of the idle time required for the idle backend connection to be released, which can be set according to the scenario, demand, experience, etc. In the case where the idle time of the idle backend connection in the process pool exceeds the preset release timeout, the idle backend connection is released. The release timeout can be greater than the switching timeout. If the idle time of the idle backend connection in the process pool exceeds the release timeout, it means that the work pressure of the process is small, that is, the busyness is low, and the idle backend connection is likely to be unused for a long time, then the idle backend connection in the process pool whose idle time exceeds the release timeout can be released to realize the dynamic distribution of backend connection resources and further save network resources. The release timeout can be used to reduce the capacity of the process pool under low work pressure. The idle backend connection moved into the process pool by the thread pool can be used to expand the capacity of the process pool.

[0058] For example, Figure 4 A schematic diagram of an example architecture of a two-level connection pool provided in an embodiment of the present application, Figure 4Thread pool 31, thread pool 32 and process pool 33 are shown, and backend connection 1 to backend connection 10 are idle backend connections. After backend connection 1 is used up, it becomes an idle backend connection again and enters thread pool 31. The idle time of backend connection 4 exceeds the switching timeout period, and backend connection 4 is moved from thread pool 31 to process pool 33, and backend connection 4 is locked. The idle time of backend connection 7 in process pool 33 exceeds the release timeout period, and backend connection 7 is released and locked. Backend connection 6 in process pool 33 can be moved from process pool 33 to thread pool 32, and backend connection 6 is locked. Backend connection 10 in thread pool 32 is popped up for transmitting database operation statements as a target connection.

[0059] In some embodiments, if there is no idle backend connection in the connection pool, a new backend connection is created and the new backend connection is determined as the target connection. If there is no idle backend connection in the connection pool, it means that there is no idle backend connection that can be reused. In order to respond to the client's requirements in a timely manner, a new backend connection can be created as the target connection to send database operation statements. If the connection pool includes a thread pool and a process pool, if the thread pool does not have an idle backend connection, the process pool is searched; if the process pool does not have an idle backend connection, a new backend connection is created and the new backend connection is used as the target connection.

[0060] In some embodiments, a performance requirement number range of the connection pool can be set, and the performance requirement number range can include the number range of idle backend connections in the connection pool that can make the access system of the distributed data node in a high-performance operating state, or include the capacity range of idle backend connections in the connection pool. If the number of idle backend connections in the connection pool is less than the lower limit of the performance requirement number range, a new backend connection is created as the target connection, and the target connection is placed in the connection pool after being used and when the database transaction is not opened or the database transaction is closed, so that the number of idle backend connections in the connection pool can quickly reach the performance requirement number range. If the number of idle backend connections in the connection pool is greater than the upper limit of the performance requirement number range, and there is no idle backend connection in the connection pool, wait until there is an idle backend connection in the connection pool, and determine the idle backend connection as the target connection. If the number of idle backend connections in the connection pool is greater than the upper limit of the performance requirement number range, if creating a new backend connection will have an adverse effect on the system performance, the database operation statement can be queued to wait for the idle backend connection to appear in the connection pool again, so as to control the number of backend connections connected to the data node in the connection pool to be within the performance requirement number range to ensure system performance.

[0061] In some embodiments, when a database transaction has been opened by a database operation statement, the data node of the backend connection to which the front-end connection corresponding to the database operation statement is bound can be obtained; when the data node of the backend connection to which the front-end connection corresponding to the database operation statement is bound includes a target data node, the bound backend connection is determined as the target connection; when the data node of the backend connection to which the front-end connection corresponding to the database operation statement is bound does not include the target data node, an idle backend connection is obtained from the connection pool as the target connection; if there is no idle backend connection in the connection pool, a new backend connection is created as the target connection.

[0062] If the database operation statement has opened a database transaction, the front-end connection of the database operation statement has been bound to a back-end connection. You can first check whether the data node of the back-end connection bound to the front-end connection has covered the target data node of this database operation statement. If it has, you can directly use the bound back-end connection to send it to the target data node; if it has not, you need to use the unbound idle back-end connection as the target connection to send the database operation statement to the target data node.

[0063] In some embodiments, a first linked list may be set, and the first linked list may be implemented as a priority list. The first linked list includes at least one layer of linked lists, each layer of linked lists having a key, i.e., key, and at least one value, i.e., value. The key includes a capability identifier, and the value includes a connection identifier. The capability identifier may characterize the authority and capability of the front-end connection. The connection identifier may indicate an idle back-end connection. For example, the connection identifier may include, but is not limited to, the number of the idle back-end connection, the pointer of the idle back-end connection, etc. The capability identifier of the idle back-end connection indicated by the connection identifier in one layer of linked lists is the same as the capability identifier indicated by the key in one layer of linked lists. The connection identifiers in each layer of linked lists are arranged in the time sequence in which the idle back-end connections indicated by the connection identifiers enter the connection pool. The above step S202 may be specifically refined as follows: obtaining the first capability identifier of the front-end connection; searching for a layer of linked lists whose key is consistent with the first capability identifier in the preset first linked list, and determining the idle back-end connection indicated by the first connection identifier in the layer of linked lists whose key is consistent with the first capability identifier as the target connection. The first capability identifier is the capability identifier of the front-end connection. Through the first linked list, a layer of linked list in the first linked list that is consistent with the capability identifier of the front-end connection can be found, so that the capability identifier of the target connection used is consistent with the capability identifier of the front-end connection, ensuring that database operation statements and response information can be transmitted normally.

[0064] For example, Figure 5 A schematic diagram of an example of a first linked list provided in an embodiment of the present application, such as Figure 5As shown, the first linked list includes n layers of linked lists, where n is a positive integer. The key of the first layer of linked lists is the capability identifier b1, and the values ​​of the first layer of linked lists include connection identifiers b11, b12, b13, ..., and b1m in sequence; the key of the second layer of linked lists is the capability identifier b2, and the values ​​of the second layer of linked lists include connection identifiers b21, b22, b23, ..., and b2m in sequence; the key of the third layer of linked lists is the capability identifier b3, and the values ​​of the third layer of linked lists include connection identifiers b31, b32, b33, ..., and b3m in sequence; the key of the nth layer of linked lists is the capability identifier bn, and the values ​​of the nth layer of linked lists include connection identifiers bn1, bn2, bn3, ..., and bnm in sequence. The connection identifiers in the first layer of linked lists are arranged from early to late according to the time when the idle backend connections enter the connection pool, and the arrangement order of the connection identifiers in other layer linked lists is the same, which will not be repeated here. If the capability identifier of the front-end connection of this database operation statement is capability identifier b2, the second-layer linked list is searched from the first linked list, and the first connection identifier b21 in the second-layer linked list, that is, the connection identifier of the idle back-end connection that entered the connection pool earliest in the second-layer linked list, is popped out, and the idle back-end connection indicated by the connection identifier b21 is determined as the target connection to transmit the database operation statement to the target data node.

[0065] In some embodiments, a second linked list may be set, and the second linked list may be implemented as a total list. The second linked list includes connection identifiers of idle backend connections in the connection pool, that is, the second linked list includes connection identifiers of all idle backend connections in the connection pool. The connection identifiers in the second linked list are arranged in the order of time when the idle backend connections indicated by the connection identifiers enter the connection pool. For example, Figure 6 A schematic diagram of an example of a second linked list provided in an embodiment of the present application, Figure 6 The second linked list shown includes Figure 5 All connection identifiers in the first linked list are shown, and the connection identifiers in the second linked list are arranged in the time sequence in which the idle backend connection identifiers indicated by the connection identifiers enter the connection pool, such as the idle backend connection indicated by connection identifier b21 enters the connection pool after the idle backend connection indicated by connection identifier b11.

[0066] Correspondingly, when there is no first-layer linked list in the first linked list whose key is consistent with the first capability identifier, the idle backend connection indicated by the first connection identifier in the preset second linked list can be obtained as a candidate connection; if the candidate connection passes the outer-layer logic applicability verification, the candidate connection is determined as the target connection. If there is no first-layer linked list in the first linked list whose key is consistent with the first capability identifier, the idle backend connection indicated by the first connection identifier in the second linked list is popped out from the connection pool as a candidate connection, and the outer-layer logic can determine whether the capability represented by the capability identifier of the candidate connection can be applied to the capability represented by the first capability identifier. If it can be applied, it is determined that the candidate connection passes the outer-layer logic applicability verification, and the candidate connection is determined as the target connection. If the candidate connection fails the outer-layer logic applicability verification, it is necessary to re-establish the front-end connection. By using the second linked list, the success rate of access to distributed data nodes can be improved.

[0067] For ease of understanding, the following uses SQL statements as an example to illustrate the overall process of a client accessing a data node through a proxy layer. Figure 7 The flowchart of an example of a client accessing a data node through a proxy layer provided in an embodiment of the present application includes steps c1 to c10.

[0068] In step c1, a front-end connection is established. The front-end connection is a connection between the client and the proxy layer.

[0069] In step c2, the SQL statement is parsed to obtain the database partitioning result. The database partitioning result represents the target data node. If the SQL statement does not start a database transaction, execute step c3; if the SQL statement has started a database transaction, execute step c10.

[0070] In step c3, it is determined whether the thread pool has an idle backend connection. If so, step c4 is executed; if not, step c8 is executed.

[0071] In step c4, an idle backend connection is popped up and a check synchronization process is performed to obtain a target connection.

[0072] In step c5, the SQL statement is sent using the target connection and executed. If the database transaction is not open or has been closed, step c6 is executed; if the database transaction is open, step c7 is executed.

[0073] In step c6, the target connection is put back into the thread pool.

[0074] In step c7, the binding between the target connection and the front-end connection is maintained.

[0075] In step c8, it is determined whether the process pool has an idle backend connection. If so, step c4 is executed; if not, step c9 is executed.

[0076] In step c9, a new backend connection is created as the target connection, and step c5 is executed.

[0077] In step c10, it is determined whether the bound backend connection covers the target data node. If so, the bound backend connection is used as the target connection to execute step c5; if not, execute step c3.

[0078] For the specific contents of the above steps c1 to c10, please refer to the relevant descriptions in the above embodiments, which will not be repeated here.

[0079] The access method of the distributed data node provided in the embodiment of the present application can save network resources and make the number of data nodes in an interval that can make the data node performance better. For example, under the same test conditions, the related technology of the back-end connection and the front-end connection always binding until the front-end binding is disconnected and the access method of the distributed data node in the embodiment of the present application can be respectively executed. The test conditions may include: the client establishes a total of 2000 front-end connections with the proxy layer, each business transaction operation may include 5 database operations and other business logics, and the 5 database operations are completed by select statements, commit statements, insert statements, update statements and commit statements respectively. The system throughput of the data node cluster is 50,000 transactions per second (Transactions Per Second, TPS), the average cumulative delay of the 5 database operations reaches 10 milliseconds, and the delay of other business logic reaches 90 milliseconds. To achieve better performance of the data node, the number of back-end connections corresponding to each data node needs to be 500 to 1000. If the related technology that the back-end connection is always bound to the front-end connection until the front-end binding is disconnected is adopted, 12 proxy layers and 12 data nodes are required to establish 2000 front-end connections, each proxy layer is allocated 166 front-end connections, and each front-end connection needs to be bound to a back-end connection of each data node, then each proxy layer must establish 166 back-end connections with each data node, and each data node has a total of 2000 back-end connections. If the access method of the distributed data node in the embodiment of the present application is adopted, since the back-end connection can be reused, only 10 proxy layers and 10 data nodes are required, which can save 20% of network resources such as hardware resources compared to the related technology, and each data node has a total of about 1000 back-end connections. Compared with the related technology, the number of back-end connections of each data node can be reduced by 50%, and the performance of the data node can be better, which improves the performance of the data node cluster.

[0080] A second aspect of the present application provides a distributed data node access device. Figure 8 A schematic diagram of the structure of a distributed data node access device provided in an embodiment of the present application is shown in FIG. Figure 8 As shown, the access device 400 of the distributed data node may include a receiving module 401 , a connection processing module 402 and a sending module 403 .

[0081] The receiving module 401 may be used to determine a target data node accessed by a database operation statement according to the database operation statement transmitted by the client through the established front-end connection.

[0082] The connection processing module 402 may be used to obtain an idle backend connection from a preset connection pool as a target connection.

[0083] The connection pool includes idle backend connections, and the target connection is checked and synchronized to make the target connection usable normally.

[0084] The sending module 403 may be used to send a database operation statement to a target data node using a target connection;

[0085] The connection processing module 402 may also be used to put the target connection into the connection pool as an idle backend connection when the database operation statement does not open a database transaction or has closed the database transaction.

[0086] In some embodiments, the connection pool includes a thread pool and a process pool, the thread pool includes idle backend connections, and the process pool includes idle backend connections.

[0087] The connection processing module 402 can be specifically used to: determine whether there is an idle backend connection in the thread pool corresponding to the thread occupied by the database operation statement; if there is an idle backend connection in the thread pool corresponding to the thread occupied by the database operation statement, obtain an idle backend connection from the thread pool and determine it as the target connection; if there is no idle backend connection in the thread pool corresponding to the thread occupied by the database operation statement, obtain an idle backend connection from the process pool corresponding to the process to which the thread occupied by the database operation statement belongs and determine it as the target connection.

[0088] In some examples, the connection processing module 402 may be specifically used to: skip the lock waiting step from the thread pool, and obtain an idle backend connection to determine as the target connection.

[0089] In some embodiments, the connection processing module 402 can also be used to: move the idle backend connection into the process pool when the idle time of the idle backend connection in the thread pool exceeds the preset switching timeout period; release the idle backend connection when the idle time of the idle backend connection in the process pool exceeds the preset release timeout period.

[0090] In some embodiments, the connection processing module 402 may also be used to: when there is no idle backend connection in the connection pool, create a new backend connection, and determine the newly created backend connection as the target connection.

[0091] In some embodiments, the connection processing module 402 can also be used for: when a database operation statement has started a database transaction, obtaining the data node of the backend connection to which the front-end connection corresponding to the database operation statement is bound; when the data node of the backend connection to which the front-end connection corresponding to the database operation statement is bound includes a target data node, determining the bound backend connection as the target connection.

[0092] The connection processing module 402 may be specifically used to obtain an idle backend connection from the connection pool as a target connection when the data node of the backend connection bound to the frontend connection corresponding to the database operation statement does not include the target data node.

[0093] In some embodiments, the connection processing module 402 can also be used for: if the number of idle backend connections in the connection pool is less than the lower limit of the performance requirement number range, then a new backend connection is created as the target connection; if the number of idle backend connections in the connection pool is greater than the upper limit of the performance requirement number range, and there is no idle backend connection in the connection pool, then wait until there is an idle backend connection in the connection pool, and determine the idle backend connection as the target connection.

[0094] In some embodiments, the check synchronization process includes a liveness check process and a synchronization process.

[0095] The liveness check processing includes: checking the cluster topology of the target connection. If the cluster topology of the target connection changes, releasing the target connection, re-establishing the backend connection with the target data node, and determining the re-established backend connection as the new target connection; or, periodically checking the cluster topology of the idle backend connections in the connection pool. If the cluster topology of the idle backend connections changes, releasing the idle backend connections.

[0096] The synchronization process includes: setting the database setting variables of the target connection so that the database setting variables of the target connection are consistent with the database setting variables of the front-end connection.

[0097] In some embodiments, the connection processing module 402 can be specifically used to: obtain a first capability identifier of the front-end connection; search a layer of linked lists with a key consistent with the first capability identifier in a preset first linked list, and determine the idle back-end connection indicated by the first connection identifier in the layer of linked lists with a key consistent with the first capability identifier as the target connection.

[0098] Among them, the first linked list includes at least one layer of linked list, each layer of linked list has a key and at least one value, the key includes a capability identifier, the value includes a connection identifier, the capability identifier of the idle backend connection indicated by the connection identifier in one layer of linked list is the same as the capability identifier indicated by the key in the first layer of linked list, and the connection identifiers in each layer of linked list are arranged in the chronological order of the idle backend connections indicated by the connection identifiers entering the connection pool.

[0099] In some embodiments, the connection processing module 402 can also be specifically used for: when there is no layer of linked list in the first linked list whose key is consistent with the first capability identifier, obtaining the idle backend connection indicated by the first connection identifier in the preset second linked list as a candidate connection, wherein the second linked list includes the connection identifiers of the idle backend connections in the connection pool, and the connection identifiers in the second linked list are arranged in the time order of the idle backend connections indicated by the connection identifiers entering the connection pool; if the candidate connection passes the outer layer logic applicability verification, the candidate connection is determined as the target connection.

[0100] It should be noted that the access device 400 of the distributed data node is a device corresponding to the above-mentioned distributed data node access method. All implementation methods in the above-mentioned method embodiments are applicable to the embodiments of the device and can achieve the same technical effects, which will not be repeated here.

[0101] A third aspect of the present application provides a proxy device. Fig. 9 A schematic diagram of the structure of a proxy device provided in an embodiment of the present application, such as Fig. 9 As shown, the proxy device 500 includes a memory 501 , a processor 502 , and a computer program stored in the memory 501 and executable on the processor 502 .

[0102] In some examples, the processor 502 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0103] The memory 501 may include a read-only memory (ROM), a random access memory (RAM), a disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Therefore, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the access method of the distributed data node according to the embodiment of the present application.

[0104] The processor 502 runs a computer program corresponding to the executable program code by reading the executable program code stored in the memory 501 , so as to implement the distributed data node access method in the above embodiment.

[0105] In some examples, the proxy device 500 may also include a communication interface 503 and a bus 504. Fig. 9 As shown, the memory 501, the processor 502, and the communication interface 503 are connected via a bus 504 and communicate with each other.

[0106] The communication interface 503 is mainly used to realize the communication between the modules, devices, units and / or equipment in the embodiment of the present application. The communication interface 503 can also be used to access input devices and / or output devices.

[0107] The bus 504 includes hardware, software, or both, coupling the components of the proxy device 500 to each other. By way of example and not limitation, the bus 504 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a Memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-E) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses or a combination of two or more of the above. Where appropriate, the bus 504 may include one or more buses. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.

[0108] The fourth aspect of the present application provides a distributed data node access system, which may include a client, a proxy device and a data node. The client is connected to the proxy device for communication, and the proxy device is connected to the data node for communication. The proxy device can be understood as the proxy layer, the access device of the distributed data node and the proxy device in the above embodiment. The specific contents of the client, the proxy device, the data node and the access method of the distributed data node can be found in the relevant description in the above embodiment, which will not be repeated here.

[0109] In a fifth aspect, the present application provides a computer-readable storage medium, on which computer program instructions are stored, which, when executed by a processor, can implement the distributed data node access method in the above-mentioned embodiment, and can achieve the same technical effect, and will not be repeated here to avoid repetition. Among them, the above-mentioned computer-readable storage medium may include a non-transitory computer-readable storage medium, such as a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc., which is not limited here.

[0110] The sixth aspect of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the access method of the distributed data nodes in the above-mentioned embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0111] It should be clear that each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. For device embodiments, equipment embodiments, system embodiments, computer-readable storage medium embodiments, and computer program product embodiments, the relevant parts can refer to the description part of the method embodiment. The present application is not limited to the specific steps and structures described above and shown in the figures. Those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application. In addition, for the sake of brevity, a detailed description of known method technologies is omitted here.

[0112] The above reference is according to the method of the embodiment of the present application, the flow chart of the device (system) and the computer program product and / or the block diagram described various aspects of the present application.It should be understood that each square box in the flow chart and / or the block diagram and the combination of each square box in the flow chart and / or the block diagram can be realized by computer program instructions.These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the realization of the function / action specified in one or more square boxes of the flow chart and / or the block diagram.Such a processor can be but is not limited to a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit.It can also be understood that each square box in the block diagram and / or the flow chart and the combination of the square boxes in the block diagram and / or the flow chart can also be realized by the dedicated hardware that performs the specified function or action, or can be realized by the combination of dedicated hardware and computer instructions.

[0113] Those skilled in the art should understand that the above embodiments are exemplary rather than restrictive. Different technical features appearing in different embodiments can be combined to achieve beneficial effects. Based on the study of the drawings, the specification and the claims, those skilled in the art should be able to understand and implement other variations of the disclosed embodiments. In the claims, the term "comprising" does not exclude other devices or steps; the quantifier "one" does not exclude multiple; the terms "first" and "second" are used to indicate names rather than to indicate any specific order. Any figure marks in the claims should not be understood as limiting the scope of protection. The functions of multiple parts appearing in the claims can be implemented by a single hardware or software module. The appearance of certain technical features in different dependent claims does not mean that these technical features cannot be combined to achieve beneficial effects.

Claims

1. A method for accessing a distributed data node, characterized in that: include: Determine, according to the database operation statement transmitted by the client through the established front-end connection, a target data node accessed by the database operation statement; Obtain an idle backend connection from a preset connection pool as a target connection, the connection pool including idle backend connections, and the target connection is checked and synchronized so that the target connection can be used normally; Sending the database operation statement to the target data node using the target connection; When the database operation statement does not open a database transaction or has closed a database transaction, the target connection is placed in the connection pool as an idle backend connection.

2. The method according to claim 1, characterized in that The connection pool includes a thread pool and a process pool, the thread pool includes idle backend connections, and the process pool includes idle backend connections; The step of obtaining an idle backend connection from a preset connection pool as a target connection includes: Determine whether there is an idle backend connection in the thread pool corresponding to the thread occupied by the database operation statement; If there is an idle backend connection in the thread pool corresponding to the thread occupied by the database operation statement, an idle backend connection is obtained from the thread pool and determined as the target connection; If the thread pool corresponding to the thread occupied by the database operation statement does not have an idle backend connection, an idle backend connection is obtained from the process pool corresponding to the process to which the thread occupied by the database operation statement belongs to determine it as the target connection.

3. The method according to claim 2, characterized in that The obtaining an idle backend connection from the thread pool and determining it as the target connection includes: The lock waiting step is skipped and an idle backend connection is obtained from the thread pool to be determined as the target connection.

4. The method according to claim 2, characterized in that: Also includes: When the idle time of an idle backend connection in the thread pool exceeds the preset switching timeout, the idle backend connection is moved into the process pool; When the idle time of an idle backend connection in the process pool exceeds the preset release timeout time, the idle backend connection is released.

5. The method according to claim 1, characterized in that Also includes: In the case that there is no idle backend connection in the connection pool, a new backend connection is created, and the new backend connection is determined as the target connection.

6. The method according to claim 1, characterized in that Also includes: In the case where the database operation statement has opened a database transaction, obtaining a data node of a backend connection to which a frontend connection corresponding to the database operation statement has been bound; In a case where the data node of the backend connection to which the frontend connection corresponding to the database operation statement is bound includes the target data node, determining the bound backend connection as the target connection; The step of obtaining an idle backend connection from a preset connection pool as a target connection includes: When the data node of the backend connection to which the frontend connection corresponding to the database operation statement is bound does not include the target data node, an idle backend connection is obtained from the connection pool as the target connection.

7. The method according to claim 1, characterized in that Also includes: If the number of idle backend connections in the connection pool is less than the lower limit of the performance requirement number range, a new backend connection is created as the target connection; If the number of idle backend connections in the connection pool is greater than the upper limit of the performance requirement number range, and there is no idle backend connection in the connection pool, wait until there is an idle backend connection in the connection pool, and determine the idle backend connection as the target connection.

8. The method according to claim 1, characterized in that The inspection synchronization process includes a liveness detection process and a synchronization process; The biopsy process includes: Checking the cluster topology of the target connection, if the cluster topology of the target connection changes, releasing the target connection, re-establishing a backend connection with the target data node, and determining the re-established backend connection as the new target connection; or, Periodically checking the cluster topology of idle backend connections in the connection pool, and if the cluster topology of idle backend connections changes, releasing the idle backend connections; The synchronization process includes: The database setting variables of the target connection are set so that the database setting variables of the target connection are consistent with the database setting variables of the front-end connection.

9. The method according to claim 1, characterized in that: The step of obtaining an idle backend connection from a preset connection pool as a target connection includes: Get the first capability identifier of the front-end connection; Searching a first-layer linked list whose key is consistent with the first capability identifier in a preset first linked list, determining an idle backend connection indicated by the first connection identifier in the first-layer linked list whose key is consistent with the first capability identifier as the target connection, Among them, the first linked list includes at least one layer of linked list, each layer of linked list has a key and at least one value, the key includes a capability identifier, the value includes a connection identifier, the capability identifier of the idle backend connection indicated by the connection identifier in one layer of linked list is the same as the capability identifier indicated by the key in the first layer of linked list, and the connection identifiers in each layer of linked list are arranged in the chronological order of the idle backend connections indicated by the connection identifiers entering the connection pool.

10. The method according to claim 9, characterized in that Also includes: In the case that there is no one-layer linked list in the first linked list having a key consistent with the first capability identifier, obtaining an idle backend connection indicated by a first connection identifier in a preset second linked list as a candidate connection, wherein the second linked list includes connection identifiers of idle backend connections in the connection pool, and the connection identifiers in the second linked list are arranged in the time sequence in which the idle backend connections indicated by the connection identifiers enter the connection pool; If the candidate connection passes the outer-layer logic applicability verification, the candidate connection is determined as the target connection.

11. A distributed data node access device, characterized in that: include: A receiving module, configured to determine a target data node to be accessed by a database operation statement according to a database operation statement transmitted by a client through an established front-end connection; A connection processing module, used to obtain an idle backend connection from a preset connection pool as a target connection, wherein the connection pool includes idle backend connections, and the target connection is checked and synchronized so that the target connection can be used normally; A sending module, used for sending the database operation statement to the target data node by using the target connection; The connection processing module is also used to put the target connection into the connection pool as an idle backend connection when the database operation statement does not open a database transaction or has closed a database transaction.

12. A proxy device, characterized in that: include: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the distributed data node access method as described in any one of claims 1 to 10 is implemented.

13. A distributed data node access system, characterized in that: include: Client side; The proxy device according to claim 12, wherein the proxy device is communicatively connected to the client; A data node is communicatively connected with the proxy device.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the distributed data node access method according to any one of claims 1 to 10 is implemented.

15. A computer program product, characterized in that It comprises a computer program, which, when executed by a processor, implements the distributed data node access method described in any one of claims 1 to 10.

Citation Information

Patent Citations

  • Database agency method and device

    CN103729373A

  • Data management method and system based on .NET database connection pools

    CN105095438A

  • Database connection control method and apparatus

    CN105956138A

  • Management method and device for database connection pool

    CN106484882A

  • Thread pool task processing method in high-availability cluster system

    CN107832146A

Cited By

  • Distributed database upgrading method and device, equipment and medium

    CN119806597A

  • Method, device and equipment for upgrading distributed database and medium

    CN119806597B