Distributed index structure and load balancing method for high-throughput data streams

Through the two-layer distributed index structure and load balancing strategy, it solves the real-time and concurrency problems of data flow reception, index construction and storage in multi-source, high-throughput data flow scenarios, and achieves efficient data flow management and query services. , adapting to the unlimited and high-speed flow characteristics of data flow.

CN113568906BActive Publication Date: 2024-10-29ZHEJIANG UNIV OF TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110752295.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-02
Publication Date
2024-10-29
Estimated Expiration
2041-07-02

AI Technical Summary

Technical Problem

In a multi-source, high-throughput data flow scenario, a single machine cannot process data flow reception, index construction, data storage, and query requests in real time. Existing technologies have load imbalance problems in heterogeneous data flow management and are difficult to satisfy. High concurrency and real-time query requirements.

Method used

Adopting a two-layer distributed index structure and load balancing strategy, through the collaborative work of data flow receiving nodes, coordination nodes, query nodes and storage nodes, efficient reception, index construction and storage of data flows are achieved, using B+ tree indexes and hash tables The top-level index structure of index combination combines the KETAMA_HASH mapping function and the analytic hierarchy process for load balancing and dynamically adjusts the node load.

Benefits of technology

It achieves fast index construction and efficient storage of multi-source, high-throughput data streams, provides high-concurrency near-real-time query services, ensures distributed cluster node load balancing, and adapts to the unlimited and high-speed flow characteristics of data streams.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113568906B_ABST
    Figure CN113568906B_ABST
Patent Text Reader

Abstract

A distributed index structure and load balancing method for high-throughput data streams, the method comprising the following processes: reception of high-throughput data streams, construction and release of bottom-level indexes, construction and release of top-level indexes, efficient storage of data streams and distributed indexes, query processing, cluster load balancing, and provision of high-concurrency near-real-time query services. The present invention proposes a distributed index structure and load balancing method for multi-source, high-throughput big data streams, which can realize the reception of multi-source, high-throughput big data streams, quickly construct indexes for massive data streams and efficiently store them, provide high-concurrency near-real-time query services, and achieve load balancing for each node in a distributed cluster.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to high-throughput data stream distributed storage, index construction and query technology, and to a load balancing method with high-throughput data stream as the background. Background Art

[0002] In recent years, streaming data has been widely used in various application scenarios such as the Internet, industrial Internet of Things, and personal health monitoring. Streaming data is an unordered sequence of data stream tuples (referred to as stream tuples), that is, data streams. The present invention involves distributed storage and query of data streams. The form of stream tuples is<stts,st> , where "stts" refers to the timestamp of the stream tuple, "st" refers to the specific content represented by the stream tuple, and involves the load balancing between distributed nodes in the distributed storage and query process of data streams.

[0003] Data streams are real-time, bursty, infinite, and volatile, making the real-time storage of data streams still a major problem for data stream management. At the same time, it is crucial to build a suitable index for the data stream to facilitate subsequent instant queries and in-depth analysis of massive data streams. Existing researchers have built bitmap indexes for heterogeneous data streams in sensor networks, but their application scenarios have certain limitations. Time window-based data stream management and analysis processing is one of the important application scenarios, such as high-speed train data streams. A high-speed train is equipped with more than one thousand sensors to monitor the running status of the train in real time. Its data stream is infinite, so it is necessary to store, manage, process and analyze the data in each time period. The present invention can handle the storage and query of data streams in this scenario.

[0004] In the context of multi-source, high-throughput data streams, a single machine cannot complete data stream reception, index construction, data storage, and real-time response to query requests, so the present invention proposes a solution for distributed scenarios and a cluster load balancing strategy. Load balancing means evenly distributing the load (work tasks) to multiple operating units to collaboratively complete the work tasks. Load balancing can be achieved through software or hardware, which are respectively called software load balancing and hardware load balancing. According to the location where load balancing is implemented, it can be divided into local load balancing and global load balancing to determine the range of servers covered by load balancing. The present invention can handle the load balancing of data stream receiving nodes, index construction nodes, data storage nodes, and query request response nodes in distributed scenarios. Summary of the invention

[0005] In response to the above problems, the present invention proposes a distributed index structure and load balancing method for multi-source, high-throughput big data streams, which can realize the reception of multi-source, high-throughput big data streams, quickly build indexes for massive data streams and efficiently store them, provide high-concurrency near-real-time query services, and achieve load balancing for each node in the distributed cluster.

[0006] The technical solution adopted by the present invention to solve its technical problem is:

[0007] A distributed index structure and load balancing method for high-throughput data streams, the method includes the following processes: receiving high-throughput data streams, building and publishing bottom-level indexes, building and publishing top-level indexes, efficient storage of data streams and distributed indexes, query processing, cluster load balancing, and providing high-concurrency near-real-time query services.

[0008] Furthermore, a two-layer distributed index structure is adopted. The bottom layer is a B+ tree index based on stream tuples, and the top layer is an index based on the time window of the data source.

[0009] Furthermore, the distributed cluster includes five types of nodes, namely, data stream receiving nodes, first-level coordination nodes, second-level coordination nodes, query nodes, and storage nodes. The data stream receiving nodes are responsible for receiving and sorting data streams; the first-level coordination nodes are responsible for load balancing of data stream receiving nodes, query nodes, storage nodes, and second-level coordination nodes, building and publishing top-level indexes, and publishing query requests; the second-level coordination nodes are responsible for receiving data stream pointers, building and distributing bottom-level indexes; the query nodes are responsible for the storage and query processing of bottom-level indexes and top-level indexes; and the storage nodes are responsible for persistent storage of data streams, bottom-level indexes, and top-level indexes.

[0010] Furthermore, the steps to build a distributed index include:

[0011] 1) According to the load balancing strategy, the designated data flow receiving node receives and caches the flow tuples in real time, and merges and sorts the flow tuples;

[0012] 2) The data flow receiving node publishes the data flow pointer to the secondary coordination node specified by the load balancing strategy;

[0013] 3) The secondary coordination node builds the underlying index and publishes it to the query node specified by the load balancing strategy;

[0014] 4) The first-level coordination node completes the insertion and construction of the top-level index according to the time and storage location corresponding to the locally stored bottom-level index, and distributes the top-level index to all query nodes in the form of broadcast;

[0015] 5) The data stream tuple is initially cached at the data stream receiving node. Under specific conditions, the data is migrated to the designated storage node. After the data migration is completed, the pointer to the stream tuple in the underlying index on the secondary coordination node and the query node is modified. The underlying index is initially cached at the query node. Under specific conditions, the underlying index is migrated to the designated storage node. After the underlying index migration is completed, the pointer to the root node of the underlying index in the top-level index on the first-level coordination node and the query node is modified.

[0016] The steps of streaming tuple query include:

[0017] 1) The first-level coordination node forwards the query request to the corresponding query node according to the load balancing strategy;

[0018] 2) The query node responds to the query request and uses the distributed index to locate the stream tuple. If the stream tuple does not exist, it returns directly; if it exists, it goes to the corresponding position of the node where the stream tuple is located to obtain the data and return it.

[0019] In order to improve the efficiency of distributed index construction and distribution, and the storage and processing capabilities of various nodes in the cluster are limited and cannot cope with the rapidly growing data stream application scenarios, the data stream and distributed index are initially cached in the data stream receiving node and the query node respectively. When the data stream flow rate is fast, the node memory is tight, and the node data processing capability is insufficient, data migration is triggered to migrate the data stream and distributed index from the data stream receiving node and the query node to the storage node.

