A method for outputting initiating nodes in an MPP distributed system

By constructing the node shard mapping relationship and IP distance matrix, the management node with the smallest distance is selected as the initiating node, which solves the problem of network bottlenecks in high concurrency scenarios and improves user experience and business efficiency.

CN118277456BActive Publication Date: 2024-09-20TIANJIN NANKAI UNIV GENERAL DATA TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410704629.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-03
Publication Date
2024-09-20
Estimated Expiration
2044-06-03

AI Technical Summary

Technical Problem

In high-concurrency and high-load scenarios, existing technology cannot effectively select task initiation nodes, resulting in network bottlenecks and abnormal performance, affecting user experience.

Method used

By collecting database cluster node information, construct node shard mapping relationships and IP distance matrices, allocate hash buckets and extract hash keys in query statements, query and calculate node IPs based on hash keys, and select the management node with the smallest distance as the initiating node. , ensuring network efficiency.

Benefits of technology

Automatically select the optimal initiating node to reduce network overhead, avoid performance abnormalities, and improve user experience and business efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118277456B
    Figure CN118277456B
Patent Text Reader

Abstract

The present invention provides an initiating node output method in an MPP distributed system, and relates to the technical field of databases. The method comprises: collecting the number of nodes and node IPs in a database cluster, and obtaining a first mapping relationship between node shards and node IPs by sorting according to shard information; collecting server information, creating an IP distance matrix between computing nodes and management nodes, and obtaining a distance matrix; allocating multiple hash buckets to each computing node and recording the corresponding relationship between the computing node and the hash bucket, and obtaining a second mapping relationship between the node shards and the computing node according to nodedatamap table information and the corresponding relationship; extracting a hash key in a filter condition of a query statement, and obtaining a node IP of the computing node according to the hash key query; querying a minimum value of a computing node and a management node according to a node IP query result from the distance matrix, and outputting the corresponding node as an initiating node. The present invention can select an optimal initiating node and save network overhead.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of database technology, and in particular to an initiating node output method in an MPP distributed system. Background Art

[0002] In an MPP distributed system, it usually includes management nodes and computing nodes. The management node is the task initiating node, which is responsible for planning and scheduling tasks and receiving data returned from the computing nodes. The computing nodes are the nodes where the data is located, which are responsible for executing tasks and returning the data that needs to be returned to the initiating node. Therefore, the initiating node is equivalent to the chief dispatcher and plays an important role.

[0003] When the network load is not heavy and the number of concurrent tasks is not high, it does not seem to be critical to choose which management node to use as the initiating node for the task. However, in scenarios with heavy business load and high concurrency, the network bandwidth is squeezed and the cross-network communication network latency is high. The network can easily become a performance bottleneck, resulting in a backlog of tasks and the inability to complete the scenario business in a timely manner. At this time, it is crucial to correctly select the initiating node for the task.

[0004] In the past, when DBAs selected task initiation nodes, they usually adopted random selection or sequential selection. However, both methods did not consider the impact of the network on performance, which resulted in SQL not being able to run on the best initiation node. This may cause performance anomalies due to network bottlenecks, affecting user usage. Summary of the invention

[0005] The present invention aims to solve at least one of the technical problems existing in the related art. To this end, the present invention provides an initiating node output method in an MPP distributed system.

[0006] The present invention provides an initiating node output method in an MPP distributed system, comprising:

[0007] S1: Collect the number of nodes and node IPs in the database cluster, sort them according to the sharding information to obtain the first mapping relationship between the node shards and the node IPs;

[0008] S2: Collect server information, create an IP distance matrix between computing nodes and management nodes according to the server information, and obtain a distance matrix;

[0009] S3: Allocate multiple hash buckets to each computing node, record the correspondence between the computing nodes and the hash buckets through the nodedatamap table of the management node, and obtain the second mapping relationship between the node shards and the computing nodes according to the nodedatamap table information and the correspondence;

[0010] S4: extracting a hash key in the filter condition of the query statement, and obtaining the node IP of the computing node corresponding to the query statement according to the hash key query based on the second mapping relationship and the first mapping relationship, and obtaining a node IP query result;

[0011] S5: Obtain the minimum values ​​of computing nodes and management nodes from the distance matrix according to the node IP query result, and output the node corresponding to the minimum value as the initiating node.

[0012] According to an initiating node output method in an MPP distributed system provided by the present invention, the first mapping relationship in step S1 is a one-dimensional array.

[0013] According to an initiating node output method in an MPP distributed system provided by the present invention, the distance matrix in step S2 is a two-dimensional matrix.

