Data query method and distributed data network
By using hierarchical transmission and filtering methods in distributed data networks, the problem of data query difficulties in distributed architectures is solved, and efficient query and cost reduction are achieved.
Patent Information
- Application Number
- CN202411471346.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2024-11-22
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Due to the high discreteness of data in distributed computing architecture, data search, query and analysis are difficult. Traditional methods require additional hardware equipment and system upgrades, resulting in high application costs and low query efficiency.
By introducing control nodes, hierarchical node groups and end nodes in the distributed data network, proxy nodes are used to perform hierarchical transmission and filtering of data query parameters, avoiding the centralized transmission and processing of large amounts of data and reducing the cost of data query.
It realizes efficient data query, avoids device updates and additional devices, reduces data query costs, improves query efficiency, and avoids network blockage.
Smart Images

Figure CN119003622A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data, and in particular to a data query method and a distributed data network. Background Art
[0002] With the development of digital technology, applications are gradually adopting distributed computing architecture, which has the advantages of scalability and high efficiency. Especially in edge computing scenarios, multiple server nodes form a node domain, and each node domain is responsible for independent data processing and storage, which effectively improves the processing efficiency of local data within each node domain. However, due to the highly discrete nature of data, the distributed architecture also has problems such as difficulty in data search, query, and analysis.
[0003] In traditional technology, data query and analysis are often achieved by centrally collecting and storing data from discrete nodes. However, due to the huge amount of data collected, this method requires the addition of additional hardware equipment, such as storage devices, and also requires the updating and upgrading of servers and network infrastructure equipment to adapt to the analysis and processing capabilities of large amounts of data, resulting in high application costs. Summary of the invention
[0004] In view of the above-mentioned defects or deficiencies in the prior art, it is desirable to provide a data query method and a distributed data network, which can reduce the data query cost of an application.
[0005] In a first aspect, the present application provides a method. Applied to a distributed data network, the distributed data network includes a control node, at least one node group arranged in a hierarchy, and an end node, each node group includes at least one proxy node, the method comprising: The control node receives a data request from a client, generates a data query parameter according to the single-page data volume carried in the data request, and sends the data query parameter to the proxy node; the data volume represented by the data query parameter is greater than the single-page data volume; The proxy node sends data query parameters to the child node until the end node receives the data query parameters and receives the response data sent by the child node; the response data is obtained according to the data query parameters; The proxy node filters the local response data of the proxy node and the received response data according to the data query parameters, and sends the filtering results to the parent node of the proxy node until the control node receives the filtering results sent by the child node of the control node; The control node determines the paging data to be displayed based on the single-page data volume and the received screening result, and sends a response message to the client, where the response message carries the paging data to be displayed.
[0006] In combination with the first aspect, in a possible implementation, the client's data request also includes data query conditions and query time; the data query parameters include target data volume, data query conditions and query time; the target data volume is greater than the data volume of a single page.
[0007] In combination with the first aspect, in a possible implementation manner, the data request of the client further includes a page turning type; the page turning type includes at least one of a first page, a next page, a previous page, and a page number of a page to be displayed.
[0008] In combination with the first aspect, in a possible implementation method, the control node determines the paging data to be displayed based on the single-page data volume and the received filtering results, including: splitting all filtering results according to the single-page data volume, determining the number of pages for paging display of all filtering results, and the data corresponding to each page; sending the first page data and the page number to the client.
[0009] In combination with the first aspect, in a possible implementation method, the control node determines the paging data to be displayed based on the single-page data volume and the received filtering results, including: splitting all the filtering results according to the single-page data volume, determining the number of pages for the paging display of all the filtering results, and the data corresponding to each page; determining the paging to be displayed according to the paging type and the currently displayed paging, and obtaining the data of the paging to be displayed according to the data corresponding to each page.
[0010] In combination with the first aspect, in a possible implementation method, the control node determines the paging data to be displayed based on the single-page data volume and the received filtering results, including: sorting each filtering result in the order of the data generation time from the query time to the nearest time; selecting the top N data from the sorted results as the paging data to be displayed according to the single-page data volume; N is the number representing the single-page data volume.
[0011] In combination with the first aspect, in a possible implementation manner, the data query parameter further includes a query time condition, and the query time condition is used to limit the display data of a page corresponding to the page turning type based on the data generation time.
[0012] In combination with the first aspect, in a possible implementation method, when the page turning type is the first page, the query time condition is that the data generation time is less than the query time; when the page turning type is the next page, the query time condition is that the data generation time is less than the data generation time of the first target data in the current page display data; when the page turning type is the previous page, the query time condition is that the data generation time is greater than the data generation time of the second target data in the current page display data; the first target data is the current page display data that is ranked first after sorting each current page display data in order from the data generation time to the query time; the second target data is the current page display data that is ranked first after sorting each current page display data in order from the data generation time to the query time.
[0013] In combination with the first aspect, in a possible implementation method, the proxy node screens the local response data of the proxy node and the received response data according to the data query parameters, including: querying the local data of the proxy node for data that meets the data query conditions and whose data generation time meets the query time conditions, to obtain the local response data of the proxy node; sorting the local response data of the proxy node and the received response data in order from the data generation time to the query time; selecting the top M data from the sorting results according to the target data volume, and sending them to the parent node of the proxy node; M is the number representing the target data volume, and M is an integer greater than N.
[0014] In a second aspect, the present application further provides a distributed data network, the distributed data network comprising a control node, at least one node group arranged in a hierarchy, and an end node, each node group comprising at least one proxy node, The control node is used to receive a data request from a client, generate a data query parameter according to the single-page data volume carried in the data request, and send the data query parameter to the proxy node; the data volume represented by the data query parameter is greater than the single-page data volume; The proxy node is used to send data query parameters to the child nodes until the end node receives the data query parameters and receives the response data sent by the child nodes; the local response data of the proxy node and the received response data are filtered according to the data query parameters, and the filtering results are sent to the parent node of the proxy node until the control node receives the filtering results sent by the child nodes of the control node; the response data is obtained according to the data query parameters; The control node is further used to determine the paging data to be displayed based on the single-page data volume and the received screening result, and send a response message to the client, where the response message carries the paging data to be displayed.
[0015] The embodiment of the present application provides a data query method and a distributed data network, wherein the distributed data network includes a control node and at least one node group and an end node set in a hierarchical manner, and each node group includes at least one proxy node. After the control node generates data query parameters according to the amount of single-page data carried by the data request sent by the client, the data query parameters are sent to each proxy node and the end node by hierarchical transmission. The proxy node queries the local data according to the data layer query parameters, obtains local response data, and receives the response data sent by the child node at the same time. Then the proxy node filters the local response data and the received response data, and sends the screening results to the parent node of the proxy node. The proxy nodes at each level perform the above query and screening process in turn until the control node receives the screening results sent by the child node of the control node. Finally, the control node determines the paging data to be displayed based on the amount of single-page data and the received screening results, and sends a response message carrying the paging data to be displayed to the client. The data query method provided in the embodiment of the present application constructs a distributed data network, and transmits the response data obtained by each node in response to the user's data request query to the control node in a hierarchical manner. In each level of transmission, the response data of at least one node is screened, and the transmission and screening of a large amount of data are distributed on the proxy nodes at each level, thereby avoiding the centralized transmission and processing of a large amount of data and ensuring the efficiency of data query. The amount of data transmitted to the control node after hierarchical screening is small, thereby avoiding the concentration of a large amount of data processing on the control node, thereby avoiding the update and upgrade of equipment and the addition of additional equipment, and realizing efficient data query at the software level, effectively reducing the cost of data query. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings: Figure 1 is an architectural diagram of a distributed data network in one embodiment; Figure 2 is another architecture diagram of a distributed data network in one embodiment; Figure 3 A schematic diagram of a flow chart of a data query method in an embodiment; Figure 4 A schematic diagram of paging display of a data query method in an embodiment; Figure 5 Another schematic diagram of paging display of a data query method in one embodiment; Figure 6 Another schematic diagram of a data query method in one embodiment; Figure 7 Another schematic diagram of a data query method in one embodiment; Figure 8 Another schematic diagram of a data query method in one embodiment; Fig. 9 FIG. 4 is another flowchart of a data query method in an embodiment. DETAILED DESCRIPTION
[0017] The present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the invention are shown in the accompanying drawings.
[0018] It should be noted that, in the absence of conflict, the embodiments in the present application and the features in the embodiments can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments. In addition, the term "and / or" herein is merely a description of the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The terms "first" and "second" in the description and claims of the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order of objects.
[0019] With the development of digital technology, applications are gradually adopting distributed computing architecture, which has the advantages of scalability and high efficiency. Especially in edge computing scenarios, multiple server nodes form a node domain, and each node domain is responsible for independent data processing and storage, which effectively improves the processing efficiency of local data within each node domain. However, due to the highly discrete nature of data, the distributed architecture also has problems such as difficulty in data search, query, and analysis.
[0020] In traditional technology, data monitoring components (such as Prometheus, exporter, etc.) are often used to centrally collect and store data from discrete nodes, and then query and analyze the collected data. However, due to the huge amount of collected data, this method requires an overall transformation of the existing system architecture and the addition of additional hardware equipment, such as storage devices. It also requires updating and upgrading servers and network infrastructure to adapt to the analysis and processing capabilities of large amounts of data, resulting in high application costs.
[0021] In the paging query scenario, after the data of discrete nodes are centrally collected, the data query method that uniformly sorts and paging is performed on the central server has problems of slow response and network congestion due to the centralized transmission, overall sorting, and searching of a large amount of data. In addition, the sorting and searching of all data are concentrated on the central server, which leads to high computing pressure on the central server and waste of computing resources.
[0022] Based on this, the embodiments of the present application provide a data query method and a distributed data network, which can realize efficient data query at the software level, avoid equipment updates and upgrades and the addition of additional equipment, thereby effectively reducing data query costs.
[0023] like Figure 1 As shown, the distributed data network includes a control node 10 , at least one node group 20 arranged in a hierarchy, and an end node 30 , and each node group 20 includes at least one proxy node 21 .
[0024] The construction process of the distributed data network can be as follows: The control node 10 may first construct a distributed data network according to the identifiers of each service node. Specifically, all or part of the service nodes of the application may be grouped, and one service node is selected from each group of service nodes as the proxy node 21. Then, the multiple proxy nodes 21 selected from the multiple groups of service nodes form a node group 20 corresponding to a level (e.g., level 1); Among them, the relevant node data of the grouped service nodes in the same group can be recorded in a list, which may include the node identification, address and other information. For example, it can be recorded as the following fields: [{node_name:node1-1, node_ip:192.101.1.1}, {node_name:node1-2, node_ip:192.101.1.2}, {node_name:node2-5, node_ip:192.102.1.5}, {node_name:node3-1, node_ip:192.103.1.1},…, {node_name:node976-2057, node_ip:202.101.200.57].
[0025] Then, for each group of service nodes, the remaining service nodes in the group of service nodes except the proxy node 21 are grouped again. For each group of service nodes after regrouping, one of the service nodes is selected as the proxy node 21 (which can be called a level 2 node) of the group of service nodes, and the remaining service nodes are grouped again until each group of service nodes after regrouping includes only one service node, namely, the end node 30, and the distributed data network is constructed.
[0026] The following is an example of an application including 1000 service nodes: the control node 10 first divides the 1000 service nodes into 10 groups, each group may include 100 service nodes (the number of service nodes in each group may also be different), and for each group of service nodes, one is selected from the 100 service nodes as the proxy node 21, then the 10 proxy nodes 21 (for example, 1-1, 1-2, ..., 1-10) form a node group 20, which can be called a first-level node group 20, and the proxy node 21 in the first-level node group 20 can be called a first-level proxy node; then, for each group of service nodes, the remaining 99 service nodes except the proxy node 21 are selected as the proxy node 21. The nodes are grouped again and can be divided into 10 groups, of which 9 groups include 10 service nodes and the last group includes 9 service nodes; for each group of service nodes, one is selected as the proxy node 21, then 10 proxy nodes 21 (for example, 2-1-1, 2-1-2, ..., 2-1-10) form a second-level node group 20, and the proxy node 21 in the second-level node group can be called a second-level proxy node; finally, for each group of service nodes, the remaining 9 or 8 service nodes except the proxy node 21 are grouped again and can be divided into 9 or 8 groups, each group includes 1 service node, namely, the end node 30, and the distributed data network is constructed.
[0027] It can be understood that the proxy node 21 has a parent node and a child node, and the end node 30 has only a parent node. The proxy node 21 and the end node 30 constitute all or part of the service nodes of the application.
[0028] It should be noted that the above-mentioned grouping identifier abc for the proxy node, wherein a represents the grouping level of the proxy node 21, b represents the serial number of the parent node of the proxy node 21 in the grouped node group 20, and c represents the serial number of the proxy node in the grouped node group 20.
[0029] In one possible implementation, Figure 2 As shown, the control node 10 can be a management platform for the application, interacting with the client. The control node 10 can build a distributed data network based on some service nodes of the application. For example, service nodes such as node2-5, node2-7, node2-8, node2-9, node10-72, node976-2058 do not participate in the construction of the distributed data network. When the control node 10 groups the service nodes, it can be grouped based on the geographical location of the nodes, for example, nodes in the same region are grouped together, or it can be grouped based on other characteristics of the nodes, which is not limited in this application.
[0030] In addition, when the control node 10 groups the service nodes, it can construct threads with the same number according to the number of groups, so that multi-threaded data can be transmitted simultaneously, thereby improving data query efficiency.
[0031] The distributed data network can be pre-built by the control node 10. After the control node 10 receives the data request sent by the client, it can directly perform data query based on the pre-built distributed network; or the control node 10 receives the data request from the client, analyzes the data request, selects some service nodes based on the user's query requirements and builds it to improve the accuracy of the query.
[0032] Based on the above distributed data network, the data query method includes: Figure 3 Steps shown: Step 101 : The control node 10 receives a data request from a client, generates a data query parameter according to the single-page data volume carried in the data request, and sends the data query parameter to the proxy node 21 .
[0033] In an embodiment of the present application, data can be exchanged between the control node 10 and the client in the distributed data network. The control node 10 can receive a data request from the client. The data request carries the single-page data volume, that is, the amount of data displayed on a single page of the client. For example, if the client displays 20 data items on a single page, the single-page data volume is 20.
[0034] After receiving the data request, the control node 10 can analyze the data request, generate data query parameters according to the analysis results, and send the data query parameters to the proxy node 21, so that each proxy node 21 and the end node 30 can query the data that meets the user data request instruction based on the data query parameters.
[0035] When the control node 10 sends data query parameters, it can first send the data query parameters to the child node of the control node 10, that is, the level 1 proxy node; then, the level 1 proxy node sends the data query parameters to its own child node, that is, the level 2 proxy node, until the data query parameters are transmitted to the end node 30 through hierarchical sending.
[0036] The single-page data volume may be manually set by the user on the client, or may be determined by the client based on its own display parameters (eg, screen size, font size, etc.).
[0037] The amount of data represented by the data query parameter is greater than the amount of data on a single page. For example, the amount of data represented by the data query parameter may be 21, that is, each proxy node 21 or terminal node 30 may obtain 21 pieces of data that meet the user data request instruction during the data query process.
[0038] Step 102: The proxy node 21 sends data query parameters to the child node until the end node 30 receives the data query parameters and receives response data sent by the child node.
[0039] In the embodiment of the present application, after the data query parameter is passed to the end node 30, the end node 30 can query in the local data according to the data query parameter, and obtain multiple data that meet the user's data request instruction, that is, obtain multiple data that meet the user's needs. Then, the end node 30 can filter and process the queried data based on the amount of data represented by the data query parameter, and send the filtered data to the parent node of the end node 30, that is, the upper-level proxy node 21 of the end node 30, so that the proxy node 21 receives the data sent by the child node, which is the response data of the end node 30, that is, the data finally obtained after the end node 30 responds to the client's data request and queries the local data according to the data query parameter.
[0040] It can be understood that the end node 30 can first compare the amount of data queried with the amount of data represented by the data query parameter. If the amount of data queried does not reach the amount of data represented by the data query parameter, the queried data is the response data, and all the queried data is directly sent to the parent node; if the amount of data queried is greater than the amount of data represented by the data query parameter, the queried data is filtered until the amount of data after filtering reaches the amount of data represented by the data query parameter, and the filtered data is the response data, and the filtered data is sent to the parent node. That is, the amount of data sent by the end node 30 to the upper-level proxy node 21 is less than or equal to the amount of data represented by the data query parameter.
[0041] For example, if the end node 30 finds 15 pieces of data based on the data query parameter, all 15 pieces of data are sent to the parent node; if the end node 30 finds 30 pieces of data based on the data query parameter, 21 pieces of data are filtered out and sent to the parent node. That is, the amount of data sent by the end node 30 to the upper-level proxy node 21 is in the range of 0 to 21.
[0042] Step 103 , the proxy node 21 filters the local response data of the proxy node 21 and the received response data according to the data query parameters, and sends the filtering result to the parent node of the proxy node 21 , until the control node 10 receives the filtering result sent by the child node of the control node 10 .
[0043] In the embodiment of the present application, for the upper proxy node 21 of the terminal node 30, according to the data query method of the above-mentioned terminal node 30, the local data stored in the local database (such as the relational database sqlite3) of the proxy node 21 is queried according to the data query parameters to obtain the local response data of the proxy node 21. Then, the proxy node 21 determines the local response data and the total amount of response data received from each terminal node 30, and compares the total amount of data with the amount of data represented by the data query parameters. When the total amount of data reaches the amount of data represented by the data query parameters, all data are directly sent to the upper proxy node 21 of the proxy node 21; if the total amount of data exceeds the amount of data represented by the data query parameters, the local response data and the received response data are filtered, and the amount of data after filtering is equal to the amount of data represented by the data query parameters. Finally, the proxy node 21 sends the filtered data to the upper proxy node 21.
[0044] It can be understood that for each proxy node 21, after receiving the data query parameters, it queries the local data according to the data query parameters to obtain local response data; then, it filters the local response data and the response data received from the child node, and sends the filtered data to the upper-level proxy node 21.
[0045] That is, each node responds to the client's data request, and the local response data obtained according to the data query parameter query is transmitted and filtered in sequence through the proxy nodes 21 at each level of the distributed data network until the control node 10 receives the filtering results sent by each child node of the control node 10, and the response data of each node to the data request is then transmitted to the control node 10.
[0046] The proxy node 21 can temporarily store the local response data and the received response data in the form of a list, for example, using the op_audit table for storage, which can also include various related information of the data, such as data generation time, data type, etc., which can be specifically recorded through fields such as op_time, op_type, and op_source.
[0047] Step 104 : The control node 10 determines the paging data to be displayed based on the single-page data volume and the received screening result, and sends a response message to the client, where the response message carries the paging data to be displayed.
[0048] In an embodiment of the present application, after the control node 10 receives the data sent by each child node (i.e., the received filtering results), the received data can be filtered according to the single-page data volume of the client. The filtered data volume is the single-page data volume. The filtered data of the control node 10 is used as the paging data to be displayed, and a response message is generated based on the paging data to be displayed and sent to the client to instruct the client to display the paging data to be displayed.
[0049] In a possible implementation, the control node 10 may compare the amount of data received from each subnode and the amount of data on a single page, and determine the viewing status of the adjacent page according to the comparison result. Figure 4 As shown, the control node 10 receives a total of 210 pieces of data from 10 child nodes, which is greater than the single-page data volume of 20. Therefore, 20 pieces of data are screened out from the 210 pieces of data, and it is determined that the next page of data can be queried. The control node 10 generates a response message based on the screened 20 pieces of data and the viewing state parameter of the next page that can be queried, and sends it to the client, instructing the client to display the above 20 pieces of data, and at the same time sets the next page button of the display interface to a clickable state.
[0050] In one possible implementation, Figure 5 As shown, the control node 10 divides the received data of each sub-node according to the amount of single-page data, determines the number of pages for paging the received data of each sub-node, and the data corresponding to each page. Then, the control node 10 determines the paging data to be displayed from the data corresponding to each page, generates a response message based on the paging data to be displayed and the number of pages, and sends it to the client.
[0051] The data query method provided in the embodiment of the present application is applied to a distributed data network, which includes a control node and at least one node group and an end node set in a hierarchical manner, and each node group includes at least one proxy node. After the control node generates data query parameters according to the single-page data volume carried by the data request sent by the client, the data query parameters are sent to each proxy node and the end node by hierarchical transmission. The proxy node queries the local data according to the data layer query parameters, obtains local response data, and receives the response data sent by the child node at the same time. Then the proxy node filters the local response data and the received response data, and sends the screening results to the parent node of the proxy node. The proxy nodes at each level perform the above query and screening process in turn until the control node receives the screening results sent by the child node of the control node. Finally, the control node determines the paging data to be displayed based on the single-page data volume and the received screening results, and sends a response message carrying the paging data to be displayed to the client. The data query method provided in the embodiment of the present application constructs a distributed data network, and transmits the response data obtained by each node in response to the user's data request to the control node, and the response data of at least one node is screened during each level of transmission, and the transmission and screening of a large amount of data are distributed on the proxy nodes at each level, thereby avoiding the centralized transmission and processing of a large amount of data and ensuring the efficiency of data query; the amount of data transmitted to the control node after the hierarchical screening process is small, avoiding the concentration of a large amount of data processing on the control node, thereby avoiding the update and upgrade of equipment and the addition of additional equipment, and realizing efficient data query at the software level, effectively reducing the cost of data query. The distributed processing of data by proxy nodes at each level can also avoid network congestion and further improve the efficiency of data query.
[0052] In one embodiment, the data request of the client may include data query conditions and query time in addition to the single-page data volume. Accordingly, the control node 10 generates a target data volume (i.e., the data volume represented by the data query parameters described above) greater than the single-page data volume based on the single-page data volume, so that the data query parameters may include the target data volume, data query conditions, and query time.
[0053] Furthermore, the data request of the client may also include a page turning type; the page turning type includes at least one of the first page, next page, previous page, and page number of the to-be-displayed page, which is used to indicate the page number data that the user wants to view.
[0054] The above-mentioned embodiment provides a scheme for the control node to determine the paging data to be displayed according to the single-page data volume and the screening results sent by the received child nodes. In another embodiment of the present application, all the screened data received by the control node can be directly displayed in pages, that is, as above Figure 5In this case, the control node performs different paging data determination processes based on the home page and non-home page.
[0055] When a user performs a data query on the client and views the query results (i.e., the home page data) for the first time, the embodiment includes the following steps: Figure 6 Steps shown: Step 201: split all the screening results according to the amount of data on a single page, determine the number of pages for displaying all the screening results in pages, and determine the data corresponding to each page.
[0056] Step 202: Send the first page data and the page number to the client.
[0057] In the embodiment of the present application, after receiving the screening results sent by each child node, the control node 10 can first sort all the screening results. Specifically, the similarity between each data in the screening results and the data query condition can be determined, and then the query results can be sorted in order from high to low similarity; or the data generation time can be sorted in order from near to far from the query time.
[0058] Next, the control node 10 splits the sorted filtering results in turn, and the data size of each split data is the data size of a single page. During the splitting process, each split data is marked with a page number in turn until the data size of the last split data is less than or equal to the data size of a single page. The splitting of the filtering results is completed, and the page number of the last split data is the number of pages displayed in pages for all the filtering results.
[0059] Finally, the control node 10 generates a response message based on the first split data, that is, the first page data and the number of pages, and sends it to the client to instruct the client to Figure 5 The figure shows the data of the first page and the page number labels.
[0060] When the user continues to view data on other pages (except the home page), the paging data determination process includes the following: Figure 7 Steps shown: Step 301: split all the screening results according to the amount of data on a single page, determine the number of pages for displaying all the screening results in pages, and determine the data corresponding to each page.
[0061] Step 302: determine the page to be displayed according to the page turning type and the currently displayed page, and obtain the data of the page to be displayed according to the data corresponding to each page.
[0062] In the embodiment of the present application, all the screening results are split according to the above embodiment, and after obtaining the data and page number corresponding to each page, the page to be displayed is determined according to the page turning type in the data request and the current displayed page. For example, if the current displayed page is page 1 and the page turning type is next page, the page to be displayed is page 2; if the current displayed page is page 5 and the page turning type is previous page, the page to be displayed is page 4.
[0063] The page to be displayed may also be directly determined according to the page turning type in the data request. For example, if the page turning type is page number 3, it means that the user needs to view the third page of data, so the page to be displayed is directly determined to be page 3.
[0064] After determining the paging to be displayed, the data of the paging to be displayed is determined according to the data corresponding to each paging recorded when the data is split, and a response message is generated based on the data of the paging to be displayed and sent to the client to instruct the client to display the data of the paging to be displayed.
[0065] In the method provided in the embodiment of the present application, the control node of the distributed data network splits all the screening results sent by the child nodes according to the amount of single-page data, determines the number of pages displayed for all the screening results in pages, and the data corresponding to each page. Then, the data and the number of pages of the first page are sent to the client, or the page to be displayed is determined according to the page turning type and the currently displayed page, and the data of the page to be displayed is obtained according to the data corresponding to each page. In the embodiment of the present application, each node responds to the user's data request query and transmits the response data to the control node after hierarchical screening. The data finally transmitted to the control node ensures validity while effectively reducing the amount of data, avoiding the concentration of a large amount of data processing processes on the control node, thereby avoiding the update and upgrade of equipment and the addition of additional equipment, and realizing efficient data query at the software level, effectively reducing the cost of data query.
[0066] The above-mentioned embodiment provides a scheme for the control node to determine the paging data to be displayed according to the amount of single-page data and the screening results sent by the received child nodes. In another embodiment of the present application, a data query only obtains the data that the user currently needs to view. When the user views other pages of data, the query is performed again based on the distributed data network to ensure the accuracy of the data query results. That is, the embodiment of the present application implements the above Figure 4 The paging display method shown in the embodiment includes the following Figure 8 Steps shown: Step 401 , sort the screening results in order of the distance from the data generation time to the query time from the nearest to the farthest.
[0067] Step 402: Select the top N data from the sorting results according to the amount of data on a single page as the data to be displayed in pages.
[0068] Wherein, N is the number of representations of the single-page data volume.
[0069] In an embodiment of the present application, after the control node 10 receives the filtering results sent by each child node, it sorts all the filtering results in order from the data generation time to the query time, and selects the first N data in the sorting as the data to be displayed in the page, that is, selects the data of a single page of data as the data to be displayed in the page, and discards the remaining data.
[0070] In a possible implementation, the control node 10 first compares the data volume of the received screening results with the data volume of a single page. If the data volume of the screening results is less than or equal to the data volume of a single page, no screening operation is required, and all screening results are directly sent to the client for display. At the same time, it means that the query results obtained by the user for data query are relatively small, and one page can be fully displayed. Therefore, the query status of the adjacent pages is set to be unavailable for viewing, that is, the "previous page" and "next page" of the client are set to be unavailable for clicking.
[0071] If the amount of data in the screening results received by the control node 10 is greater than the amount of data in a single page, the first N data are selected as the data to be displayed in the page after sorting the screening results, and the remaining data are discarded. At the same time, it means that the query results obtained by the user for data query are sufficient, so the query status of the adjacent page is set to be viewable, that is, the "previous page" and / or "next page" of the client are set to be clickable.
[0072] In one embodiment, each time a user views a page of data, the data corresponding to the page needs to be queried again based on the distributed data network. In order to distinguish data in different pages, different query conditions need to be set. The specific control node can set the query conditions corresponding to different pages according to the query time, and the proxy node implements the query of the corresponding page data based on the query conditions.
[0073] That is, the data query parameters also include a query time condition, and the query time condition is used to limit the display data of the page corresponding to the page turning type based on the data generation time.
[0074] The data query process of the proxy node based on the query time condition may include the following: Fig. 9 Steps shown: Step 501: Search the local data of the proxy node for data that meets the data query condition and whose data generation time meets the query time condition, and obtain the local response data of the proxy node.
[0075] Step 502: Sort the local response data of the proxy node and the received response data in the order of the distance from the data generation time to the query time.
[0076] Step 503: Select the top M data from the sorting results according to the target data volume, and send them to the parent node of the proxy node.
[0077] Wherein, M is the number representing the target data volume, that is, M is an integer greater than N; preferably, M=N+1.
[0078] When the page turning type is the first page, the query time condition is that the data generation time is less than the query time; when the page turning type is the next page, the query time condition is that the data generation time is less than the data generation time of the first target data in the data displayed on the current page; when the page turning type is the previous page, the query time condition is that the data generation time is greater than the data generation time of the second target data in the data displayed on the current page. The current page is the paging currently displayed by the client.
[0079] The first target data is the current page display data that is ranked first after sorting the current page display data in the order of data generation time from the nearest to the query time. The second target data is the current page display data that is ranked first after sorting the current page display data in the order of data generation time from the nearest to the query time.
[0080] In the embodiment of the present application, the data request includes a page turning type, and the page turning type indicates the paged data that the user wants to view.
[0081] The data query condition and query time condition can be expressed as the following structured query language (SQL) statement: from op_audit where op_type=disk and op_time order by op_time desc limit x, where x is the target data volume.
[0082] When the page turning type is the first page, the query time is the current query time, and the control node 10 generates a query time condition based on the query time carried in the data request: the data generation time is less than the query time, indicating the proxy node 21 or the terminal node 30 to query the data that meets the data query condition and the data generation time is before the current time, and obtain the local response data. Then the proxy node 21 receives the response data sent by the child node, sorts the local response data and the received response data in the order of the data generation time from the query time from near to far, and selects the first M data in the sorting to send to the parent node, that is, selects the target data amount of data to send to the parent node, so as to realize the transmission of the response data at the level where the proxy node is located.
[0083] When the page turning type is the next page, the control node 10 first determines the oldest data (the first target data) in the data of the current page, that is, the data whose data generation time is farthest from the query time, and then determines the query time condition as the data generation time is less than the data generation time of the first target data in the data displayed on the current page. That is, the next page data is continuous with the current page data in time. For example, the query time of the current page data obtained by the query is 9:45, and the data generation time of the current page data obtained by the query is within the range of 9:30-9:45. When querying the next page data, the query time condition is that the data generation time is before 9:30. After the proxy node 21 queries the local response data that meets the data query condition and the query time condition (for example, the data generation time is before 9:30), it selects M data according to the above data sorting and screening method and sends them to the parent node.
[0084] When the user needs to view updated data during the viewing process, that is, when the user clicks the "previous page" button, the control node 10 first determines the latest data (second target data) in the data of the current page, that is, the data whose data generation time is closest to the query time, and then determines the query time condition to be that the data generation time is greater than the data generation time of the second target data in the data displayed on the current page. That is, the previous page data is also continuous with the current page data in time. For example, the current page is page 3, and the data generation time of the queried current page data is within the range of 10:10-10:30. When querying the previous page data, the query time condition is that the data generation time is after 10:30. After the proxy node 21 queries the local response data that meets the data query condition and the query time condition (for example, the data generation time is after 10:30), it selects M data according to the above data sorting and screening method and sends them to the parent node.
[0085] In the method provided in the embodiment of the present application, the proxy node searches the local data for data that meets the data query condition and the data generation time meets the query time condition, and obtains the local response data of the proxy node. According to the order from the data generation time to the query time, the local response data of the proxy node and the received response data are sorted. According to the target data volume, the top M data are selected from the sorting result and sent to the parent node of the proxy node. Finally, the control node sorts the screening results received from the child node according to the order from the data generation time to the query time, and selects the top N data from the sorting result as the data to be displayed in the paging according to the single-page data volume. In each data query, the embodiment of the present application only queries the data of the paging to be displayed. When the user needs to view the previous page or next page of data, the data query is performed again to ensure the accuracy of the queried data of the paging to be displayed.
[0086] In one embodiment, a distributed data network is provided, which includes a control node, at least one node group set in a hierarchy, and an end node, each node group including at least one proxy node. The control node is used to receive a data request from a client, generate a data query parameter according to the single-page data volume carried by the data request, and send the data query parameter to the proxy node; the data volume represented by the data query parameter is greater than the single-page data volume; the proxy node is used to send the data query parameter to the child node until the end node receives the data query parameter and receives the response data sent by the child node; the local response data of the proxy node and the received response data are filtered according to the data query parameter, and the filtering result is sent to the parent node of the proxy node until the control node receives the filtering result sent by the child node of the control node; the response data is obtained according to the data query parameter; the control node is also used to determine the paging data to be displayed based on the single-page data volume and the received filtering result, and send a response message to the client, and the response message carries the paging data to be displayed.
[0087] In an embodiment of the present application, after receiving a data request, the control node 10 can analyze the data request, generate data query parameters based on the analysis results, and send the data query parameters to the proxy node 21, so that each proxy node 21 and the end node 30 can query the data that meets the user data request instruction based on the data query parameters.
[0088] When the control node 10 sends data query parameters, it can first send the data query parameters to the child node of the control node 10, that is, the level 1 proxy node; then, the level 1 proxy node sends the data query parameters to its own child node, that is, the level 2 proxy node, until the data query parameters are transmitted to the end node 30 through hierarchical sending.
[0089] After the data query parameters are passed to the end node 30, the end node 30 can query the local data according to the data query parameters to obtain multiple data that meet the user's data request instructions, that is, to obtain multiple data that meet the user's needs. Then, the end node 30 can filter and process the queried data based on the amount of data represented by the data query parameters, and send the filtered data to the parent node of the end node 30, that is, the upper-level proxy node 21 of the end node 30, so that the proxy node 21 receives the data sent by the child node, which is the response data of the end node 30, that is, the data finally obtained after the end node 30 responds to the client's data request and queries the local data according to the data query parameters.
[0090] For the upper proxy node 21 of the terminal node 30, the local data of the proxy node 21 is queried according to the data query method of the terminal node 30 and the data query parameters to obtain the local response data of the proxy node 21. Then, the proxy node 21 determines the local response data and the total data volume of the response data received from each terminal node 30, and compares the total data volume with the data volume represented by the data query parameters. If the total data volume reaches the data volume represented by the data query parameters, all data are directly sent to the upper proxy node 21 of the proxy node 21; if the total data volume exceeds the data volume represented by the data query parameters, the local response data and the received response data are filtered, and the filtered data volume is equal to the data volume represented by the data query parameters. Finally, the proxy node 21 sends the filtered data to the upper proxy node 21.
[0091] After the control node 10 receives the data sent by each child node (i.e., the received filtering results), it can filter the received data according to the single-page data volume of the client. The filtered data volume is the single-page data volume. The data filtered by the control node 10 is used as the paging data to be displayed, and a response message is generated based on the paging data to be displayed and sent to the client to instruct the client to display the paging data to be displayed.
[0092] The distributed data network provided by the embodiment of the present application transmits the response data level of each node in response to the user's data request query to the control node when realizing the data query function, and the response data of at least one node is screened during each level of transmission, and the transmission and screening of a large amount of data are distributed on the proxy nodes at each level, thereby avoiding the centralized transmission and processing of a large amount of data and ensuring the efficiency of data query; the amount of data transmitted to the control node after the hierarchical screening process is small, avoiding the concentration of a large amount of data processing on the control node, thereby avoiding the update and upgrade of equipment and the addition of additional equipment, and realizing efficient data query at the software level, effectively reducing the cost of data query. The distributed processing of data by proxy nodes at each level can also avoid network congestion and further improve the efficiency of data query.
[0093] It should be noted that although the operations of the method of the present invention are described in a particular order in the accompanying drawings, this does not require or imply that the operations must be performed in this particular order, or that all the operations shown must be performed to achieve the desired results. On the contrary, the steps depicted in the flow chart can be performed in a different order. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step, and / or one step can be decomposed into multiple steps.
[0094] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a different order from the order marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0095] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0096] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with (but not limited to) technical features with similar functions disclosed in the present application.
Claims
1. A data query method, characterized in that: Applied to a distributed data network, the distributed data network includes a control node, at least one node group arranged in a hierarchy, and an end node, each of the node groups includes at least one proxy node, the method includes: The control node receives a data request from a client, generates a data query parameter according to the single-page data volume carried in the data request, and sends the data query parameter to the proxy node; the data volume represented by the data query parameter is greater than the data volume represented by the single-page data volume; The proxy node sends the data query parameter to the child node until the end node receives the data query parameter, and receives the response data sent by the child node; the response data is obtained according to the data query parameter; The proxy node screens the local response data of the proxy node and the received response data according to the data query parameter, and sends the screening result to the parent node of the proxy node until the control node receives the screening result sent by the child node of the control node; The control node determines the paging data to be displayed based on the single-page data volume and the received screening result, and sends a response message to the client, where the response message carries the paging data to be displayed.
2. The method according to claim 1, characterized in that The data request of the client also includes data query conditions and query time; The data query parameters include a target data volume, the data query condition and the query time; the target data volume is greater than the single-page data volume.
3. The method according to claim 2, characterized in that The data request from the client further includes a page turning type; the page turning type includes at least one of the first page, the next page, the previous page, and the page number of the page to be displayed.
4. The method according to claim 2, characterized in that: The control node determines the paging data to be displayed based on the single page data amount and the received screening result, including: Splitting all the filtering results according to the amount of data on a single page, determining the number of pages for displaying all the filtering results in pages, and the data corresponding to each page; The first page of data and the page number are sent to the client.
5. The method according to claim 3, characterized in that: The control node determines the paging data to be displayed based on the single page data amount and the received screening result, including: Splitting all the filtering results according to the amount of data on a single page, determining the number of pages for displaying all the filtering results in pages, and the data corresponding to each page; The page to be displayed is determined according to the page turning type and the currently displayed page, and the data of the page to be displayed is acquired according to the data corresponding to each page.
6. The method according to claim 3, characterized in that The control node determines the paging data to be displayed based on the single page data amount and the received screening result, including: Sorting the screening results in the order of the data generation time of the screening results from the nearest to the query time; According to the single-page data volume, the first N data are selected from the sorting results as the paging data to be displayed; N is the number represented by the single-page data volume.
7. The method according to claim 3, characterized in that The data query parameters further include a query time condition, and the query time condition is used to limit the display data of the page corresponding to the page turning type based on the data generation time.
8. The method according to claim 7, characterized in that When the page turning type is the first page, the query time condition is that the data generation time is less than the query time; when the page turning type is the next page, the query time condition is that the data generation time is less than the data generation time of the first target data in the data displayed on the current page; when the page turning type is the previous page, the query time condition is that the data generation time is greater than the data generation time of the second target data in the data displayed on the current page; The first target data is the current page display data that is ranked first after sorting each of the current page display data in the order from near to far the data generation time. The second target data is the current page display data that is ranked first after sorting each of the current page display data in the order from far to near the data generation time.
9. The method according to claim 8, characterized in that The proxy node screens the local response data of the proxy node and the received response data according to the data query parameter, including: Searching the local data of the proxy node for data that meets the data query condition and whose data generation time meets the query time condition, to obtain local response data of the proxy node; Sorting the local response data of the proxy node and the received response data in the order of the data generation time from the nearest to the query time; The first M data are selected from the sorting results according to the target data volume, and sent to the parent node of the proxy node; M is the number represented by the target data volume, and M is an integer greater than N.
10. A distributed data network, characterized in that: The distributed data network includes a control node, at least one node group arranged in a hierarchy, and an end node, each of the node groups includes at least one proxy node, The control node is used to receive a data request from a client, generate a data query parameter according to the single-page data volume carried in the data request, and send the data query parameter to the proxy node; the data volume represented by the data query parameter is greater than the single-page data volume; The proxy node is used to send the data query parameter to the child node until the end node receives the data query parameter and receives the response data sent by the child node; Filter the local response data of the proxy node and the received response data according to the data query parameter, and send the filtering result to the parent node of the proxy node until the control node receives the filtering result sent by the child node of the control node; The response data is obtained according to the data query parameters; The control node is further configured to determine the paging data to be displayed based on the single-page data volume and the received screening result, and send a response message to the client, wherein the response message carries the paging data to be displayed.
Citation Information
Patent Citations
Method for distribution storage and paging querying of real-time data
CN103778135A
Internet of data
CN108076133A
Distributed parallel database resource management method
CN110119405A
Alliance chain architecture for providing multi-level data privacy
CN111541547A
Multi-layer blockchain network architecture and data storage and sharing method thereof
CN111556140A