[0020] In order to achieve load balancing of data stream receiving and sorting, load balancing of underlying index construction and publishing, load balancing of data stream and distributed index persistent storage, and load balancing of query processing, that is, to achieve load balancing between data stream receiving nodes, load balancing between secondary coordination nodes, load balancing between query nodes and load balancing between storage nodes, this scheme selects fourteen parameters of data stream receiving nodes as performance evaluation indicators, eleven parameters of secondary coordination nodes as performance evaluation indicators, nineteen parameters of query nodes as performance evaluation indicators, and thirteen parameters of storage nodes as performance evaluation indicators.

[0021] The steps of load balancing include:

[0022] 1) The first-level coordination node multiplies all parameter values ​​received from each node by the current parameter weight and sums them up to obtain the final weight values ​​of the data flow receiving node, the second-level coordination node, the query node and the storage node. The parameter weights are adapted through the hierarchical analysis method;

[0023] 2) The first-level coordination node constructs four hash rings based on the IP addresses of all data flow receiving nodes, second-level coordination nodes, query nodes and storage nodes with the help of KETAMA_HASH mapping function, and expands the virtual nodes according to the final weight value of the nodes;

[0024] 3) The first-level coordination node receives data stream reception requests, underlying index construction requests, query requests, and persistent storage requests, and maps them on the above four hash rings based on their IP addresses using the KETAMA_HASH mapping function. After the mapping is successful, it searches for the first low-load node clockwise along the hash ring to publish the task.

[0025] In a distributed cluster, the first-level coordination node maintains the information of all nodes. While achieving load balancing for various tasks, if it is found that any type of node in the cluster is overloaded, this type of node can be dynamically added. After adding the node, the first-level coordination node dynamically adjusts the load of the cluster of this type of node to enable this type of node to operate normally.

[0026] The beneficial effects of the present invention are mainly manifested in: realizing the reception of multi-source, high-throughput large data streams, quickly building indexes for massive data streams and efficiently storing them, providing high-concurrency near-real-time query services, and achieving load balancing for each node in a distributed cluster. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 It is a schematic diagram of the distributed index architecture and data flow diagram of the present invention;

[0028] Figure 2 It is a schematic diagram of the two-layer distributed index structure of the present invention;

[0029] Figure 3 is a schematic diagram of the bottom layer index structure in the two-layer index structure of the present invention;

[0030] Figure 4 is a schematic diagram of the top-level index structure in the two-level index structure of the present invention;

[0031] Figure 5 It is a node architecture diagram of the distributed index architecture of the present invention. DETAILED DESCRIPTION

[0032] The present invention will be further described below in conjunction with the accompanying drawings.

[0033] Reference Figure 1 to Figure 5, a distributed index structure and load balancing method for high-throughput data streams, adopts a two-layer distributed index structure, and the distributed cluster includes data stream receiving nodes, storage nodes, query nodes, first-level coordination nodes, and second-level coordination nodes. The data stream receiving node is responsible for receiving data streams, sorting data streams, publishing data stream pointers, and responding to data stream queries; the query node is responsible for the maintenance of two-layer distributed indexes and responding to data stream queries; the first-level coordination node is responsible for the load balancing of data stream receiving nodes, storage nodes, query nodes, and second-level coordination nodes in data stream acceptance, storage, and query; the second-level coordination node is responsible for the underlying index construction; the storage node is responsible for the persistent storage and query response of data streams and two-layer distributed indexes. Figure 1 shown.

[0034] The distributed indexing scheme adopts a two-layer distributed indexing structure. Its characteristics are: hierarchical construction, the bottom layer is the index based on stream tuples, and the top layer is the index based on data stream time windows. Figure 2 The following is a detailed description of each layer of index.

[0035] The underlying index is based on the content of the stream tuples in each time window of each data source, and uses a B+ tree index structure. The B+ tree supports both single-point and range queries. In the case of large amounts of data, the small height of the B+ tree can reduce the number of data access layers and reduce the query processing overhead. The stream tuples in a time window of a data source are constructed into an underlying B+ tree, as shown in the attached figure. Figure 3 As shown. The index items of the underlying B+ tree<key,ptr> The "key" value is the "key" value in the stream tuple, the "ptr" of the internal node points to the B+ tree child node, and the "ptr" of the leaf node points to the location where the stream tuple is stored in memory. In a distributed system, considering that the stream tuple and the underlying index are stored in different nodes, the "ptr" of the leaf node is represented by the IP address + memory address of the node where the stream tuple is located. This leads to excessive duplication of the "ptr" field of all leaf nodes in a single underlying B+ tree index, which wastes memory space, and it is inconvenient to update the "ptr" after the stream tuple is persisted (the "ptr" of all leaf nodes must be updated). The stream tuples of a single time window are stored continuously in the memory of a single node and sorted by "key", so a single underlying B+ tree maintains the "ip address" field and the "start address" field. The former records the IP address of the node where the corresponding data stream of the B+ tree is located, and the latter records the starting memory address of the continuously stored stream tuples. The "ptr" field of all leaf nodes only needs to record the offset of the corresponding stream tuple relative to the starting memory address, which saves memory overhead and is also easy to update.

[0036] The traditional B+ tree construction method has low construction efficiency because the nodes need to be continuously split, moved and merged, and cannot adapt to the infinity and high-speed flow characteristics of data flow. Therefore, the construction method of the bottom B+ tree index needs to improve throughput, reduce latency and complete it quickly according to the characteristics of data flow. The present invention adopts a B+ tree construction method based on multi-micro batch merge sorting and parallel loading to quickly construct a B+ tree. The method further slices a time window, sorts the flow tuples of each slice respectively, and finally adopts a merge method to complete the sorting of the flow tuples. While merging and sorting, the B+ tree structure parameters are calculated according to the number of flow tuples in the time window, and memory resources are uniformly applied according to the calculation results, and then the nodes are loaded in batches from bottom to top and from left to right in parallel. Finally, the merge sorting results are assigned to each node from bottom to top and from left to right in parallel, that is, the code values ​​are obtained from the child nodes or flow tuples and passed upward, thereby completing the construction of the bottom B+ tree index. After merge sorting, the maximum and minimum values ​​of the "key" value in the bottom B+ tree index are obtained for the construction of the top index.

[0037] The top-level index is a combination of a hash table and a linked list based on the bottom-level index. The single B+ tree of the bottom-level index is treated as a whole, that is, the top-level index is built for the time window. The time window comes from the data source and has a time attribute, so the top-level index includes a hash table based on the IP address of the data source and a hash table based on the time window timestamp. The top-level index structure is shown in the attached figure. Figure 4 The first-level hash table of the top-level index is a hash table based on the IP address of the data source. The hash function uses the KETAMA_HASH mapping function. The index items in the hash table are<key,ptr> The "key" in the table is the IP address of the data source, and "ptr" is the IP address + memory address of the node where the time-based hash table is located (based on distributed system considerations). The top-level index and the second-level hash table are hash tables based on time window timestamps. The hash function is the same as above. The index items in the hash table are<key,ptr> The "key" in the hash is the time window timestamp, and "ptr" is the IP address of the node where the linked list of all time windows under the hash bucket is built + the memory address of the first node of the linked list (based on distributed system considerations). In order to support single-point and range queries of time windows, the top-level index uses a linked list structure at the bottom layer to link the time windows in a bucket of hash. Index items in the linked list<key,ptr,min,max> The "key" represents the timestamp of the time window, "ptr" is the IP address of the node where the underlying index is located corresponding to a single time window + the memory address of the root node of the underlying index (based on distributed system considerations), and "min" and "max" represent the minimum and maximum values ​​of the "key" in the underlying index, which is convenient for filtering out some unnecessary queries during querying.