[0014] According to an initiating node output method in an MPP distributed system provided by the present invention, in the distance matrix, when the IP of the computing node is the same as the IP of the management node, the distance between the computing node and the management node is 0; when the IP of the computing node is different from the IP of the management node, the distance between the computing node and the management node is 1.

[0015] According to an initiating node output method in an MPP distributed system provided by the present invention, in step S3, when multiple hash buckets are allocated to each computing node, the allocation method is uniform allocation according to the total number of hash buckets.

[0016] According to an initiating node output method in an MPP distributed system provided by the present invention, the total number of hash buckets is 65536.

[0017] According to an initiating node output method in an MPP distributed system provided by the present invention, step S4 further comprises:

[0018] S41: extracting the hash value of the distribution column in the filter condition of the query statement;

[0019] S42: Obtain a hash key according to the hash value calculation;

[0020] S43: Obtaining the shard where the data corresponding to the query statement is located according to the hash key based on the second mapping relationship;

[0021] S44: Obtain the node IP corresponding to the computing node according to the shard where the data is located by using the first mapping relationship to obtain a node IP query result.

[0022] According to an initiating node output method in an MPP distributed system provided by the present invention, in step S4, the filtering condition is a precise query statement containing a where condition and having an equality distribution column.

[0023] The present invention provides an initiating node output method in an MPP distributed system, which is used to solve the problem of aggravated network load due to incorrect selection when the concurrency pressure is large and the network load is heavy. The method can automatically select the optimal initiating node according to the characteristics of MPP, ensure that the selected initiating node and the computing node are the same machine, save network overhead, avoid performance anomalies caused by incorrect selection of initiating nodes, enable user services to be completed more quickly, and improve user experience and usage efficiency.

[0024] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0026] Figure 1 It is a flow chart of an initiating node output method in an MPP distributed system provided by the present invention. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical scheme and advantages of the present invention clearer, the technical scheme of the present invention will be clearly and completely described below in conjunction with the drawings in the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention. The following embodiments are used to illustrate the present invention, but cannot be used to limit the scope of the present invention.

[0028] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiment of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0029] Combine the following Figure 1 Embodiments of the present invention are described.

[0030] The present invention provides an initiating node output method in an MPP distributed system, comprising:

[0031] S1: Collect the number of nodes and node IPs in the database cluster, sort them according to the sharding information to obtain the first mapping relationship between the node shards and the node IPs;

[0032] Wherein, the first mapping relationship in step S1 is a one-dimensional array.

[0033] In this stage, we first obtain the mapping relationship between shards and IP addresses. Specifically, we obtain the number of nodes and IP addresses in the database cluster and sort them by shard information. We define an N-column one-dimensional array A, where N is the number of computing nodes. The expression is A[0]=ip1, A[1]=ip2…A[N-1]=ipN.

[0034] S2: Collect server information, create an IP distance matrix between computing nodes and management nodes according to the server information, and obtain a distance matrix;

[0035] Wherein, the distance matrix in step S2 is a two-dimensional matrix.

[0036] In the distance matrix, when the IP of the computing node is the same as the IP of the management node, the distance between the computing node and the management node is 0; when the IP of the computing node is different from the IP of the management node, the distance between the computing node and the management node is 1.

[0037] The purpose of this stage is to obtain the distance matrix between the computing node and the initiating node. Specifically, first define an N*N two-dimensional matrix M based on the server location information or IP information provided by the server administrator, and then create an IP distance matrix between the computing node and the management node. If the IPs are the same, the distance is 0, and if the IPs are different, the distance is 1.

[0038] S3: Allocate multiple hash buckets to each computing node, record the correspondence between the computing nodes and the hash buckets through the nodedatamap table of the management node, and obtain the second mapping relationship between the node shards and the computing nodes according to the nodedatamap table information and the correspondence;

[0039] Furthermore, the purpose of this stage is to obtain the relationship between shards and computing nodes. The MPP cluster has N computing nodes, with ids ranging from n1 to nN. Each node is allocated 65536 / N hash buckets, and the hash bucket ids are h0-h65535.

[0040] The nodedatamap (system table used to record the mapping between node shards and data) in the MPP initiating node records the relationship between shards and hash buckets. Each node corresponds to multiple hash buckets. Then we can obtain the relationship between the shards and the computing node IP through the information in the nodedatamap.

[0041] In step S3, when multiple hash buckets are allocated to each computing node, the allocation method is to evenly allocate according to the total number of hash buckets.

[0042] Among them, the total number of hash buckets is 65536.

[0043] In some embodiments, the GBase database corresponds to 65536 hash buckets.

[0044] S4: extracting a hash key in the filter condition of the query statement, and obtaining the node IP of the computing node corresponding to the query statement according to the hash key query based on the second mapping relationship and the first mapping relationship, and obtaining a node IP query result;