[0038] Cluster architecture: A distributed cluster includes data stream receiving nodes, storage nodes, query nodes, primary coordination nodes, and secondary coordination nodes. The entire cluster is a master-slave structure. The primary coordination node is equivalent to the master node in the cluster, monitoring all other nodes and coordinating all nodes in the cluster. Other nodes are equivalent to slave nodes, and other nodes complete their respective tasks through negotiation with the primary coordination node. The following is a detailed description of each type of node.

[0039] The data stream receiving node is responsible for receiving data streams and publishing data stream pointers. It mainly has the following functions:

[0040] (1) The load balancing evaluation parameter value of the current data flow receiving node is obtained every 20 seconds and sent to the first-level coordination node. This parameter is used by the external system to select the data flow receiving node for data flow reception;

[0041] (2) Receive data streams in real time, split the data streams according to time windows, and cache stream tuples;

[0042] (3) Merge and sort the stream tuples in the time window and quickly build data stream pointers;

[0043] (4) Send a "data stream is about to be sent" request to the first-level coordination node;

[0044] (5) receiving the secondary coordination node information from the primary coordination node, and then sending the data flow pointer to the selected secondary coordination node;

[0045] (6) The data stream receiving node is also responsible for responding to query requests for the data stream buffered on the node;

[0046] (7) The storage space of the data stream receiving node is limited. At the same time, in order to ensure the efficiency of data stream receiving and provide query services for cached data streams, part of the cached data stream will be transferred to the storage node.

[0047] The first-level coordination node is mainly responsible for load balancing of all nodes and building, updating, and publishing the top-level index. It has the following functions:

[0048] (1) Regularly receive the load evaluation parameters of the data flow receiving node, secondary coordination node, query node, and storage node;

[0049] (2) Selecting a data stream receiving node to process the data stream receiving request sent by the external system according to the load conditions of each data stream receiving node, and sending the information of the data stream receiving node to the external system. The specific data stream receiving node load evaluation parameters and load balancing algorithm are described below;

[0050] (3) Select a secondary coordination node to process the underlying index building request sent by the data stream receiving node according to the load conditions of each secondary coordination node, and send the information of the secondary coordination node to the data stream receiving node. The specific secondary coordination node load evaluation parameters and load balancing algorithm are described below.

[0051] (4) Select a query node to process the underlying index publishing request sent by the secondary coordination node according to the load conditions of each query node, and send the information of the query node to the secondary coordination node. The specific query node load evaluation parameters and load balancing algorithm are described below.

[0052] (5) Select a query node to process the query request sent by the external system according to the load of each query node, that is, distribute the query request to the designated query node. The specific query node load evaluation parameters and load balancing algorithm are detailed below;

[0053] (6) Select a storage node to process the data migration request from the data stream receiving node, the secondary coordination node, and the query node according to the load of each storage node, and publish the storage node information to the requesting node. The specific storage node load evaluation parameters and load balancing algorithm are described below.

[0054] (7) Update the top-level index according to the local storage information and broadcast the updated top-level index to all query nodes;

[0055] (8) The storage space of the first-level coordination node is limited. At the same time, in order to ensure the efficiency of load balancing, some index items in the third-level linked list of the cached top-level index will be transferred to the storage node.

[0056] The secondary coordination node is mainly responsible for the construction and release of the underlying index, and has the following functions:

[0057] (1) Obtain the load balancing evaluation parameter value of the current secondary coordination node every 20 seconds and send its load evaluation parameter to the primary coordination node;

[0058] (2) Receive the data stream pointer sent by the data stream receiving node to complete the construction of the underlying B+ tree index;

[0059] (3) Send a request to the first-level coordination node to obtain the target query node information published by the underlying index;

[0060] (4) The underlying index and its corresponding time window timestamp and data source identifier are published to the specified query node. Since a single underlying index will not be changed after it is built, the index nodes are stored continuously in memory, and the pointers between index nodes are converted to offsets relative to the root node. After receiving the offset, the query node can quickly reconstruct the underlying index.

[0061] The query node is mainly responsible for maintaining the top-level index and some bottom-level indexes and responding to query requests. It has the following functions:

[0062] (1) Obtain the load balancing evaluation parameter value of the current query node every 20 seconds and send its load evaluation parameter to the first-level coordination node;

[0063] (2) Receive the underlying index sent by the secondary coordination node, convert the offset of the index node back into a specific pointer, and complete the reconstruction of the underlying index;

[0064] (3) Receive the top-level index sent by the first-level coordination node, convert the offset of the index node back into a specific pointer, and complete the reconstruction of the top-level index. For each query node, the top-level index will be maintained, so that the query request can be queried downward no matter which node it falls on, thereby improving the query efficiency;

[0065] (4) Receive the query request, locate the node where the data is located based on the two-layer distributed index, request and obtain the data from the node, and return it to the query requester;

[0066] (5) Due to the limited storage space of the query node, part of the cached underlying index is transferred to the storage node under specific conditions. Therefore, the target storage node information for the migration of the underlying index is requested from the first-level coordination node, and the designated storage node is selected to migrate the underlying index based on the feedback from the first-level coordination node.

[0067] The storage node is responsible for the persistent storage of data stream tuples, bottom-level indexes, and top-level indexes, and has the following main functions:

[0068] (1) Obtain the load balancing evaluation parameter value of the current storage node every 20 seconds and send its load evaluation parameter to the first-level coordination node;

[0069] (2) Receive data streams migrated from data stream receiving nodes. Storage nodes can dynamically expand the number of nodes based on the continuous growth of data stream scale to provide massive data storage services. After data migration, update the IP address and stream tuple starting position corresponding to the underlying index;

[0070] (3) Receive some older nodes in the third-layer linked list of the top-level index migrated from the first-level coordination node, and update the pointer between the first-level coordination node and the persistence node to the IP address and node starting position of the corresponding storage node;

[0071] (4) Receive the bottom-level index migrated from the query node and update the top-level index to point to the bottom-level index of the storage node;

[0072] (5) Respond to query requests for stream tuple data, bottom-level indexes, and top-level indexes.

[0073] Index construction process, the steps of the distributed index construction method are mainly:

[0074] 1) The data stream receiving node sends the node evaluation parameters to the first-level coordination node regularly;

[0075] 2) The external system sends a request to the first-level coordination node, and the request content is the target data flow receiving node information. The first-level coordination node selects a data flow receiving node based on the load balancing parameters and algorithm and feeds back to the external system;

[0076] 3) After receiving the target data stream receiving node information, the external system publishes the data stream to the node;

[0077] 4) The secondary coordination node sends node evaluation parameters to the primary coordination node regularly;

[0078] 5) The data flow receiving node sends a request to the first-level coordination node, and the request content is the target second-level coordination node information. The first-level coordination node selects a second-level coordination node according to the load balancing parameters and algorithm and feeds it back to the data flow receiving node;

[0079] 6) After receiving the target secondary coordination node information, the data stream receiving node publishes the data stream pointer to the node. The data stream pointer content includes the primary key (IP address + time) + pointer (pointing to the starting storage location of the data stream);

[0080] 7) The secondary coordination node quickly builds the underlying index based on the data stream pointer using the batch B+ tree construction method mentioned above;

[0081] 8) The query node sends node evaluation parameters to the first-level coordination node regularly;

[0082] 9) The secondary coordination node sends a request to the primary coordination node, and the request content is the target query node information. The primary coordination node selects a query node based on the load balancing parameters and algorithm and feeds it back to the secondary coordination node;

[0083] 10) After receiving the target query node information, the secondary coordination node publishes the underlying index to the node;

[0084] 11) After receiving the underlying index information, the query node rebuilds the underlying index;