[0045] Wherein, step S4 further comprises:

[0046] S41: extracting the hash value of the distribution column in the filter condition of the query statement;

[0047] S42: Obtain a hash key according to the hash value calculation;

[0048] S43: Obtaining the shard where the data corresponding to the query statement is located according to the hash key based on the second mapping relationship;

[0049] S44: Obtain the node IP corresponding to the computing node according to the shard where the data is located by using the first mapping relationship to obtain a node IP query result.

[0050] Wherein, in step S4, the filtering condition is a precise query statement containing a where condition and having an equal distribution column.

[0051] In this stage, first extract the hash value v in the filter condition in SQL and determine the IP of the SQL computing node. Specifically, after obtaining SQL, find the value v of the hash distribution column in the precise query filter condition. The sign is that it contains the where condition and the distribution column '=' exists. After finding the value v, perform crc32(v)%65536 to calculate the hashkey, where crc is an encryption and decryption algorithm based on the crc verification principle. Then, obtain the relationship between the shard and the hashkey from the nodedatamap information in step S3 to obtain the shard where the data is located. According to the shard and IP mapping relationship obtained in step S1, the computing node IP is obtained.

[0052] S5: Obtain the minimum values ​​of computing nodes and management nodes from the distance matrix according to the node IP query result, and output the node corresponding to the minimum value as the initiating node.

[0053] The purpose of this stage is to obtain the optimal initiating node IP. According to the computing node IP obtained in step S4, the minimum value of the distance matrix between the computing node and the initiating node obtained in step S2 is found, min(M[k,i]), k is the shard value of the computing node IP, i is 0...N-1, and the M node is output as the computing node.

[0054] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for outputting an initiating node in an MPP distributed system, characterized in that: include: S1: Collect the number of nodes and node IPs in the database cluster, sort them according to the sharding information to obtain the first mapping relationship between the node shards and the node IPs; S2: Collect server information, create an IP distance matrix between computing nodes and management nodes according to the server information, and obtain a distance matrix; S3: Allocate multiple hash buckets to each computing node, record the correspondence between the computing node and the hash bucket through the nodedatamap table of the management node, and obtain the second mapping relationship between the node shard and the computing node according to the nodedatamap table information and the correspondence, specifically including: S31: Allocate multiple hash buckets to each computing node; S32: Record the correspondence between the computing nodes and the hash buckets through the nodedatamap table of the management node; S33: Record the correspondence between node shards and hash buckets through the nodedatamap table of the MPP initiating node; S34: Obtain the hash bucket corresponding to the computing node through the nodedatamap table of the management node, obtain the node shard corresponding to the hash bucket through the nodedatamap table of the MPP initiating node, and obtain the second mapping relationship between the node shard and the computing node according to the hash bucket corresponding to the computing node and the node shard corresponding to the hash bucket; S4: extracting the hash key in the filter condition of the query statement, and obtaining the node IP of the computing node corresponding to the query statement according to the hash key query based on the second mapping relationship and the first mapping relationship, and obtaining the node IP query result, specifically including: S41: extracting the hash value of the distribution column in the filter condition of the query statement; S42: Obtain a hash key according to the hash value calculation; S43: Obtain the node shard corresponding to the hash key through the nodedatamap table of the MPP initiating node according to the second mapping relationship, and obtain the shard where the data corresponding to the query statement is located according to the hash key; S44: Obtaining the node IP corresponding to the computing node according to the shard where the data is located by using the first mapping relationship to obtain a node IP query result; S5: Obtain the minimum values ​​of computing nodes and management nodes from the distance matrix according to the node IP query result, and output the node corresponding to the minimum value as the initiating node.

2. The initiating node output method in an MPP distributed system according to claim 1, characterized in that: The first mapping relationship in step S1 is a one-dimensional array.

3. The initiating node output method in an MPP distributed system according to claim 1, characterized in that: The distance matrix in step S2 is a two-dimensional matrix.

4. The initiating node output method in an MPP distributed system according to claim 3, characterized in that: In the distance matrix, when the IP of the computing node is the same as the IP of the management node, the distance between the computing node and the management node is 0; when the IP of the computing node is different from the IP of the management node, the distance between the computing node and the management node is 1.

5. The initiating node output method in an MPP distributed system according to claim 1, characterized in that: In step S3, when multiple hash buckets are allocated to each computing node, the allocation method is to evenly allocate according to the total number of hash buckets.

6. The initiating node output method in an MPP distributed system according to claim 5, characterized in that: The total number of hash buckets is 65536.

7. The initiating node output method in an MPP distributed system according to claim 1, characterized in that: In step S4, the filtering condition is an accurate query statement containing a where condition and having an equal distribution column.