[0085] 12) The first-level coordination node updates the top-level index according to the starting timestamp and data source identifier corresponding to the bottom-level index: the query node performs the first hash based on the received data source identifier IP address, and then performs the second hash based on the data source identifier time, and then uses the time window start time as the "Key" and the corresponding bottom-level index root node address (IP address + memory address) as the "Value" and inserts it into the linked list head as the first node;

[0086] 13) The first-level coordination node broadcasts the top-level index to the query node;

[0087] 14) The external system sends a query request to the first-level coordination node;

[0088] 15) The first-level coordination node selects a query node to distribute the query request based on the load balancing parameters and algorithm;

[0089] 16) The storage node sends node evaluation parameters to the first-level coordination node regularly;

[0090] 17) The query node sends a request to the first-level coordination node, and the request content is the target storage node information. The first-level coordination node selects a storage node based on the load balancing parameters and algorithm and feeds it back to the query node;

[0091] 18) After receiving the target storage node information, the query node migrates the underlying index to the storage node;

[0092] 19) The data stream receiving node sends a request to the first-level coordination node, and the request content is the target storage node information. The first-level coordination node selects a storage node based on the load balancing parameters and algorithm and feeds it back to the data stream receiving node;

[0093] 20) After receiving the target storage node information, the data stream receiving node migrates the data stream to the storage node. At the same time, the storage node randomly selects a query node through the first-level coordination node, finds the underlying index corresponding to the data source time window according to the distributed index through the data source identifier and the starting time window, changes the IP address field corresponding to the underlying index to the IP address of the actual storage node, and changes the storage starting position field to the actual storage position of the stream tuple on the storage node. Then delete the stream tuple cached by the data stream receiving node;

[0094] 21) The first-level coordination node selects a storage node based on the load balancing parameters and algorithm and migrates the top-level index to the node.

[0095] Through the above twenty-one steps, the construction of the distributed index is completed.

[0096] The query process of distributed indexes mainly includes the following steps:

[0097] 1) After receiving the query request, the first-level coordination node selects a query node to receive and process the query request according to the load balancing algorithm for the query node;

[0098] 2) The query node receives the query request and searches the hash table based on the IP address of the current node for the top-level index of the data source according to the IP address. If the relevant IP address information is not found, the query request is sent to the storage node, the storage node is accessed to obtain the top-level index storing the IP address, and the top-level index is called back to the query node and cached locally, and step 2) is continued; if found, the hash table based on the time window timestamp is returned and step 3) is executed;

[0099] 3) Search the hash table based on the time window timestamp for the top-level index of the current node according to the query condition timestamp. If the relevant time period information is not found, send a query request to the storage node, access the storage node to obtain the top-level index storing the time period, and call the top-level index back to the query node and cache it locally, and continue to execute step 3); if found, return the linked list and execute step 4).

[0100] 4) Search the linked list in the top-level index of the current node according to the query condition timestamp. If the relevant node information of the linked list is not found, send a query request to the storage node, access the storage node to find the linked list node persisted to the storage node in the top-level index, and call it back and cache it in the query node, and continue to execute step 4); if found, combine the statistical information of the index leaf node, if the value to be queried is not within the range of the minimum and maximum values, do not continue to search the underlying index, and return a query failure message; if the queried value is within the range, return the IP address + starting memory address of the root node of the underlying index and execute step 5);

[0101] 5) Query the underlying index, calculate the offset of the corresponding stream tuple compared to the starting position, locate the storage location of the stream tuple to be found according to the IP address of the underlying index and the starting position of the corresponding stream tuple, and forward the request to obtain the stream tuple.

[0102] Through the above five steps, the query service provided by the system is completed.

[0103] Data storage strategy: The data storage strategy for data streams is suitable for data stream application scenarios with unlimited data scale and near real-time query requirements. The storage strategy adopted by this solution is to store distributed indexes and data streams in dynamically expandable clusters to solve the problem of efficient storage of massive data. The core idea is to separate the data stream from the distributed index and store them in different types of nodes. In order to improve the efficiency of index construction, the data stream is initially cached in the data stream receiving node, and data migration is triggered under specific conditions to migrate the stream tuples from the data stream receiving node to the storage node. The following two situations will trigger data migration:

[0104] I) After the data stream receiving node receives the data stream according to the time window, the stream tuple is temporarily stored in the data stream receiving node. When the memory occupied by the stream tuple cached by the data stream receiving node reaches a% of the node memory and the current data stream receiving rate is less than b, the data stream receiving node is considered to be relatively idle, and data migration is started to migrate the stream tuple to the storage node;

[0105] II) When the memory occupied by the stream tuples cached by the data flow receiving node reaches c% of the data flow receiving node's memory, it is determined that the memory of the data flow receiving node is in a tight state and the data should be migrated immediately; when the data flow receiving rate is greater than d during data migration, the data source that the node has connected to should be migrated to other idle data flow receiving nodes through the first-level coordination node to ensure that data migration does not affect the reception and data sorting of the data flow.

[0106] Since the memory of query nodes and first-level coordination nodes is limited and the data flow is infinite, the bottom-level index cached in the query node and the top-level index cached in the first-level coordination node will also trigger data migration under certain conditions, that is, the bottom-level index is migrated from the query node to the storage node, and the top-level index is migrated from the first-level coordination node to the storage node. In the above two cases, the index data is also migrated to the storage node.

[0107] Among them, the four parameters a, b, c and d should be uniformly configured according to the performance of the nodes in the cluster.

[0108] In order to achieve load balancing among data stream receiving nodes, load balancing among secondary coordination nodes, load balancing among query nodes, and load balancing among storage nodes, this scheme uses fourteen parameters as performance evaluation indicators of data stream receiving nodes, twelve parameters as performance evaluation indicators of secondary coordination nodes, nineteen parameters as performance evaluation indicators of query nodes, and thirteen parameters as performance evaluation indicators of storage nodes.

[0109] The evaluation indicators of query node load mainly include two dimensions: horizontal and vertical. The horizontal dimension refers to the evaluation indicators related to CPU, memory, disk I / O and network bandwidth, and the vertical dimension refers to the current query node availability and the expected usage in the next minute, as shown in Table 1.

[0110]

[0111]

[0112] Table 1

[0113] For the CPU of the query node, since the query frequency and query cost of the data stream, bottom index, and top index are different, the four CPU evaluation parameters for the query node are listed as follows. The CPU consumption of running other applications is not used as the load evaluation standard of the current node.

[0114] Query the evaluation index of the node CPU availability:

[0115] 1) NrCT: CPU idle rate of the current node.

[0116] Estimated evaluation indicators of the query node CPU usage in the next minute:

[0117] 1) NhCB: The estimated number of queries to the underlying index in the next minute, which is predicted by the least squares method and linear fitting based on the average number of queries in the previous ten minutes;

[0118] 2) NhCT: The estimated number of top-level index queries in the next minute, which is predicted by the least squares method and linear fitting based on the average number of queries in the previous ten minutes;

[0119] 3) NhCD: The estimated number of data stream queries in the next minute, which is predicted by the least squares method and linear fitting based on the average number of the previous ten minutes.

[0120] For the memory of the query node, since the amount of data in the data stream, bottom-level index, and top-level index affects the query frequency and query cost, the system pre-allocates the storage space for the data stream, bottom-level index, and top-level index. There are six evaluation indicators related to this.

[0121] Evaluation indicators for querying the available memory of a node:

[0122] 1) NrMB: the amount of available memory allocated to the underlying index;

[0123] 2) NrMT: the amount of available memory allocated to the top-level index;

[0124] 3) NrMD: The amount of available memory allocated to data streams.

[0125] Estimated evaluation indicators of query node memory usage in the next minute:

[0126] 1) NhMB: estimated memory usage of the underlying index in the next minute, which is predicted by the least squares method and linear fitting based on the average memory usage of the underlying index in the previous ten minutes;

[0127] 2) NhMT: estimated memory usage of the top-level index in the next minute, which is predicted by the least squares method and linear fitting based on the average memory usage of the top-level index in the previous ten minutes;

[0128] 3) NhMD: Estimated memory usage of Data in the next minute, which is predicted by the least squares method and linear fitting based on the average memory usage of the previous ten one-minute data flows.

[0129] There are four evaluation indicators for the disk I / O of the query node.

[0130] Query the evaluation index of node disk I / O availability:

[0131] 1) NrPS: Theoretically unused IOPS, using the theoretical total disk IOPS of the query node, that is, total IOPS - current actual IOPS = theoretically unused IOPS;

[0132] 2) NrTT: theoretically unused disk throughput, using the theoretical total disk throughput of the query node, that is, total throughput - current actual throughput = theoretically unused disk throughput.

[0133] Estimated evaluation indicators of the query node disk I / O usage in the next minute:

[0134] 1) NhPS: The estimated average IOPS for the next minute, which is obtained by using the least squares method and linear fitting prediction based on the average IOPS of the previous ten minutes;

[0135] 2) NhTT: Estimated average disk throughput for the next minute, which is predicted by the least squares method and linear fitting based on the average disk throughput of the previous ten minutes.

[0136] There are five evaluation indicators for the network bandwidth of the query node.

[0137] Evaluation indicators for querying node network bandwidth availability:

[0138] 1) NrNB: Theoretically unused network bandwidth, using the theoretical total network bandwidth of the query node, that is, total network bandwidth - current actual network traffic = theoretically unused network bandwidth.

[0139] The evaluation index of the estimated query node network bandwidth usage in the next minute:

[0140] 1) NhZB: The expected average network bandwidth throughput for the next minute, which is predicted by the least squares method and linear fitting based on the average network bandwidth throughput of the previous ten minutes;

[0141] 2) NhZJ: the average throughput of the network bandwidth used to receive the underlying index sent by the secondary coordination node in the next minute;

[0142] 3) NHZQ: The average throughput of network bandwidth used for migration of underlying indexes to storage nodes in the next minute;

[0143] 4) NHZT: The average time between the issuance of an I / O request and the receipt of a response in the past minute.

[0144] The evaluation indicators of the data flow receiving node load mainly include two dimensions: horizontal and vertical. The horizontal dimension refers to the evaluation indicators related to CPU, memory, disk I / O and network bandwidth, and the vertical dimension refers to the current available capacity of the data flow receiving node and the expected usage in the next minute, as shown in Table 2.

[0145]

[0146] Table 2

[0147] For the CPU of the data stream receiving node, the main tasks are data stream receiving, data stream sorting and responding to query requests. Therefore, the three evaluation parameters for the CPU of the data stream receiving node are listed as follows. The CPU consumption of running other applications is not used as the load evaluation standard of the current node.

[0148] Evaluation indicators of CPU availability of data stream receiving nodes:

[0149] 1) SrCT: CPU idle rate of the current node.

[0150] Estimated evaluation index of the CPU usage of the data flow receiving node in the next minute:

[0151] 1) ShCP: The estimated amount of data stream sorted in the next minute, which is predicted by the least square method and linear fitting based on the average amount of data sorted in the previous ten minutes;

[0152] 2) ShCD: The estimated number of data stream queries in the next minute, which is predicted by the least squares method and linear fitting based on the average number of queries in the previous ten minutes.

[0153] For the memory of the data stream receiving node, the system pre-allocates storage space for the data stream.

[0154] Evaluation indicators of available memory of data stream receiving nodes:

[0155] 1) SrMD: The amount of available memory allocated to the data stream. The amount of available memory = the amount of pre-allocated Data - the amount of Data memory used.

[0156] Estimated evaluation index of the memory usage of the data stream receiving node in the next minute:

[0157] 1) ShMD: Estimated memory usage of the data stream in the next minute, which is predicted by the least square method and linear fitting based on the average memory usage of the data streams in the previous ten minutes.

[0158] There are four evaluation indicators for the disk I / O of the data stream receiving node.

[0159] Evaluation indicators of disk I / O availability of data stream receiving nodes:

[0160] 1) SrPS: theoretically unused IOPS, total IOPS - current actual IOPS = theoretically unused IOPS;

[0161] 2) SrTT: theoretically unused disk throughput, calculated using the total throughput of the disks of the data stream receiving nodes in theory, that is, total throughput - current actual throughput = theoretically unused disk throughput.

[0162] Estimated evaluation index of disk I / O usage of data stream receiving node in the next minute:

[0163] 1) ShPS: The estimated average IOPS for the next minute, which is obtained by using the least squares method and linear fitting prediction based on the average IOPS of the previous ten minutes;

[0164] 2) ShTT: Estimated average disk throughput for the next minute, which is predicted by the least squares method and linear fitting based on the average disk throughput of the previous ten minutes.

[0165] There are five evaluation indicators for the network bandwidth of the data stream receiving node.

[0166] Evaluation indicators of available network bandwidth of data flow receiving nodes:

[0167] 1) SrSB: theoretically unused network bandwidth, calculated using the theoretical total network bandwidth of the data flow receiving node, that is, total network bandwidth - current actual network traffic = theoretically unused network bandwidth.

[0168] The evaluation index of the estimated network bandwidth usage of the data flow receiving node in the next minute:

[0169] 1) ShZB: the average throughput of the network bandwidth used to receive data streams in the next minute;

[0170] 2) ShZE: the average throughput of the network bandwidth used to send data flow information to the secondary coordination node in the next minute;

[0171] 3) SHZQ: the average throughput of network bandwidth used for data migration in the next minute;

[0172] 4) SHZT: The average time between the issuance of an I / O request and the receipt of a response in the past minute.

[0173] The average network bandwidth throughput for the next minute is predicted based on the average network bandwidth throughput for the previous ten minutes using the least squares method and linear fitting.

[0174] The evaluation indicators of the secondary coordination node load mainly include two dimensions: horizontal and vertical. The horizontal dimension refers to the evaluation indicators related to CPU, memory, disk I / O and network bandwidth, and the vertical dimension refers to the current availability of the secondary coordination node and the expected usage in the next minute, as shown in Table 3.

[0175]

[0176] Table 3

[0177] For the CPU of the secondary coordination node, if the CPU consumption of running other applications is not considered, there are two main evaluation indicators.

[0178] Evaluation indicators of CPU availability of secondary coordination nodes:

[0179] 1) ErCT: Current node CPU idle rate.

[0180] Estimated evaluation indicators of the CPU usage of the secondary coordination node in the next minute:

[0181] 1) EhCB: The estimated number of times the underlying index is constructed in the next minute, which is predicted by the least squares method and linear fitting based on the average number of times the underlying index is constructed in the previous ten minutes.

[0182] For the memory of the secondary coordination node, the system pre-allocates storage space for the underlying index.

[0183] Evaluation indicators of available memory of secondary coordination nodes:

[0184] 1) ErMB: The amount of free memory currently allocated to the underlying index.

[0185] Estimated evaluation indicators of the memory usage of the secondary coordination node in the next minute:

[0186] 1) EhMB: Estimated memory usage of the underlying index in the next minute, which is predicted by the least squares method and linear fitting based on the average memory usage of the underlying index in the previous ten minutes.

[0187] There are four evaluation indicators for the disk I / O of the secondary coordination node.

[0188] Evaluation indicators of disk I / O availability of secondary coordination nodes:

[0189] 1) ErPS: Theoretically unused IOPS, calculated using the theoretical total IOPS of the disk of the secondary coordination node, that is, total IOPS - current actual IOPS = theoretical unused IOPS;

[0190] 2) ErTT: theoretical unused disk throughput, calculated using the total throughput of the disks of the theoretical secondary coordination node, that is, total throughput - current actual throughput = theoretical unused disk throughput.

[0191] Estimated evaluation indicators of disk I / O usage of the secondary coordination node in the next minute:

[0192] 1) EhPS: The estimated average IOPS for the next minute, which is obtained by using the least squares method and linear fitting prediction based on the average IOPS of the previous ten minutes;

[0193] 2) EhTT: Estimated average disk throughput for the next minute, which is predicted by the least squares method and linear fitting based on the average disk throughput of the previous ten minutes.

[0194] The network bandwidth of the secondary coordination node is analyzed from the perspective of throughput and average response interval time, where throughput is subdivided into upstream and downstream throughput. The upstream throughput is used to receive the underlying index pointer + primary key from the data stream receiving node, and the downstream throughput is used to send the underlying index to the query node.

[0195] Evaluation indicators of available network bandwidth of secondary coordination nodes:

[0196] 1) ErZB: The theoretically unused network bandwidth, which is calculated using the theoretical total network bandwidth of the secondary coordination node, that is, the total network bandwidth - the current actual network traffic = the theoretically unused network bandwidth.

[0197] Estimated evaluation indicators of the network bandwidth usage of the secondary coordination node in the next minute:

[0198] 1) EhZS: The average network bandwidth throughput for sending the underlying index primary key + pointer in the next minute is expected, which is predicted by the least squares method and linear fitting based on the average network bandwidth throughput of the previous ten minutes;

[0199] 2) EhZR: The average network bandwidth throughput for receiving the underlying index primary key + pointer in the next minute, which is predicted by the least squares method and linear fitting based on the average network bandwidth throughput of the previous ten minutes;

[0200] 3) EhZT: The average time between the issuance of an I / O request and the receipt of a response in the past minute.

[0201] The evaluation indicators of storage node load mainly include two dimensions: horizontal and vertical. The horizontal dimension refers to the evaluation indicators related to CPU, memory, disk I / O and network bandwidth, and the vertical dimension refers to the current storage node availability and the expected usage in the next minute, as shown in Table 4.

[0202]

[0203]

[0204] Table 4

[0205] For the CPU of the storage node, the CPU consumption of running other applications is not used as the load evaluation standard indicator of the current node, including four evaluation indicators.

[0206] Evaluation indicators of storage node CPU availability:

[0207] 1) CrCT: current node CPU idle rate.

[0208] Estimated storage node CPU usage in the next minute

[0209] 1) ChCB: The estimated number of queries for the persistent underlying index in the next minute, which is predicted by the least squares method and linear fitting based on the average number of queries in the previous ten minutes;

[0210] 2) ChCT: The estimated number of queries for the persistent top-level index in the next minute, which is predicted by the least squares method and linear fitting based on the average number of queries in the previous ten minutes;

[0211] 3) ChCD: Estimated number of queries for the persistent data stream in the next minute, based on the average number of queries over the previous ten minutes using the least squares method and linear fitting.

[0212] There are four evaluation indicators for the disk I / O of storage nodes.

[0213] Evaluation indicators of storage node disk I / O availability:

[0214] 1) CrPS: theoretically unused IOPS, calculated using the theoretical total IOPS of the disk of the storage node. Total IOPS - current actual IOPS = theoretically unused IOPS;

[0215] 2) CrTT: theoretical unused disk throughput, calculated using the total throughput of the disks of the theoretical storage node. Total throughput - current actual throughput = theoretical unused disk throughput.

[0216] Estimated evaluation indicators of storage node disk I / O usage in the next minute:

[0217] 1) ChPS: The estimated average IOPS for the next minute, which is obtained by using the least squares method and linear fitting prediction based on the average IOPS of the previous ten minutes;

[0218] 2) ChTT: Estimated average disk throughput for the next minute, which is predicted by the least squares method and linear fitting based on the average disk throughput of the previous ten minutes.

[0219] There are five evaluation indicators for the network bandwidth of storage nodes.

[0220] Evaluation indicators of available storage node network bandwidth:

[0221] 1) CrZB: Theoretically unused network bandwidth, calculated using the theoretical total network bandwidth of the storage node. Total network bandwidth - current actual network traffic = theoretically unused network bandwidth.

[0222] Estimated evaluation indicators of storage node network bandwidth usage in the next minute:

[0223] 1) ChZQ: The average network bandwidth throughput is expected to be queried in the next minute, which is predicted by the least square method and linear fitting based on the average network bandwidth throughput of the previous ten minutes;

[0224] 2) ChZS: the average throughput of the network bandwidth expected to be used to receive data from the data flow receiving nodes in the next minute;

[0225] 3) CHZD: the average throughput of the network bandwidth used to receive the underlying index from the secondary coordination node in the next minute;

[0226] 4) CHZT: The average time between the issuance of an I / O request and the receipt of a response in the past minute.

[0227] The present invention proposes a load balancing algorithm, which is based on a dynamic feedback algorithm of the remaining service capacity and the prediction of the usage in the next minute, and truly achieves "making the best use of resources and load balancing". The specific load balancing algorithm process is as follows.

[0228] The load balancing process of underlying index allocation:

[0229] 1) The query node obtains the 19 load evaluation parameter values ​​of the current node every 20 seconds and sends them to the first-level coordination node;

[0230] 2) The linear weights of 19 parameters are obtained by the AHP method at the first-level coordination node;

[0231] 3) The first-level coordination node calculates the final weight value Ci of each query node based on the linear weights of the 19 parameters and the 19 load evaluation parameter values ​​published by each query node;

[0232] 4) The first-level coordination node uses the IPT data (consisting of IP address + time) of all query nodes as source data, and uses the KETAMA_HASH mapping function to build the hash ring Q, and expands the virtual node according to the final weight value of the query node;

[0233] 5) The first-level coordination node uses the underlying index IPT data (consisting of IP address + time) as the source data, and maps it on the hash ring Q with the help of the KETAMA_HASH mapping function;

[0234] 6) The underlying index finds the first virtual node in sequence on the hash ring Q and sends the underlying index to the corresponding query node.

[0235] Load balancing process of query request distribution:

[0236] 1) After receiving the query request, the first-level coordination node uses its IPT data (consisting of IP address + time) as the source data, and uses the KETAMA_HASH mapping function to map the query request on the hash ring Q;

[0237] 2) The query request finds the first virtual node in sequence on the hash ring Q and sends the query request to the corresponding query node.

[0238] Build the load balancing process for underlying indexing task allocation:

[0239] 1) The secondary coordination node obtains the 12 load evaluation parameter values ​​of the current node every 20 seconds and sends them to the primary coordination node;

[0240] 2) The linear weights of 12 parameters are obtained by the AHP method at the first-level coordination node;

[0241] 3) The first-level coordination node calculates the final weight value Xi of each second-level coordination node based on the linear weights of the 12 parameters and the 12 load evaluation parameter values ​​published by each second-level coordination node;

[0242] 4) The first-level coordination node uses the IPT data (consisting of IP address + time) of all second-level coordination nodes as source data, and uses the KETAMA_HASH mapping function to build a hash ring T, and expands the virtual node according to the final weight value of the second-level coordination node;

[0243] 5) The data stream receiving node sends a request for building a bottom-level index task assignment to the first-level coordination node, and the request includes the time and storage location corresponding to the bottom-level index of the current time window;

[0244] 6) The first-level coordination node uses the IPT data (consisting of IP address + time) of the index building task request as the source data, and maps it on the hash ring T with the help of the KETAMA_HASH mapping function;

[0245] 7) The index building task requests to sequentially find the first virtual node on the hash ring T and obtain the information of the secondary coordination node corresponding to the virtual node;

[0246] 8) The primary coordination node sends the calibrated secondary coordination node information to the data stream receiving node;

[0247] 9) The data stream receiving node publishes the data stream pointer of the current time window to the secondary coordination node.

[0248] The load balancing process of data stream, bottom-level index and top-level index migration to storage nodes:

[0249] 1) The storage node obtains the 13 load evaluation parameter values ​​of the current node every 20 seconds and sends them to the first-level coordination node;

[0250] 2) The linear weights of 13 parameters are obtained by the analytic hierarchy process at the first-level coordination node;

[0251] 3) The first-level coordination node calculates the final weight value Si of each storage node based on the linear weights of the 13 parameters and the 13 load evaluation parameter values ​​published by each storage node;

[0252] 4) The first-level coordination node uses the IPT data (consisting of IP address + time) of all storage nodes as source data, and uses the KETAMA_HASH mapping function to build a hash ring S, and expands the virtual node according to the final weight value of the storage node;

[0253] 5) The data stream receiving node sends a data stream data transfer request to the first-level coordination node, and the query node sends a bottom-level index data transfer request to the first-level coordination node. The requester and receiver of the top-level index transfer request are both first-level coordination nodes;

[0254] 6) The first-level coordination node uses the data stream, bottom index and top index transfer request as the source data with its IPT data (consisting of IP address + time), and maps it on the hash ring S with the help of KETAMA_HASH mapping function;

[0255] 7) The data stream, bottom index and top index transfer request sequentially find the first virtual node on the hash ring S and obtain the information of the storage node corresponding to the virtual node;

[0256] 8) The first-level coordination node publishes the calibrated storage node information to the requester;

[0257] 9) The requester transfers the data to the designated storage node. The data stream receiving node transfers the data stream, the query node transfers the bottom index, and the first-level coordination node transfers the top index.

[0258] Load balancing process of data flow reception:

[0259] 1) The data stream receiving node obtains the 14 load evaluation parameter values ​​of the current node every 20 seconds and sends them to the first-level coordination node;

[0260] 2) The linear weights of 14 parameters are obtained by the analytic hierarchy process at the first-level coordination node;

[0261] 3) The first-level coordination node calculates the final weight value Ri of each data flow receiving node based on the linear weights of the 14 parameters and the 14 load evaluation parameter values ​​published by each data flow receiving node;

[0262] 4) The first-level coordination node uses the IPT data (consisting of IP address + time) of all data flow receiving nodes as source data, and constructs the hash ring R with the help of the KETAMA_HASH mapping function, and expands the virtual node according to the final weight value of the data flow receiving node;

[0263] 5) The external system sends a request for data flow inflow task allocation to the first-level coordination node;

[0264] 6) The first-level coordination node uses the IPT data (consisting of IP address + time) of the data flow into the task allocation request as the source data, and maps it on the hash ring R with the help of the KETAMA_HASH mapping function;

[0265] 7) The data flow inflow task allocation request sequentially finds the first virtual node on the hash ring R and obtains the information of the data flow receiving node corresponding to the virtual node;

[0266] 8) The first-level coordination node publishes the calibrated data stream receiving node information to the external system;

[0267] 9) The external system publishes the data stream to the designated data stream receiving node.

[0268] The present invention proposes a scalability strategy for a distributed indexing solution. Scalability refers to the ability to dynamically increase the number of nodes to maintain stable operation of the system when the amount of data and the number of requests in a distributed system increase dramatically and the number of nodes in the current cluster cannot maintain the load. For large data stream application scenarios, cluster scalability is crucial.

[0269] In the solution designed by the present invention, the nodes in the cluster coordinate with each other but are not fully coupled, and all types of nodes can be horizontally expanded, so that the cluster has good scalability.

[0270] For data stream receiving nodes, when the data stream flows too fast and there is no time to send the data stream to the secondary coordination node, the network bandwidth occupied by data persistence exceeds the network bandwidth of all nodes in the cluster; when the query frequency of the data stream and the amount of data stream to be sorted exceed the load that the CPU of all nodes in the cluster can bear, the system cannot operate normally. At this time, you can dynamically add data stream receiving nodes to reduce the load of each node.

[0271] For storage nodes, when the number of queries for data streams, bottom-level indexes, and top-level indexes exceeds the CPU load that all storage nodes in the cluster can bear, and when the storage nodes used to query and receive data streams migrated by receiving nodes and the top-level indexes and bottom-level indexes migrated from the first-level coordination nodes and query nodes exceed the network bandwidth of all storage nodes in the cluster, storage nodes can be dynamically added to cope with massive data storage scenarios.

[0272] For query nodes, when the number of queries on data streams, underlying indexes, and top-level indexes exceeds the CPU load that all query nodes in the cluster can bear, and when the network bandwidth used by query nodes to respond to query requests, receive underlying indexes sent by secondary coordination nodes, and migrate underlying indexes to storage nodes exceeds the network bandwidth of all query nodes in the cluster, query nodes can be dynamically registered with the primary coordination nodes to increase the number of query nodes to cope with high-concurrency and massive query requests.

[0273] For the secondary coordination node, when the number of times the underlying index is built exceeds the CPU load that all nodes in the cluster can bear, and when the network bandwidth used by the secondary coordination node for receiving the underlying index primary key + pointer and publishing the underlying index primary key + pointer exceeds the network bandwidth of all query nodes in the cluster, a secondary coordination node is dynamically requested from the primary coordination node to meet the needs of the underlying index building task.

[0274] After the cluster is running normally by dynamically increasing or decreasing the nodes in the cluster, the first-level coordination node will start the load balancing strategy to balance the load within the cluster.

[0275] Taking high-speed train data as an example, the multi-source big data stream distributed indexing scheme of the present invention is further explained from three aspects: index construction, data storage and query response.

[0276] There are more than a thousand sensors installed on high-speed trains to monitor the running status of the trains at all times, and their data flow is infinite. Each train is a data collection unit, and its data flow is multi-source. The data flow conforms to<stts,st> The stream tuple form of "stts" indicates the timestamp of the train information record, and "st" mainly includes three contents: train attribute information, train current status information, and road condition information. Train status information includes real-time monitoring information such as temperature, speed, acceleration, pressure, insulation performance of key systems and parts, equipment status information on the train, personnel flow information, etc. Road condition information includes geographical location, geographical environment, weather conditions, etc. For high-speed train data, the train number can be used as the "key" and the hash index can be selected as the top-level index, as shown in the attached figure. Figure 4 shown.

[0277] The following is combined with Figure 1 , which explains the index building process.

[0278] The first step is to select a suitable time window to build the underlying index. Considering the data volume of the three main data information of the train, select a suitable time window size, taking 5 minutes as an example. As shown in the solid line with an arrow 3 in the figure, the data stream receiving node will cache all train data streams for 5 minutes, and separate the train data streams according to the train number. The secondary coordination node uses the train license plate information as the key value to build an underlying B+ index for the cached data within 5 minutes. Assume that the start time of the time window corresponding to the constructed underlying B+ tree index is 1140078443, and the corresponding train number is L1.

[0279] In the second step, as shown by the solid arrow line 9 in the figure, after the bottom-level index is built, the second-level coordination node applies to the first-level coordination node to publish the index. The first-level coordination node selects a query node, and the second-level coordination node publishes the bottom-level index to the query node. After the query node receives the bottom-level index, it queries the hash of the first layer based on the train number in the top-level index according to the train number L1. If there is an item with Key L1 in the top-level index, the linked list of the corresponding nodes of the second-level hash based on time is found according to the Value, and the index item with Key 1140078443 and Value as the root node address of the bottom-level index is inserted into the linked list; if there is no item with Key L1 in the hash ring of the first layer of the top-level index based on the train number, a new time-based hash index is created, and the index item with Key 1140078443 and Value as the root node address of the bottom-level index is inserted into the linked list, and the item with key L1 is added to the hash index of the first layer of the top-level index based on the train number, and finally the top-level index is updated synchronously on all query nodes.

[0280] In the third step, the train data stream with train number L1 and time window start time 1140078443 is initially cached in the data stream receiving node. When the data migration condition is triggered, the data stream receiving node will request data migration from the first-level coordination node, as shown by the dotted line with an arrow 16 in the figure. As shown by the solid line with an arrow 17 in the figure, the first-level coordination node selects a suitable storage node according to the load balancing strategy and migrates the data stream to the storage node. After the data migration is completed, the underlying index corresponding to the train number L1 and the time window start time 1140078443 is changed, and the data stream tuple cached by the data stream receiving node is deleted.

[0281] At this point, the distributed index for the high-speed train data stream has been built.

[0282] Assume that the user's query request is: the instantaneous speed of the train with train number a1 at time 1140078443. If the train number and time are correct, the instantaneous speed of the train is returned. Otherwise, if the train number does not exist, "this vehicle is not found" is returned. If the time does not exist, "the time information input is wrong" is returned. Figure 1 , describing the index query process.

[0283] The first step is the dotted arrow lines indicated by 11 and 12 in the figure. After receiving the query request, the first-level coordination node selects a query node using the load balancing strategy according to the load of the query node and forwards the query request to the query node.

[0284] In the second step, the query node uses the Key value a1 to query according to the first-level hash index based on the train number. If the query is not found, it directly returns that the vehicle is not found. If the query is found, it searches according to the second-level hash index based on time. If the time node is not within the current hash index time range, it directly returns that the time information input is wrong. Otherwise, it traverses the linked list to find the time window containing the time 1140078443, returns a pointer to the underlying index root node corresponding to the time window, and forwards the query to the specified query node according to the pointer of the Value value.

[0285] The third step is to search according to the corresponding underlying index. If there is no node with the key 1140078443, directly return the status information of the train at time 1140078443 that was not found. If found, send the query request to the corresponding data stream receiving node or storage node according to the corresponding pointer, obtain the instantaneous speed of the train numbered a1 at time 1140078443 and return it to the query user.

[0286] At this point, the complete response service for the user's query request is completed.

[0287] The above-mentioned implementation cases are only used to illustrate the present invention, and each step thereof may be changed. Any equivalent transformations and improvements based on the technical solution of the present invention should not be excluded from the protection scope of the present invention.

Claims

1. A distributed index structure and load balancing method for high-throughput data streams, characterized in that: The method The process includes: receiving high-throughput data streams, building and publishing bottom-level indexes, building and publishing top-level indexes, efficient storage of data streams and distributed indexes, query processing, cluster load balancing, and providing high-concurrency near-real-time query services; the distributed cluster includes five types of nodes: data stream receiving nodes, primary coordination nodes, secondary coordination nodes, query nodes, and storage nodes. The data stream receiving nodes are responsible for receiving and sorting data streams; the primary coordination nodes are responsible for load balancing of data stream receiving nodes, query nodes, storage nodes, and secondary coordination nodes, building and publishing top-level indexes, and publishing query requests; the secondary coordination nodes are responsible for receiving data stream pointers, building and distributing bottom-level indexes; the query nodes are responsible for storing bottom-level indexes and top-level indexes, and for query processing; The storage node is responsible for the persistent storage of data streams, bottom-level indexes, and top-level indexes; The steps to build a distributed index include: 1) According to the load balancing strategy, the designated data flow receiving node receives and caches the flow tuples in real time, and merges and sorts the flow tuples; 2) The data flow receiving node publishes the data flow pointer to the secondary coordination node specified by the load balancing strategy; 3) The secondary coordination node builds the underlying index and publishes it to the query node specified by the load balancing strategy; 4) The first-level coordination node completes the insertion and construction of the top-level index according to the time and storage location corresponding to the locally stored bottom-level index, and distributes the top-level index to all query nodes in the form of broadcast; 5) The data stream tuple is initially cached in the data stream receiving node. Under certain conditions, the data is migrated to the designated storage node. After the data migration is completed, the pointer to the stream tuple in the bottom index on the secondary coordination node and the query node is modified. The bottom index is initially cached in the query node. Under certain conditions, the bottom index is migrated to the designated storage node. After the bottom index migration is completed, the pointer to the bottom index root node in the top index on the first coordination node and the query node is modified; In order to achieve load balancing of data stream receiving and sorting, load balancing of underlying index construction and publishing, load balancing of data stream and distributed index persistent storage, and load balancing of query processing, that is, to achieve load balancing between data stream receiving nodes, load balancing between secondary coordination nodes, load balancing between query nodes, and load balancing between storage nodes, fourteen parameters of data stream receiving nodes are selected as performance evaluation indicators, eleven parameters of secondary coordination nodes are selected as performance evaluation indicators, nineteen parameters of query nodes are selected as performance evaluation indicators, and thirteen parameters of storage nodes are selected as performance evaluation indicators; The steps of load balancing include: 1) The first-level coordination node multiplies all parameter values ​​received from each node by the current parameter weight and sums them up to obtain the final weight values ​​of the data flow receiving node, the second-level coordination node, the query node and the storage node. The parameter weights are adapted through the hierarchical analysis method; 2) The first-level coordination node constructs four hash rings based on the IP addresses of all data flow receiving nodes, second-level coordination nodes, query nodes and storage nodes with the help of KETAMA_HASH mapping function, and expands the virtual nodes according to the final weight value of the nodes; 3) The first-level coordination node receives data stream reception requests, underlying index construction requests, query requests, and persistent storage requests, and maps them on the above four hash rings based on their IP addresses using the KETAMA_HASH mapping function. After the mapping is successful, it searches for the first low-load node clockwise along the hash ring to publish the task.

2. The distributed index structure and load balancing method for high-throughput data streams according to claim 1, characterized in that: A two-layer distributed index structure is adopted. The bottom layer is a B+ tree index based on stream tuples, and the top layer is an index based on the time window of the data source.

3. The distributed index structure and load balancing method for high-throughput data streams according to claim 1, characterized in that: The steps of streaming tuple query include: 1) The first-level coordination node forwards the query request to the corresponding query node according to the load balancing strategy; 2) The query node responds to the query request and uses the distributed index to locate the stream tuple. If the stream tuple does not exist, it returns directly; if it exists, it goes to the corresponding position of the node where the stream tuple is located to obtain the data and return it.

4. The distributed index structure and load balancing method for high-throughput data streams according to claim 1, characterized in that: In order to improve the efficiency of distributed index construction and distribution, and the storage and processing capabilities of various nodes in the cluster are limited and cannot cope with the rapidly growing data stream application scenarios, the data stream and distributed index are initially cached in the data stream receiving node and the query node respectively. When the data stream flow rate is fast, the node memory is tight, and the node data processing capability is insufficient, data migration is triggered to migrate the data stream and distributed index from the data stream receiving node and the query node to the storage node.

5. The distributed index structure and load balancing method for high-throughput data streams according to claim 1 or 2, characterized in that: In a distributed cluster, the first-level coordination node maintains the information of all nodes. While achieving load balancing for various tasks, if it is found that any type of node in the cluster is overloaded, this type of node can be dynamically added. After adding the node, the first-level coordination node dynamically adjusts the load of the cluster of this type of node to enable this type of node to operate normally.

Citation Information

Patent Citations

  • Distributed indexing method oriented to multi-source big data streams

    CN108920552A