Graph data query method and system
By sending a request containing the source vertex and the first hop count to the storage node from the compute node, the problem of low query efficiency for graph data in the storage system is solved, and a more efficient query process is achieved.
Patent Information
- Application Number
- CN202410587988.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-09
- Publication Date
- 2025-11-11
AI Technical Summary
When querying graph data in a storage system, compute nodes need to wait for the storage nodes to return the query results, resulting in low query efficiency.
The compute node sends a request to the storage node, including the source vertex and the first hop count, to obtain the multi-hop vertex associated with the source vertex, avoiding multiple communications and shortening the waiting time.
It improves the efficiency of graph data querying and reduces the communication volume and resource consumption between computing nodes and storage nodes.
Smart Images

Figure CN120929643A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of graph data query technology, and in particular to a graph data query method and system. Background Technology
[0002] A data structure refers to the way data or files are organized in a computer system. Taking graph data as an example, graph data stores multiple vertices and edges connecting different vertices. Here, vertices refer to data elements, and edges refer to the relationships between data elements.
[0003] Taking a storage system that separates storage and computation to store graph data as an example, this system includes compute nodes located on different hardware and multiple storage nodes. Storage nodes are used to store part or all of the graph data. During graph data querying, compute nodes send query tasks containing the vertices to be queried to each storage node, wait for the query results from each storage node, and obtain the next round of query tasks based on the query results from each storage node.
[0004] Because storage nodes only query the next-hop vertex of the vertex to be queried during the query process, compute nodes have to wait a long time to query graph data in the storage system, resulting in low query efficiency. Summary of the Invention
[0005] This application provides a graph data query method and system to solve the technical problem of low query efficiency caused by the long waiting time required for computing nodes to query graph data in the storage system.
[0006] The technical solution adopted in this application is as follows.
[0007] Firstly, this application provides a graph data query method. This method can be applied to a storage system including compute nodes and multiple storage nodes. The multiple storage nodes are used to store graph data, and each storage node stores a portion of the graph data. The method includes: a compute node receiving a query request. The query request includes: a source identifier of a source vertex in the graph data and the query hop count of the source vertex. Based on the query request, the compute node sends a first request to a first storage node. The first request includes a source identifier and a first hop count, where the first hop count is less than or equal to the query hop count of the source vertex. The first storage node is the storage node among the multiple storage nodes that stores the source vertex. The compute node receives a first query result sent by the first storage node based on the first request. The first query result includes: a first vertex set obtained by the first storage node based on the source vertex and the first hop count, where the first vertex set includes vertices associated with the source vertex stored by the first storage node.
[0008] In the first aspect of this application, a computing node sends a request to a storage node that includes a source identifier (including the source vertex) to obtain the vertices associated with the source vertex, obtained by the storage node based on the source vertex and a first hop count. Thus, when the vertices associated with the source vertex include multiple hops, the computing node can obtain the vertices associated with the source vertex with a single request, avoiding multiple communications between the computing node and the storage node to obtain these multiple hops, shortening the communication time required, and saving the computing node's waiting time. This also avoids the computing node sending requests to all storage nodes to obtain the vertices associated with the source vertex. Furthermore, it reduces the waiting time required for the computing node to wait for the storage node to query graph data, improving query efficiency.
[0009] In one possible implementation, the multiple storage nodes further include a second storage node. The method further includes: a computing node sending a second request to the first storage node, a third request to the second storage node, or both a second request and a third request to the second storage node, based on a first vertex set. The second request includes a second hop count and a query identifier, where the second hop count is less than or equal to the query hop count and greater than the first hop count. The query identifier instructs the first storage node to return a second vertex set, which includes vertices pre-queried by the first storage node based on the first vertex set and a reference hop count. The third request includes a second hop count and a first identifier of a first vertex, where the first vertex is a vertex stored in the second storage node from the first vertex set. The computing node receives the second vertex set sent by the first storage node based on the second request, receives the third vertex set sent by the second storage node based on the third request, or receives both the second vertex set sent by the first storage node based on the second request and the third vertex set sent by the second storage node based on the third request. The third vertex set includes vertices obtained by the second storage node based on the first vertex and the second hop count. The computing node obtains a second query result based on the second vertex set, the third vertex set, or both the second and third vertex sets. In this way, the compute node can obtain the vertices pre-queried by the first storage node based on the first vertex set and the reference hop count without sending any vertices from the first vertex set to the first storage node. This reduces the amount of communication between the compute node and the storage node, and saves the time and resources required for communication between the compute node and the storage node.
[0010] In another possible implementation, before the compute node sends a second request to the first storage node, a third request to the second storage node, or both, based on the first vertex set, the method further includes: the compute node acquiring local vertices and global vertices from the first vertex set. Local vertices are those with a next hop in the first storage node, and global vertices are those without a next hop in the first storage node. The compute node generates the second request and / or the third request based on the local and global vertices. The second request is used to acquire the second-hop vertices associated with the source vertex stored in storage nodes that do not have global vertices. The third request is used to acquire the second-hop vertices associated with the source vertex stored in storage nodes that have global vertices.
[0011] In another possible implementation, the first vertex set includes a first subset and a second subset. The first subset includes local vertices, and the second subset includes global vertices. Local vertices are those with a next hop in the first storage node, while global vertices are those without a next hop in the first storage node. Thus, when a compute node generates a request based on the first vertex set, it can quickly retrieve both local and global vertices from the first vertex set, shortening the time required to generate the request and improving the efficiency of graph data querying.
[0012] In another possible implementation, the compute node obtains local vertices and global vertices from a first subset, including: the compute node obtains local vertices based on a first subset and global vertices based on a second subset. In this way, the compute node can quickly and accurately obtain local and global vertices, reducing the time required to generate requests using global and local vertices and improving graph data query efficiency.
[0013] In another possible implementation, the first vertex set includes a third subset. The third subset includes vertices with labels and vertices without labels. Labeled vertices are local vertices, and unlabeled vertices are global vertices. Local vertices are those with a next hop in the first storage node, while global vertices are those without a next hop in the first storage node. Thus, the compute node can determine local and global vertices based on the labeled vertices, reducing the time required for the compute node to determine local and global vertices in the first vertex set and improving graph data query efficiency.
[0014] In another possible implementation, the compute node obtains local and global vertices from the first vertex set, including: the compute node obtains local vertices based on the vertices marked in the first vertex set, and the compute node obtains global vertices based on the vertices not marked in the first vertex set. In this way, the compute node can quickly and accurately obtain local and global vertices, thereby reducing the time required to generate requests using global and local vertices and improving graph data query efficiency.
[0015] In another possible implementation, the first vertex set includes one-hop or multi-hop vertices associated with the source vertex stored in the first storage node.
[0016] In another possible implementation, the compute node obtains the local vertices and global vertices from the first vertex set, including: the compute node obtains the vertices in the first vertex set that have a next hop in the first storage node, thus obtaining the local vertices; and the compute node obtains the vertices in the first vertex set that do not have a next hop in the first storage node, thus obtaining the global vertices.
[0017] Secondly, this application provides a graph data query method. This method can be executed by a storage node, which stores graph data, specifically the first subgraph data included in the graph to be queried. The method includes: the storage node receiving a first request. The first request includes: a source identifier of a source vertex in the first subgraph data and a first hop count, wherein the first hop count is less than or equal to the query hop count of the source vertex. The storage node queries the first subgraph data according to the first request and obtains a first query result. The first query result includes: a first vertex set obtained by the storage node based on the source vertex and the first hop count, wherein the first vertex set includes vertices associated with the source vertex stored by the storage node. The storage node obtains a second query result according to the first request. The second query result includes: vertices pre-queried by the storage node based on a second vertex set and a reference hop count, wherein the second vertex set includes: vertices in the first subgraph data that have a next hop, as included in historical query results. Finally, the storage node sends the first query result and the second query result.
[0018] In this application, the storage node can obtain not only the vertices associated with the source vertex based on the source identifier and the first hop count, but also the vertices pre-queried based on the second vertex set and the reference hop count. Thus, even if the request does not include vertices from the second vertex set, the pre-queried vertices based on the second vertex set and the reference hop count can still be obtained. Furthermore, before receiving a request, the storage node utilizes its own resources to pre-query the reference hop count vertices of the vertices in the second vertex set. This asynchronous query method improves the resource utilization of the storage node. Upon receiving the next-hop vertex of the vertices in the second vertex set, the pre-query result can be directly obtained without waiting, shortening the waiting time and improving the efficiency of graph data querying. It also reduces the communication volume between the storage node and the computing node, shortening the data transmission time and improving the efficiency of graph data querying.
[0019] In one possible implementation, the storage node queries the first subgraph data according to a first request and obtains a first query result, including: the storage node queries the first subgraph data according to the first request and obtains a first vertex set. The first vertex set includes vertices stored by the storage node that are associated with the source vertex. The storage node obtains a first subset and a second subset based on the first vertex set. The first subset includes local vertices, and the second subset includes global vertices. Local vertices are those in the first vertex set that have a next hop in the storage node, and global vertices are those in the first vertex set that do not have a next hop in the storage node. The storage node obtains the first query result based on the first subset and the second subset. Thus, the storage node generates the first subset based on local vertices and the second subset based on global vertices. In this way, while waiting for the next request, the storage node can pre-query the preset hop vertices associated with the vertices in the first subset, improving the resource utilization of the storage node. Furthermore, when a storage node receives a request to retrieve the next-hop vertex of the vertices in the first subset, it can directly obtain the next-hop vertex of the vertices in the first subset based on the results of the pre-query, thus shortening the time required to obtain the next-hop vertex of the vertices in the first subset and improving the efficiency of graph data query.
[0020] In another possible implementation, the storage node queries the first subgraph data according to the first request and obtains the first query result, including: the storage node queries the first subgraph data according to the first request and obtains the first vertex set. The first vertex set includes vertices stored by the storage node that are associated with the source vertex. The storage node obtains a third subset based on the first vertex set. The third subset includes vertices with labels and vertices without labels. Labeled vertices are local vertices, and unlabeled vertices are global vertices. Local vertices are those in the storage node that have a next hop in the first vertex set, and global vertices are those in the storage node that do not have a next hop in the first vertex set. The storage node obtains the first query result based on the third subset. In this way, while waiting for the next request, the storage node can pre-query the preset hop vertices associated with the labeled vertices in the third subset, improving the resource utilization of the storage node. Furthermore, when a storage node receives a request to retrieve the next-hop vertex of an identifiable vertex in the third subset, it can directly obtain the next-hop vertex of the identifiable vertex in the third subset based on the result of the pre-query. This shortens the time required to retrieve the next-hop vertex of the identifiable vertex in the third subset and improves the efficiency of graph data query.
[0021] Thirdly, this application provides a graph data query method. This method can be applied to a storage system. The storage system includes computing nodes and multiple storage nodes, where the multiple storage nodes store graph data, and each storage node stores a portion of the graph data. The method includes: a computing node receiving a query request, and the computing node sending a first request to a first storage node based on the query request. The query request includes the source identifier of the source vertex in the graph data and the query hop count of the source vertex. The first request includes the source identifier and a first hop count. The first hop count is less than or equal to the query hop count of the source vertex, and the first storage node is the storage node among the multiple storage nodes that stores the source vertex. The first storage node receives the first request, and the first storage node queries first subgraph data based on the first request to obtain a first query result. The first query result includes: a first vertex set obtained by the first storage node based on the source vertex and the first hop count, where the first vertex set includes vertices associated with the source vertex stored by the first storage node. The computing node receives the first query result sent by the first storage node.
[0022] In one possible implementation, the multiple storage nodes further include a second storage node. The method further includes: a compute node sending a second request to a first storage node, or a third request to a second storage node, or both a second and a third request to the first storage node, based on a first vertex set. The second request includes a second hop count and a query identifier, where the second hop count is less than or equal to the query hop count and greater than the first hop count. The query identifier instructs the first storage node to return a second vertex set, which includes vertices pre-queried by the first storage node based on the first vertex set and a reference hop count. The third request includes a second hop count and a first identifier of a first vertex, where the first vertex is a vertex stored in the second storage node from the first vertex set. The compute node receives the second vertex set sent by the first storage node based on the second request, or receives the third vertex set sent by the second storage node based on the third request, or receives both the second and third vertex sets sent by the first storage node based on the second request. The third vertex set includes vertices obtained by the second storage node based on the first vertex and the second hop count. The computing node obtains the second query result based on the second vertex set, the third vertex set, or the second vertex set and the third vertex set.
[0023] In another possible implementation, before the compute node sends a second request to the first storage node, or a third request to the second storage node, or both, based on the first vertex set, the method further includes: the compute node acquiring local vertices and global vertices from the first vertex set. Local vertices are those with a next hop in the first storage node, and global vertices are those without a next hop in the first storage node. The compute node generates the second request and / or the third request based on the local and global vertices.
[0024] In another possible implementation, the first vertex set comprises a first subset and a second subset. The first subset includes local vertices, and the second subset includes global vertices. Local vertices are those with a next hop in the first storage node, while global vertices are those without a next hop in the first storage node.
[0025] In another possible implementation, the compute node obtains local vertices and global vertices from a first set of vertices, including: the compute node obtains local vertices based on a first subset and global vertices based on a second subset.
[0026] In another possible implementation, the first vertex set includes a third subset. The third subset includes labeled vertices and unlabeled vertices. Labeled vertices are local vertices, and unlabeled vertices are global vertices. Local vertices are those with a next hop in the first memory node, while global vertices are those without a next hop in the first memory node.
[0027] In another possible implementation, the computing node obtains local vertices and global vertices from the first vertex set, including: the computing node obtains local vertices based on the vertices with labels in the first vertex set, and the computing node obtains global vertices based on the vertices without labels in the first vertex set.
[0028] In another possible implementation, the first storage node queries the first subgraph data according to the first request and obtains the first query result, including: the first storage node queries the first subgraph data according to the first request and obtains the first vertex set. The first vertex set includes vertices associated with the source vertex stored by the first storage node. The first storage node obtains a first subset and a second subset based on the first vertex set. The first subset includes local vertices, and the second subset includes global vertices. Local vertices are those in the first vertex set that have a next hop in the first storage node, and global vertices are those in the first vertex set that do not have a next hop in the first storage node. The first storage node obtains the first query result based on the first subset and the second subset.
[0029] In another possible implementation, the first storage node queries the first subgraph data according to the first request and obtains the first query result, including: the first storage node queries the first subgraph data according to the first request and obtains the first vertex set. The first vertex set includes vertices associated with the source vertex stored by the first storage node. The first storage node obtains a third subset based on the first vertex set. The third subset includes vertices with labels and vertices without labels. Labeled vertices are local vertices, and unlabeled vertices are global vertices. Local vertices are those in the first vertex set that have a next hop in the first storage node, and global vertices are those in the first vertex set that do not have a next hop in the first storage node. The first storage node obtains the first query result based on the third subset.
[0030] Fourthly, this application provides a computing cluster. The computing cluster includes at least one computing node, each computing node including a transceiver and a processor. The transceiver of the at least one computing node receives a query request initiated by a user, and the processor of the at least one computing node is used to execute operational steps of the method described in the first aspect or any possible implementation of the first aspect according to the query request.
[0031] Fifthly, this application provides a storage cluster. The storage cluster includes at least one storage node, each storage node including a memory and a processor. The memory of the at least one storage node is used to store graph data, and the processor of the at least one storage node is used to execute operational steps of the method described in the second aspect or any possible implementation of the second aspect, based on the graph data stored in the memory.
[0032] Sixthly, this application provides a computer-readable storage medium, comprising: computer software instructions; which, when executed in a computing device, cause the computing device to perform operational steps of the method as described in the first aspect or any possible implementation thereof, or cause the computing device to perform operational steps of the method as described in the second aspect or any possible implementation thereof.
[0033] In a seventh aspect, this application provides a computer program product. When the computer program product is run on a computer, it causes a computing device to perform the operation steps of the method as described in the first aspect or any possible implementation thereof, or causes the computing device to perform the operation steps of the method as described in the second aspect or any possible implementation thereof.
[0034] The beneficial effects of aspects three through seven above can be described with reference to the implementation of any of aspects one or two, and will not be repeated here. Based on the implementations provided in the above aspects, this application can be further combined to provide more implementations. Attached Figure Description
[0035] Figure 1A Example plot of graph data;
[0036] Figure 1B This is a schematic diagram of a graph data query process;
[0037] Figure 2 A schematic diagram of the architecture of a storage system provided in this application;
[0038] Figure 3 A structural example diagram of a computing device provided in this application;
[0039] Figure 4 A flowchart illustrating the first graph data query method provided in this application;
[0040] Figure 5 A flowchart illustrating the second graph data query method provided in this application;
[0041] Figure 6A A flowchart illustrating the architecture of a graph data query method provided for the application;
[0042] Figure 6B An example diagram illustrating a graph data query method provided in this application;
[0043] Figure 7 This application provides a schematic diagram of the structure of an electronic device cluster;
[0044] Figure 8 This is a schematic diagram illustrating the connection between electronic devices provided in this application. Detailed Implementation
[0045] To ensure clarity and conciseness in the description of the following embodiments, a brief introduction to the relevant terms is given first.
[0046] A data structure is a way that computing devices store and organize data or files. A data structure is a collection of data elements that have one or more specific relationships with each other. Data structures can include graphs, arrays, stacks, queues, linked lists, and so on.
[0047] A graph can include multiple vertices and edges connecting the different vertices. A vertex is a data element, and an edge is a relationship between the data elements. In some possible cases, a vertex can also be called a node, node, etc.
[0048] A storage system refers to a system in a computer that consists of various storage devices for storing programs and data, control components, management information scheduling devices (hardware), and algorithms (software). Storage systems can include storage-compute separation storage systems and storage-compute integrated storage systems.
[0049] A storage system with separation of storage and computation consists of compute nodes and multiple storage nodes. The storage nodes are used to store and manage data, while the compute nodes are used to process the data.
[0050] Based on the introduction of relevant terminology above, a brief introduction to the relevant technologies is given below.
[0051] The compute node stores data in the form of graph data in the storage node. When it needs to query the graph data stored in the storage node, the compute node sends a query request to the storage node containing the vertex to be queried and the number of hops to be queried. The compute node obtains the query result based on the query request.
[0052] Figure 1A As an example of graph data, the following uses compute node queries. Figure 1A Taking the 4-hop vertex associated with vertex B as an example, this paper explains the process of a compute node querying the hop count vertex associated with the vertex to be queried. This process specifically includes the following ① to ③.
[0053] ① The compute node sends a query request to the storage node. This query request includes the identifier of vertex B in the graph data and the query hop count of 4.
[0054] ② The storage node executes four queries based on the query request.
[0055] First query: Based on the query request, the storage node queries the graph data to obtain the next-hop vertex [A, G] of vertex B. The storage node uses [A, G] as the result of the first query.
[0056] Second query: The storage node queries the next-hop vertex of each vertex in the result [A, G] of the first query, obtaining the next-hop vertex [C, D] of vertex A and the next-hop vertex [B, H] of vertex G. Based on the next-hop vertex of vertex A and the next-hop vertex of vertex G, the storage node obtains the result of the second query as [C, D, B, H].
[0057] The third query: The storage node queries the next-hop vertex of each vertex in the second query result [C, D, B, H], obtaining the next-hop vertices [A, J], [A, H, I], [A, G], and [D, G, F]. The storage node removes duplicate vertices from the next-hop vertices of each vertex, obtaining the third query result [A, J, H, I, G, D, F].
[0058] Fourth query: The storage node queries the next-hop vertex of each vertex in the third query result [A, J, H, I, G, D, F], obtaining the next-hop vertices [C, D], [E], [D, G, F], [D], [B, H], [A, H, I], and [A, H, I]. The storage node removes duplicate vertices from the next-hop vertices of each vertex, obtaining the fourth query result [C, D, E, G, F, B, H, A, I].
[0059] ③ The compute node, based on the result of the fourth query, Figure 1A The four hop vertices associated with vertex B are [C, D, E, G, F, B, H, A, I].
[0060] As the volume of graph data increases, the query process described above, performed by a single storage node storing the graph data, becomes inefficient. To address this, graph data can be stored in a compute-storage separated storage system, where each storage node stores a portion of the graph data. When querying graph data stored in this system is required, the compute node sends a query task containing the vertices to be queried to each storage node, waits for the query results from each storage node, and then retrieves the next round of query tasks based on the results from each storage node. For details, please refer to [link to relevant documentation]. Figure 1B Related descriptions, Figure 1B This is a schematic diagram of a graph data query process, such as... Figure 1B As shown, the process may include the following ① to ③.
[0061] ① The compute node receives the query request.
[0062] The query request includes the source vertex's source identifier in the graph data and the query hop count K. K is a positive integer greater than or equal to 1, such as K=3. In this case, the compute node retrieves the vertices in the graph data that are associated with the source vertex for 3 hops.
[0063] ② The compute node executes K queries based on the query request.
[0064] A single query specifically includes the following (1) to (4).
[0065] (1) The compute node generates and sends the first request to each storage node.
[0066] Depending on the number of queries, the first request generated by the compute node will be different.
[0067] For the initial query: The compute node generates a first request based on the query request. This first request includes the source identifier and the first current query hop count.
[0068] For non-first queries: The compute node generates a first request based on historical query results. This first request includes the identifier of the currently queried vertex in the graph data and the second current query hop count. The historical query result can refer to the query result of the hop before the current query hop count. For example, if the current query hop count is i, the historical query result can refer to the query result of the hop before the i-th hop, i.e., the query result of the (i-1)-th hop.
[0069] (2) Each storage node receives the first request and queries its stored graph data to obtain the current query result based on the first request.
[0070] (3) Each storage node sends its current query results to the compute node.
[0071] (4) The compute node receives and processes the current query results sent by each storage node to obtain the current query results.
[0072] ③ The computing node obtains the query result based on the results of K queries.
[0073] In some possible scenarios, the compute node can directly use the result of the Kth query as the query result. In other possible scenarios, the compute node obtains the union of the results of the first query and the Kth query based on the results of the first query to the Kth query, and uses this union as the query result.
[0074] In the above process, compute nodes need to wait for the query results from each storage node and initiate the next query based on those results. When a storage node queries the stored graph data according to a query request, it only queries the next-hop vertex of the vertex being queried. The need for compute nodes to receive query results from each storage node results in low query efficiency.
[0075] To address this, this application provides a graph data query method. This method is applied to a storage system comprising compute nodes and multiple storage nodes. The storage nodes store graph data, with each storage node storing a portion of the graph data. The compute node sends a request to a storage node containing a source identifier (including the source vertex) to retrieve the vertices associated with the source vertex, obtained by that storage node based on the source vertex and a first hop count. Thus, when the vertices associated with the source vertex include multiple hops, the compute node can retrieve the vertices associated with the source vertex with a single request, avoiding multiple communications between the compute node and storage nodes to obtain these multiple hops, shortening communication time, and saving compute node waiting time. It also avoids the compute node sending requests to all storage nodes to retrieve the vertices associated with the source vertex. Furthermore, it reduces the waiting time for the compute node to wait for storage nodes to query graph data, improving query efficiency.
[0076] Figure 2 A schematic diagram of the architecture of a storage system provided in this application is shown below. Figure 2 As shown, the storage system 200 includes a computing cluster 210 and a storage cluster 220. The computing cluster 210 and the storage cluster 220 can communicate with each other via wired or wireless means.
[0077] The computing cluster 210 includes at least one computing node. A user can input a query request to the computing cluster 210, which then sends the query request to the storage cluster 220 and receives the query results returned by the storage cluster 220. The computing cluster 210 then outputs the query results to the user. The computing node can be a computing device with data processing capabilities, such as a personal computer, server, mobile phone, tablet computer, or desktop computer.
[0078] Storage cluster 220 includes multiple storage nodes. These storage nodes are used to store graph data, with each storage node storing a portion of the graph data. The storage nodes in storage cluster 220 receive query requests sent by computing cluster 210, and query the stored graph data according to the query requests to obtain the query results sent by the parallel computing cluster. Storage nodes can be computing devices with data storage capabilities, such as personal computers, servers, mobile phones, tablets, or desktop computers.
[0079] In some possible scenarios, storage system 200 may further include a management node 230. Management node 230 stores attribute information associated with data elements in the graph data and identifiers of the storage nodes where each data element resides. Management node 230 receives requests from computing cluster 210 to obtain the storage location of data elements, and based on these requests, sends the identifiers of the storage nodes where each data element resides to computing cluster 210. When the graph data stored in storage cluster 220 changes, management node 230 updates its stored information to ensure that the updated information is consistent with the location of the data elements in the storage nodes. Management node 230 can be an electronic device with data storage capabilities, such as a personal computer, server, mobile phone, tablet computer, or desktop computer.
[0080] In some possible scenarios, the storage system 200 may also include a client device 240. Users use the client device 240 to send query requests to the computing cluster 210 and to receive query results from the computing cluster 210. The client device 240 may be a terminal device, including but not limited to personal computers, mobile phones, desktop computers, etc.
[0081] The wired communication methods mentioned above can include: Ethernet, fiber optic cables, and various peripheral component interconnect express (PCIe) buses installed within the storage system 200 to connect the computing cluster 210, storage cluster 220, and management node 230. The wireless communication methods mentioned above can include: the Internet, wireless fidelity (WIFI), and ultra-wideband (UWB) technology.
[0082] The above text combined Figure 2 The storage system provided in this application is described below, in conjunction with... Figure 3 A possible structural example diagram of a computing device is provided. Figure 3 An example structural diagram of a computing device provided in this application, such as... Figure 3 As shown, the computing device 300 may include a communication interface 314, a processor 311, and a memory 312. The communication interface 314 is used to communicate with devices located outside the computing device 300. For example, a client device 240 sends a query request to the computing device 300 through the communication interface 314, and after the computing device 300 obtains the query result according to the query request, it sends the query result back to the client device 240 through the communication interface 314.
[0083] Processor 311 is the core of computing device 300 for both computation and control. It may include: a central processing unit (CPU), a specific integrated circuit, other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. In practical applications, computing device 300 may also include multiple processors. Processor 311 may include one or more processor cores. An operating system and other software programs are installed in processor 311, enabling it to access memory 312 and various peripheral component interconnect (PCIe) devices.
[0084] The processor 311 is connected to the memory 312 via a double data rate (DDR) bus or other types of bus. The memory 312 is the main memory of the computing device 300. The memory 312 is typically used to store various running software in the operating system, input data received from the client device 240, and output results to be sent to the client device 240 in the future. To improve the access speed of the processor 311, the memory 312 needs to have a high access speed. In conventional computer devices, dynamic random access memory (DRAM) is typically used as the memory 312. Besides DRAM, the memory 312 can also be other random access memories, such as static random access memory (SRAM). Alternatively, the memory 312 can also be a read-only memory (ROM). For example, a read-only memory could be a programmable read-only memory (PROM) or an erasable programmable read-only memory (EPROM). This embodiment does not limit the number or type of memory 312.
[0085] Optionally, to persistently store data, the computing device 300 may also include a device or system with persistent data storage capabilities. For example, the computing device 300 may include a data storage system 313, which may be located outside the computing device 300 (e.g.,...). Figure 3 As shown, the data storage system 313 exchanges data with the computing device 300 via a network. Optionally, the data storage system 313 can also be located inside the host, such as exchanging data with the processor 311 via the bus 315. In this case, the data storage system 313 manifests as a hard disk.
[0086] It is understood that the structure illustrated in this embodiment does not constitute a specific limitation on the computing device. In other embodiments, the computing device and chip may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0087] The following is combined with Figure 2 and Figure 3 The content shown provides a detailed explanation of the data query method provided in this application.
[0088] Figure 4 This is a flowchart illustrating the first graph data query method provided in this application, which is applied to a storage system. The storage system can have... Figure 2 The storage system 200 shown has the same architecture. This storage system includes compute nodes and multiple storage nodes. These multiple storage nodes store graph data, with each storage node storing a portion of the graph data. The hardware implementation of the compute nodes and storage nodes can be found in the foregoing. Figure 3 The description of [the subject] will not be repeated here. For example... Figure 4 As shown, the data query method provided in this embodiment may include the following steps S410 to S460.
[0089] S410, the compute node receives the query request.
[0090] The query request includes the source vertex's source identifier in the graph data and the query hop count for the source vertex. The query request instructs compute nodes to retrieve the information associated with the source vertex. Compute nodes can receive query requests from different devices; two possible examples are given below.
[0091] Example 1: The compute node receives a query request sent by the user.
[0092] The compute node can directly receive query requests sent by users using client equipment. For details regarding user equipment, please refer to the relevant descriptions above; they will not be repeated here.
[0093] A user sends a query request to a compute node to retrieve the query hop count vertex associated with the source vertex in the graph data. The query hop count vertex associated with the source vertex in the graph data can refer to the next query hop count vertex of the source vertex. In some possible examples, the next query hop count vertex of the source vertex can also be called the next query hop number of the source vertex, or the next query hop of the source vertex. For example, if the query hop count is one, the next query hop count vertex of the source vertex can also be called the next hop of the source vertex. For instance, if the query request includes the source identifier of source vertex B in the graph data and the query hop count of source vertex B as 2, the user sends this query request to the compute node to retrieve the next two hop vertices of source vertex B in the graph data.
[0094] Example 2: The computing device receives a query request sent by the management node.
[0095] In a storage system that includes a management node, a user can send a query request using the client device's management node. The management node selects a target compute node from at least one compute node in the compute cluster, based on the characteristics of the compute nodes within the cluster, and sends the query request to the target compute node. The target compute node then receives the query request from the management node.
[0096] The management node can select a target compute node from at least one compute node in the compute cluster in a variety of ways. Several possible methods are given below.
[0097] Method 1: Random selection.
[0098] In this scenario, the management node randomly selects one computing node from at least one computing node as the target computing node.
[0099] Option 2: Select according to preset conditions.
[0100] In this scenario, the management node selects a target computing node from at least one computing node that meets preset conditions. These preset conditions may include, but are not limited to: the computing node's available computing resources are greater than a computing resource threshold, the computing node's load rate is less than a load rate threshold, the computing node's available communication resources are greater than a resource threshold, and the computing node's received query request volume is less than a request volume threshold, etc.
[0101] If there are multiple computing nodes that meet the preset conditions in at least one computing node, the management node can randomly select one computing node from these multiple computing nodes that meet the preset conditions as the target computing node.
[0102] S420, the compute node sends the first request to the first storage node based on the query request.
[0103] The first request includes the source identifier and the first hop count. The first hop count is less than or equal to the query hop count of the source vertex, and the first storage node is the storage node that stores the source vertex among multiple storage nodes.
[0104] When the query request includes a source vertex with a hop count of K hops, the compute node can use the following process to obtain the K-hop vertices associated with the source vertex in the graph data, where K is greater than or equal to 1. Specifically, the compute node obtains the next-hop vertex of the source vertex based on the query request. Based on the next-hop vertex of the source vertex, the compute node obtains the next two-hop vertices of the source vertex. Based on the next two-hop vertices of the source vertex, the compute node obtains the next three-hop vertices of the source vertex, and so on, until the next K-hop vertex of the source vertex is obtained. This next K-hop vertex is the K-hop vertex associated with the source vertex.
[0105] Based on the above process, before the compute node sends the first request to the first storage node, the compute node can generate a first request containing a first hop count based on the source identifier and query hop count included in the query request. In this case, the first hop count can refer to the next hop vertex of the source vertex.
[0106] In one possible scenario, before sending the first request, the computing node may select a first storage node from multiple storage nodes based on the source identifier, and send the first request to that first storage node.
[0107] S430, the first storage node receives the first request.
[0108] The first storage node can obtain the first request in several ways. Two possible methods are given below.
[0109] Method 1: The first storage node directly receives the first request sent by the compute node.
[0110] Method 2: The first storage node retrieves the first request from the first storage location. In this case, the compute node stores the first request in the first storage location, which supports the first storage node in retrieving or writing data.
[0111] S440, the first storage node queries the first subgraph data based on the first request and obtains the first query result.
[0112] The first query result includes a first vertex set. The first vertex set includes vertices associated with the source vertex stored in the first storage node. The vertex associated with the source vertex is the vertex with the first hop below the source vertex (or the next hop vertex) in the first subgraph data.
[0113] Depending on how the first vertex set stores local vertices and global vertices, the first storage node can obtain the first query result in different ways, which will be explained in the following cases.
[0114] Case 1: The first vertex set includes two subsets.
[0115] In this case, the first storage node can use the following methods ① to ③ to obtain the first query result.
[0116] ① The first storage node queries the first subgraph data according to the first request and obtains the first vertex set.
[0117] In this scenario, the first storage node queries the first subgraph data to obtain the first hop count vertex associated with the source vertex. Based on this first hop count vertex associated with the source vertex, the first storage node obtains the first vertex set. That is, the first vertex set includes the first hop count vertices associated with the source vertex stored by the first storage node.
[0118] ② The first storage node obtains the first subset and the second subset based on the first vertex set.
[0119] The first storage node iterates through the vertices in the first vertex set, selecting vertices from the first vertex set that have a next hop in the first subgraph data, and storing these vertices in the first subset. The first storage node also selects vertices from the first vertex set that do not have a next hop in the first subgraph data, and stores these vertices in a second subset. The vertices in the first vertex set that have a next hop in the first storage node can also be called local vertices of the first vertex set. The vertices in the first vertex set that do not have a next hop in the first storage node can also be called global vertices of the first vertex set.
[0120] ③ The first storage node obtains the first query result based on the first subset and the second subset.
[0121] The first storage node can directly use the first subset and the second subset as the first query result.
[0122] Case 2: The first vertex set includes a subset, and local vertices and global vertices are explicitly identified.
[0123] In this case, the first storage node can use the following methods ① to ③ to obtain the first query result.
[0124] ① The first storage node queries the first subgraph data according to the first request and obtains the first vertex set.
[0125] The first vertex set includes the vertices associated with the source vertex stored in the first storage node. This process is the same as in case 1, ①, and the relevant description can be found in case 1, ①, which will not be repeated here.
[0126] ②The first storage node obtains the third subset based on the first vertex set.
[0127] The third subset includes labeled vertices and unlabeled vertices. Labeled vertices are local vertices, and unlabeled vertices are global vertices. Local vertices are those in the first vertex set that have a next hop in the first storage node, while global vertices are those in the first vertex set that do not have a next hop in the first storage node.
[0128] The process by which the first storage node obtains the third subset based on the first vertex set can be described as follows: The first storage node iterates through the vertices in the first vertex set one by one, selects vertices from the first vertex set that have a next hop in the first subgraph data (or local vertices), and assigns an identifier to these vertices. The first storage node also selects vertices from the first vertex set that do not have a next hop in the first subgraph data (or global vertices). The first storage node stores the identified local vertices in the third subset, and directly stores the global vertices in the third subset, resulting in a third subset that includes both identified and unidentified vertices.
[0129] The above examples illustrate the process by which the first storage node obtains the third subset based on the first vertex set, using the example of storing local vertices from the first vertex set with identifiers and directly storing all global vertices from the first vertex set into the third subset. In some possible scenarios, the first storage node can also store global vertices with identifiers in the third subset, or directly store local vertices in the third subset to obtain the third subset based on the first vertex set. In other possible scenarios, the first storage node can also store global and local vertices with different identifiers and store both in the third subset to obtain the third subset based on the first vertex set. For example, the first storage node might store a local vertex with identifier 1 and a global vertex with identifier 2, storing both the local vertex with identifier 1 and the global vertex with identifier 2 in the third subset to obtain the third subset based on the first vertex set.
[0130] ③ The first storage node obtains the first query result based on the third subset.
[0131] The first storage node uses the third subset as the first query result.
[0132] The above example, where the first vertex set includes both local and global vertices, illustrates the process by which the first storage node queries the first subgraph data according to the first request and obtains the first query result. In some possible scenarios, the first vertex set may contain only local vertices. In this case, the first storage node can obtain the first subset using the method described in Scenario 1, and use this first subset as the first query result. Alternatively, the first storage node can obtain a third subset, consisting only of labeled vertices or unlabeled vertices, using the method described in Scenario 2, and use this third subset as the first query result. In other possible scenarios, the first vertex set may contain only global vertices. In this case, the first storage node can obtain a second subset using the method described in Scenario 1, and use this second subset as the first query result. Alternatively, the first storage node can obtain a third subset, consisting only of labeled vertices or unlabeled vertices, using the method described in Scenario 2, and use this third subset as the first query result.
[0133] Case 3: The first vertex set includes a subset, and local vertices and global vertices are not explicitly identified.
[0134] In this scenario, the first storage node can obtain the first hop count vertex associated with the source vertex using the method described in scenario 1① above. The first storage node then sends this first hop count vertex associated with the source vertex to the computing node. Upon receiving the first hop count vertex associated with the source vertex, the computing node, based on the first subgraph data stored by the first storage node, retrieves the vertices among the first hop count vertices associated with the source vertex that have a next hop vertex in the first subgraph data, and designates these vertices as local vertices. The computing node also calculates and retrieves the vertices among the first hop count vertices associated with the source vertex that do not have a next hop vertex in the first subgraph data, and designates these vertices as global vertices.
[0135] In one possible scenario, after the first storage node obtains the first query result, if the first query result includes a local vertex, the first storage node queries the next preset hop vertex of the local vertex in the first subgraph data. This next preset hop vertex can refer to the next hop vertex or the next multi-hop vertex of the local vertex in the first subgraph data. The next preset hop can be a hop number directly specified by the user; for example, if the user specifies a next preset hop as 2 based on actual conditions, in this case, the first storage node queries the next two hop vertices of the local vertex in the first subgraph data. The next preset hop can also be obtained by the first storage node according to preset rules, which may include, but are not limited to: determining the next preset hop based on the available computing resources of the storage node, determining the next preset hop based on the load rate of the storage node, etc., which this application does not limit. In some possible scenarios, the next preset hop is also referred to as the preset hop count or preset hop.
[0136] The above describes the process by which the first storage node obtains the next preset jump vertex of the local vertex in the first subgraph data when the preset jump is less than the query jump number and the first subgraph data has a next preset jump of the local vertex.
[0137] In some possible scenarios, the preset hop count might be greater than the difference between the query hop count and the first hop count. In this case, the first storage node retrieves the next first number of hop vertices associated with the local vertex from the first subgraph data. This first number is equal to the difference between the query hop count and the first hop count. For example, the query hop count is 4, the first hop count is 1, and the preset hop count is 4. In this case, since the preset hop count of 4 is greater than the query hop count of 3 (the query hop count of 3 equals the query hop count of 4 minus the first hop count of 1), the first storage node retrieves the next three hop vertices associated with the local vertex from the first subgraph data.
[0138] In other possible scenarios, the first subgraph data may not contain a pre-defined next-hop vertex associated with the local vertex, but it may contain a second number of next-hop vertices associated with the local vertex. In this case, the first storage node retrieves the second number of next-hop vertices associated with the local vertex from the first subgraph data, where the second number is less than the pre-defined hop count. For example, the first subgraph data may contain a second number of next-hop vertices associated with the local vertex, where the pre-defined hop count is 4. In this case, the first storage node retrieves the second number of next-hop vertices associated with the local vertex from the first subgraph data.
[0139] In some possible scenarios, the first storage node can store the pre-queried data in a cache. When the first storage node receives a request to retrieve the pre-queried vertex, it can send all the pre-queried data stored in the cache to the compute node at once, or it can send all the pre-queried data stored in the cache to the compute node multiple times. For example, if the first storage node pre-queries the three-hop vertices associated with the source vertex, and upon receiving a request to retrieve the first-hop vertices associated with the source vertex, the first storage node can send all three-hop vertices associated with the source vertex to the compute node at once, or it can send only the first-hop vertices associated with the source vertex. Other sending strategies can be set according to the needs of the actual application, and this application does not limit them.
[0140] When the first storage node sends all the pre-queried data stored in its cache to the compute node at once, the first vertex set includes the multi-hop vertices associated with the source vertex stored in the first storage node. When the first storage node sends all the pre-queried data stored in its cache to the compute node multiple times, and sends the multi-hop vertices of the source vertex each time, the first vertex set includes the multi-hop vertices associated with the source vertex stored in the first storage node. When the first storage node sends all the pre-queried data stored in its cache to the compute node multiple times, and sends only the next-hop vertex of the source vertex each time, the first vertex set includes the one-hop vertex (or the next-hop vertex of the source vertex) associated with the source vertex stored in the first storage node.
[0141] S450, the first storage node sends the first query result to the compute node.
[0142] The first storage node can send the first query result to the compute node in several ways. Two possible methods are given below.
[0143] Method 1: The first storage node directly sends the first query result to the compute node.
[0144] Method 2: The first storage node stores the first query result in a first storage location, which supports the compute nodes in writing or reading data. The compute nodes also read the first query result from the first storage location.
[0145] In one possible scenario, before executing S450, the first storage node can also remove vertices that appear multiple times in the global vertices (or duplicate vertices) to ensure that there are no duplicate vertices in the global vertices. This reduces the amount of data that needs to be transmitted and improves data query efficiency. For example, if the global vertices are [vertex1, vertex1, vertex2, vertex3, vertex1], in this case, the first storage node removes the duplicate vertices in the global vertices, resulting in the deduplicated global vertices [vertex1, vertex2, vertex3].
[0146] In one possible scenario, before executing S450, the first storage node can also remove vertices that appear multiple times in its local vertices (or duplicate vertices) to ensure that there are no duplicate vertices in the local vertices. This reduces the amount of data that needs to be transmitted and improves data query efficiency. For example, if the local vertices are [vertices 4, 4, 5], in this case, the first storage node removes duplicate vertices from the local vertices, resulting in the deduplicated global vertices being [vertices 4, 5].
[0147] S460, the compute node receives the first query result sent by the first storage node.
[0148] Depending on whether the first storage node uses the same subset to store local and global vertices, the first query result can include different content. If the first storage node uses different subsets to store local and global vertices, the first query result includes the first subset and the second subset. If the first storage node uses the same subset to store local and global vertices, the first query result includes the third subset. For details regarding the first, second, and third subsets, please refer to the relevant descriptions in S440 above; they will not be repeated here.
[0149] The above text combined Figure 4 The process described is as follows: the storage system obtains the first hop vertex associated with the source vertex according to the query request. If the number of hops in the query request is greater than the number of hops in the first hop, the storage system can also execute S470 to obtain the second hop vertex (or second hop vertex) associated with the source vertex according to the vertices included in the first query result.
[0150] The following is combined with Figure 5 This describes the process by which the storage system retrieves the second hop vertex associated with the source vertex from the graph data based on the first query result. Figure 5 A flowchart illustrating the second graph data query method provided in this application is shown below. Figure 5 As shown, S470 may include the following ① to ④.
[0151] ① The compute node generates multiple requests based on the first query result.
[0152] In some possible scenarios, the computing node generates a second request and a third request based on the local vertices and global vertices in the first vertex set included in the first query result. This process may include the following (1) to (3).
[0153] (1) The computing node obtains the local vertices and global vertices in the first vertex set included in the first query result.
[0154] Depending on the content of the first query result received by the computing node, the computing node can use different methods to obtain local vertices and global vertices from the first vertex set, which will be explained below.
[0155] In case a, the first vertex set includes the first subset and the second subset.
[0156] In this scenario, the compute node can obtain the vertices included in the first subset, thus obtaining the local vertices. The compute node can also obtain the vertices included in the second subset, thus obtaining the global vertices.
[0157] In case b, the first vertex set includes the third subset.
[0158] Depending on the method used by the first storage node to mark local vertices and global vertices in the third subset, the compute node can use different methods to obtain local vertices and global vertices from the third subset.
[0159] When the first storage node uses labeled vertices to represent local vertices and unlabeled vertices to represent global vertices, the computing node obtains labeled vertices from the third subset to obtain local vertices and unlabeled vertices from the third subset to obtain global vertices.
[0160] When the first storage node uses unlabeled vertices to represent local vertices and labeled vertices to represent global vertices, the computing node obtains unlabeled vertices from the third subset to obtain local vertices and labeled vertices from the third subset to obtain global vertices.
[0161] When the first storage node uses vertices with a first identifier to represent local vertices and vertices with a second identifier to represent global vertices, the computing node obtains vertices with the first identifier from the third subset to obtain local vertices and vertices with the second identifier from the third subset to obtain global vertices.
[0162] (2) The computing node obtains a third set of vertices based on the local vertices and global vertices.
[0163] The following example, excluding duplicate vertices in the global vertices, illustrates two possible ways for a compute node to obtain a third set of vertices based on local and global vertices.
[0164] Method 1
[0165] The computing node first obtains at least one initial vertex set based on the global vertices. Then, the computing node obtains a third vertex set based on the local vertices and at least one initial vertex set. The specific process includes the following (11) and (12).
[0166] (11) The computing node stores the global vertex in at least one initial vertex set according to the storage location of the global vertex in each storage node included in the storage system.
[0167] Each initial vertex set includes the vertices stored in a storage node from the global vertices.
[0168] For example, the local vertices are [vertex 1, vertex 2, vertex 3], and the global vertices include [vertex 4]. Storage node 1 in the storage system stores vertex 1, vertex 2, and vertex 3; storage node 2 stores vertex 4; and storage node 3 stores vertex 5. In this case, the compute nodes store the global vertices in an initial vertex set 1. The initial vertex set 1 includes vertex 4.
[0169] (12) The computing node removes vertices that are duplicates of the local vertex in each initial vertex set to obtain a third set of vertices.
[0170] The computing node traverses the vertices in each initial vertex set, removing vertices that are duplicates of its local vertex, resulting in a third set of vertex sets. Each vertex set corresponds to one storage node. The third set can be an integer greater than or equal to zero.
[0171] For example, the initial vertex set 1 is [vertex 4], and the local vertices are [vertex 1, vertex 2, vertex 3]. In this case, the compute node traverses each vertex in the initial vertex set 1, removing vertices that are duplicates of the local vertices (i.e., vertex 1, vertex 2, and vertex 3), resulting in the vertex set 1 after removing duplicate vertices, which is [vertex 4]. In this case, the compute node obtains a vertex set (i.e., vertex set 1).
[0172] Method 2
[0173] The computing node obtains an initial vertex set based on the local vertices and the global vertices. The computing node then obtains a third set of vertices based on this initial vertex set, and the specific process includes the following (21) and (22).
[0174] (21) The compute node obtains the vertices that are not local vertices in the global vertices and obtains an initial vertex set.
[0175] For example, the local vertices are [vertex1, vertex2, vertex3], and the global vertices include [vertex4]. The compute node obtains the vertices in the global vertices that are not local vertices, resulting in an initial vertex set 1 of [vertex4].
[0176] (22) The computing node stores each vertex in the initial vertex set in a third number of vertex sets according to the storage location of each vertex in each storage node. One vertex set corresponds to one storage node.
[0177] For example, the computing node obtains vertex set 1 as [vertex 4] based on the storage location of vertex 4 in the storage system (i.e., storage node 2) in the initial vertex set 1. In this case, the computing node obtains a vertex set (i.e., vertex set 1).
[0178] (3) The computing node generates multiple requests based on the local vertex and the third number of vertex sets. This process includes the following (31) to (34).
[0179] (31) The computing node generates a third number of third requests based on the third number of vertex sets.
[0180] In this system, one vertex set corresponds to one storage node, and one third request corresponds to one vertex set. The third request includes the second hop count and the identifiers of all vertices in the vertex set corresponding to the third request in the graph data.
[0181] For example, the third set of vertices includes vertex set 1. Vertex set 1 is [vertex 4], and vertex set 1 corresponds to storage node 2. In this case, the compute node generates a third request based on vertex set 1 and the second hop count. This third request includes the identifier of vertex 4 in storage node 2 and the second hop count.
[0182] (32) The computing node obtains the target vertex in the local vertex according to the storage location of the local vertex in each storage node.
[0183] The storage node where the target vertex is located is different from the storage node corresponding to the vertex set.
[0184] For example, the local vertices are [vertices 1, 2, 3]. Vertices 1, 2, and 3 are stored in storage node 1. A third set of vertices is stored in storage node 2, which is different from the storage node 1 where the local vertices are stored. In this case, the compute node obtains the target vertices from the local vertices as [vertices 1, 2, 3].
[0185] (33) The computing node generates a fourth number of second requests based on the location of the storage node where the target vertex is located.
[0186] In this context, one second request corresponds to one storage node. The fourth quantity is an integer greater than or equal to zero. A second request includes a query identifier and a second hop count. The query identifier instructs the storage node corresponding to the second request to return the next hop or multiple hops to the target vertex that the storage node is querying.
[0187] For example, the target vertices are [vertices 1, 2, 3], and the target vertices are stored in storage node 1. In this case, the compute node generates a second request based on the target vertices. The second request includes a query identifier and a second hop count. The query identifier is used to instruct storage node 1 to return the next hop or next multiple hops of the pre-queried vertex 1, vertex 2, and vertex 3.
[0188] (34) The computing node obtains multiple requests based on the third number of third requests and the fourth number of second requests.
[0189] ② The compute node sends the multiple requests to multiple storage nodes.
[0190] One storage node corresponds to one request.
[0191] If the request is a third request, the compute node sends the third request to the storage node corresponding to the third request. If the request is a second request, the compute node sends the second request to the storage node corresponding to the second request.
[0192] For example, a compute node generates a third request based on vertex set 1 stored in storage node 2, and in this case, the compute node sends the third request to storage node 2. Similarly, a compute node generates a second request based on target vertices stored in storage node 1, and in this case, the compute node sends the second request to storage node 1.
[0193] ③ Each storage node receives its corresponding request and obtains the subquery result based on the request.
[0194] Depending on whether the historical subquery result of the receiving storage node exists as a local vertex, the process by which the storage node obtains the subquery result differs, and will be explained in detail below. The historical subquery result can refer to the hop before the current query hop number (i.e., the first hop number) or multiple hops before it. The following example illustrates the process by which the storage node obtains the subquery result if the historical subquery result refers to the hop before the current query hop number (i.e., the second hop number).
[0195] Scenario A: The historical subquery result of the storage node receiving the request does not contain a local vertex.
[0196] In this scenario, the request received by the storage node is a third request. The storage node queries its stored subgraph data to obtain the next hop of the vertex indicated by the vertex identifier included in the third request, and uses that next hop as the subquery result.
[0197] For example, storage node 2 receives a third request, which includes the identifier of vertex 4 in storage node 2 and the second hop count. In this case, storage node 2 obtains the next hop vertices 5 and 6 of vertex 4 in the subgraph data stored in storage node 2, and storage node 2 uses vertices 5 and 6 as subquery results.
[0198] In scenario B, the historical subquery result of the storage node receiving the request exists in a local vertex.
[0199] In this scenario, the request received by the storage node could be either a third request or a second request.
[0200] If the request received by the storage node is the second request, the storage node queries the subgraph data it stores, obtains the next hop or next multiple hop of the local vertex included in the historical subquery results of the storage node's pre-query, and uses the next hop or next multiple hop as the subquery result.
[0201] If the request received by the storage node is a third request, the storage node queries its stored subgraph data to obtain the next hop of the vertex indicated by the vertex identifier included in the third request. The storage node then obtains the next hop or next multiple hops of the local vertices included in the historical subquery results of the storage node's pre-query. Finally, the storage node uses the next hop of the vertex indicated by the vertex identifier included in the third request and the next hop or next multiple hops of the local vertices included in the historical subquery results as the subquery result.
[0202] ④ The compute node obtains the second query result based on the results of each subquery.
[0203] The compute nodes merge the vertices included in the results of each subquery to obtain the second query result. The process by which the compute nodes obtain the second query result varies depending on the content of the subquery results sent by each storage node.
[0204] If the subquery results sent by each storage node include a first subset and a second subset, the compute node merges the first subset sent by each storage node to obtain a first merged result, and merges the second subset sent by each storage node to obtain a second merged result. The compute node then obtains the second query result based on the first merged result and the second merged result.
[0205] If the subquery results sent by each storage node include a third subset, the compute node merges the third subset sent by each storage node to obtain a third merged result. The compute node then uses this third merged result as the second query result.
[0206] The above example, using the scenario where the first query result includes both global and local vertices, illustrates the process by which a compute node obtains the second query result based on the first query result. In some possible examples, the first query result only includes global vertices. In this case, the compute node generates a third request based solely on the global vertex and retrieves the second query result based on the third request. In other possible examples, the first query result only includes local vertices. In this case, the compute node generates a second request based solely on the global vertex and retrieves the second query result based on the second request. For a detailed description of each of these processes, please refer to the relevant explanations above; they will not be repeated here.
[0207] In some possible scenarios, after each storage node obtains the subquery results, it can also pre-query the next hop or the next preset hop of the local vertices included in each subquery result. For a detailed description of the storage node's pre-query of the next hop or the next preset hop of the local vertices, please refer to S440 above, which will not be repeated here. Depending on the set method of obtaining the preset hop, the number of hops of the local vertices pre-queried by each storage node can be the same or different, and this application does not limit this.
[0208] If the query hop count in the query request is greater than the second hop count, the storage system repeats step S470 to obtain the query hop count vertex associated with the source vertex. For example, based on the second query result, the storage system repeats step S470 to obtain a third query result containing the third hop count vertex associated with the source vertex. And based on the third query result, the storage system repeats step S470 to obtain a fourth query result containing the fourth hop count vertex associated with the source vertex, and so on, until the Nth query result containing the query hop count vertex associated with the source vertex is obtained.
[0209] In some possible scenarios, after obtaining the Nth query result, the compute node can also obtain the attributes of each vertex in the query hop count vertices associated with the source vertex included in the Nth query result. For example, the compute node can obtain the attributes of each vertex from the management node. Taking a vertex indicating an item as an example, the compute node can obtain the item's value, name, generator, consumer, seller, raw materials used to generate the item, etc., from the management node.
[0210] In some possible scenarios, when a compute node obtains the (I-1)th query result, it can also directly obtain multiple vertex sets based on the locations of the storage nodes containing the vertices included in the (I-1)th query result. The compute node generates multiple requests based on each vertex set and the current query hop count (i.e., the I-th hop count), where one vertex set corresponds to one request, and one request corresponds to one storage node. The compute node sends each request to its corresponding storage node and receives the sub-query results returned by each storage node. Based on each sub-query result, the compute node obtains the I-th query result. Here, I is an integer greater than or equal to 1 and less than or equal to the query hop count N.
[0211] In some scenarios, the data exchanged between compute nodes and storage nodes can be referred to as control flow, while the data generated by the storage node executing queries can be referred to as data flow. In some cases, users can use `explain` to interact with the storage system.
[0212] The storage system below includes compute nodes, storage node 1, and storage node 2, with storage node 1 storing... Figure 1A The graph data shown contains subgraph data 1, which is stored in node 2. Figure 1A Taking subgraph data 2 in the illustrated graph data as an example, the data query method provided in this application will be explained by way of example.
[0213] Figure 6A The application provides an architecture flowchart for a graph data query method, such as... Figure 6A As shown, the compute node receives a query request, which includes the source identifier of the source vertex in the graph data and the query hop count K of the source vertex. The compute node generates a request based on the query request and sends it to the storage node. This request includes the source identifier and the current query hop count k. The storage node receives the request and traverses the vertices associated with the k-th hop in the storage node. The storage node classifies the vertices associated with the k-th hop, obtaining local vertices and global vertices among those associated with the k-th hop. The storage node determines whether the current query hop count k is less than or equal to the query hop count K. If the current query hop count k is less than or equal to the query hop count K, the storage node obtains the vertices with a preset hop count associated with the local vertex. The storage node obtains the query result based on the preset hop count vertices associated with the local vertex, the local vertices, and the global vertices. The storage node sends the query result to the compute node. The compute node receives the query result, removes duplicates from the query result, and generates a first vertex set. It then performs the next query based on the first vertex set until it obtains the vertices with a query hop count K managed by the source vertex.
[0214] The above text combined Figures 2 to 6A The data query method provided in this application is described below, in conjunction with... Figure 6B The data query method provided in this application is illustrated by example.
[0215] Figure 6B An example diagram of a graph data query method provided in this application is shown below. Figure 6B As shown, the storage system includes a compute node, storage node 1, and storage node 2, and storage node 1 stores... Figure 1A The subgraph data 1 (referred to as data 1) in the graph data shown is stored in storage node 2. Figure 1A The diagram shows subgraph data 2 (referred to as data 2). Subgraph data 1 includes the vertices in vertex set X [A, C, J, E, D], the connections between vertices in vertex set 1, the connection between vertex A and vertex B, and the connection between vertex D and vertices H and I. Subgraph data 2 includes the vertices in vertex set Y [B, G, H, F, I], the connections between vertices in vertex set 2, the connection between vertex A and vertex B, and the connection between vertex D and vertices H and I.
[0216] The following example illustrates the data query process by storing the subquery results as a first subset and a second subset using the storage vertex method. Figure 6B As shown, the process specifically includes the following ① to ⑦.
[0217] ① The compute node receives query request 1.
[0218] Among them, query request 1 includes the identifier B of vertex B in the graph data and the query hop count 5.
[0219] ② The computing node executes the first query based on query request 1 to obtain the first query result.
[0220] The first query process is as follows: The compute node generates Request 1 based on Query Request 1. Request 1 includes the identifier B and the hop count 1. The compute node sends Request 1 to the storage node 2, which stores vertex B. Storage node 2 queries data 2 to obtain the next-hop vertex of vertex B as [A, G] (or vertex set 1), i.e., the first-hop vertex associated with vertex B is [A, G]. Based on whether the vertices included in vertex set 1 have a next-hop vertex in data 2 (or the second-hop vertex associated with vertex B), storage node 2 obtains subset g1 as [A] and subset l1 as [G]. The vertices included in subset g1 do not have a next-hop vertex in data 2, while the vertices included in subset l1 do have a next-hop vertex in data 2. Storage node 2 sends subset g1 and subset l1 to the compute node. The compute node receives and uses subset g1 and subset l1 as the first query result. The first query result includes subset g1[A] and subset l1[G].
[0221] In one possible scenario, after storage node 2 obtains subsets g1 and l1, storage node 2 pre-queries the next-hop vertex of vertex G in subset l1 to obtain vertex set 2. Vertex set 2 is [B, H]. Then, storage node 2 obtains subset l2 based on whether any vertex in vertex set 2 has a next-hop vertex in storage node 2. Subset l2 is also [B, H].
[0222] ③ The computing node executes a second query based on the first query result to obtain the second query result. This process includes the following (1) and (2).
[0223] (1) The compute node generates request 2 based on subset g1[A] and sends request 2 to storage node 1. Request 2 includes the identifier A of vertex A in data 1 stored on storage node 1 and the hop count 2. Storage node 1 receives request 2 and queries data 1 to obtain the next-hop vertex of vertex A as [C, D, B] (or vertex set 3). Based on whether the vertices included in vertex set 3 have a next-hop vertex in data 1, storage node 1 obtains subset g2 as [B] and subset l3 as [C, D]. Storage node 1 sends subset g2 and subset l3 to the compute node. The compute node receives and uses subset g2 and subset l3 as a second subquery result.
[0224] In one possible scenario, after obtaining subsets g2 and l3 from storage node 1, storage node 1 pre-queries the next hop of subset l3 to obtain vertex set 4. Vertex set 4 is [J, I, H]. Then, based on whether the vertices in vertex set 4 have a next hop vertex in storage node 1, storage node 1 obtains subsets g3 and l4. Subset g3 is [H, I], and subset l4 is [A, J].
[0225] (2) The compute node generates request 3 based on subset l1[G]. Request 3 includes query identifier 1 and hop count 2. Query identifier 1 instructs storage node 2 to return the next hop vertex of subset l1, i.e., subset l2[B, H]. The compute node sends request 3 to storage node 2 to receive subset l2 sent by storage node 2. The compute node uses subset l2 as another second subquery result.
[0226] In one possible scenario, after storage node 1 obtains subset l2, storage node 1 obtains the next-hop vertex of the vertices in subset l2 in data 2, and obtains subset g4 and subset l5. Among them, subset g4 is [A, D], and subset l5 is [G, F].
[0227] The computing nodes merge subsets l2 and l3 to obtain set L1, and obtain set G1 based on subset g2. Among them, set L1 is [C, D, B, H], and set G1 is [B].
[0228] In one possible scenario, the compute node removes the vertices in set G1 that are duplicates of set L1, resulting in G1 being [], which means G1 is an empty set.
[0229] ④ The computing node performs a third query based on the second query result to obtain the third query result. This process includes the following (1) to (4).
[0230] (1) The computing node obtains the storage nodes of the vertices included in the storage set L1[C, D, B, H], and obtains that vertices C and D are stored in storage node 1, and vertices B and H are stored in storage node 1.
[0231] (2) The computing node generates request 4 based on vertices C and D and hop count 3, and requests 5 based on vertices B and H and hop count 3. Request 4 includes query identifier 2 and hop count 3, and requests 5 include query identifier 3 and hop count 3. Query identifier 2 instructs storage node 1 to return subsets g3 and l4. Query identifier 3 instructs storage node 2 to return subsets g4 and l5.
[0232] In one possible scenario, after storage node 1 obtains subsets g3 and l4, and before storage node 1 receives the next request, storage node 1 pre-queries the next-hop vertices of the vertices included in subset l4, obtaining the next-hop vertices [B, C, D] of vertex A and the next-hop vertices [C, E] of vertex J.
[0233] In one possible scenario, after storage node 2 obtains subsets g4 and l5, and before storage node 2 receives the next request, storage node 2 pre-queries the next-hop vertices of the vertices included in subset l5 to obtain the next-hop vertices [B, H] of vertex G and [H] of vertex F.
[0234] (3) The computing node merges subsets g3 and g4 to obtain set G2. And the computing node obtains set L2 based on l4 and l5. Among them, set G2 is [A, H, D, I], and set L2 is [A, J, G, F].
[0235] (4) The compute node uses set G2 and set L2 as the third query result.
[0236] ⑤ The computing node executes the fourth query based on the third query result to obtain the fourth query result.
[0237] In one possible scenario, before the compute node performs the fourth query, the compute node removes vertices from set G2 that are duplicates of those in set L2, resulting in a deduplicated G2. The deduplicated G2 is [H, D, I]. The third query process includes the following steps (1) to (3).
[0238] (1) The computing node generates and sends request 6 to storage node 1 based on vertex D and hop count 4. Storage node 1 receives request 6 and obtains the next hop vertex [A, H, I] of vertex D in data 1, as well as the vertices [B, C, D, C, E] pre-queried based on subset l4. Storage node 1 removes duplicates from [A, H, I] and [B, C, D, C, E] to obtain vertex set 5. Vertex set 5 is [A, B, C, D, H, I, E].
[0239] (2) The compute node generates and sends request 7 to storage node 2 based on vertex H, vertex I, and hop count 4. Storage node 2 receives request 7 and obtains the next-hop vertex [D, G, F] of vertex H in data 2, the next-hop vertex [D] of vertex I in data 2, and the vertices [B, H, H] pre-queried based on subset l5. Storage node 2 merges and removes duplicates from [D, G, F], [D], and [B, H, H] to obtain vertex set 6. Vertex set 6 is [B, D, H, G, F]. Storage node 2 sends vertex set 6 to the compute node. The compute node receives vertex set 6.
[0240] (3) The compute node obtains the fourth query result based on vertex set 5 and vertex set 6.
[0241] This hop query is the previous hop count. The compute node can use all vertices included in the fourth query result as the vertices to be queried, that is, the fourth query result is [A, B, C, D, H, I, E, G, F].
[0242] ⑥ The computing node executes the fifth query based on the fourth query result to obtain the fifth query result.
[0243] The compute node generates request 8 based on [A, C, D, E] and hop count 5, and sends request 8 to storage node 1. Storage node 1, based on request 8, sends [A, B, C, D, H, I, J] to the compute node. The compute node generates request 9 based on [B, H, I, G, F] and hop count 5, and sends request 9 to storage node 2. Storage node 2, based on request 9, sends [A, G, B, H, D, F] to the compute node. The compute node merges [A, B, C, D, H, I, J] and [A, G, B, H, D, F], and removes duplicates from the merged result, obtaining the deduplicated result [A, B, C, D, H, I, E, G, F]. The compute node uses [A, B, C, D, H, I, E, G, F] as the fifth query result.
[0244] ⑦ The compute node obtains the 5-hop vertex associated with vertex B based on the fifth query result.
[0245] The calculation takes the vertex contained in the fifth query result as the 5-hop vertex associated with vertex B (or the next 5 hop vertices of vertex B).
[0246] In this embodiment, the compute node sends a request to the storage node, which includes the source vertex's identifier, to retrieve the vertices associated with the source vertex, obtained by the storage node based on the source vertex and the first hop count. Thus, when the vertices associated with the source vertex include multiple hops, the compute node can retrieve the vertices associated with the source vertex with a single request, avoiding multiple communications between the compute node and the storage node to obtain these multiple hops, shortening the communication time required, and saving the compute node's waiting time. This also avoids the compute node sending requests to all storage nodes to retrieve the vertices associated with the source vertex. Furthermore, it reduces the waiting time for the compute node to wait for the storage node to query graph data, improving query efficiency.
[0247] It is understood that, in order to achieve the functions in the above embodiments, the computing device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, based on the units and method steps described in conjunction with the embodiments disclosed in this application, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application scenario and design constraints of the technical solution.
[0248] The above text combines Figures 2 to 6B The data query method provided in this embodiment is described in detail below. Figure 7 This describes the electronic device cluster provided according to this embodiment.
[0249] This application also provides an electronic device cluster. The electronic device cluster includes at least one electronic device, which can be a computing node or storage node as described in the method embodiments above. The electronic device can be a server, or a terminal device such as a desktop computer, laptop computer, or smartphone. The hardware implementation of the electronic device can be found above. Figure 3 Computing devices.
[0250] like Figure 7 As shown, Figure 7 This application provides a schematic diagram of the structure of an electronic device cluster. The electronic device cluster includes at least one electronic device 300. The memory 312 of one or more electronic devices 300 in the electronic device cluster may store the same instructions for executing application deployment methods.
[0251] In some possible implementations, the memory 312 of one or more electronic devices 300 in the electronic device cluster may also store partial instructions for executing the application deployment method. In other words, a combination of one or more electronic devices 300 can jointly execute the instructions for executing the application deployment method.
[0252] It should be noted that the memory 312 in different electronic devices 300 within the electronic device cluster can store different instructions, each used to execute a portion of the application deployment system's functions. That is, the instructions stored in the memory 312 of different electronic devices 300 can implement the functions of each step in the above method embodiments.
[0253] In some possible implementations, one or more electronic devices in an electronic device cluster can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN). Figure 8 One possible implementation is shown. For example... Figure 8 As shown, Figure 8 This application provides a schematic diagram of an interconnection between electronic devices, where two electronic devices 300A and 300B are connected via a network. Specifically, they are connected to the network through communication interfaces in each electronic device. In this possible implementation, the memory 312 in electronic device 300A stores instructions for implementing the function of S410 in the above method embodiment. Simultaneously, the memory 312 in electronic device 300B stores instructions for implementing the functions of S420 to S470 in the above method embodiment.
[0254] Figure 8 The connection method between the electronic device clusters shown can be that, considering that this application requires multiple electronic devices to perform application deployment, the functions of S420 to S470 in the above method embodiment are to be performed by electronic device 300B.
[0255] It should be understood that Figure 8 The functions of the electronic device 300A shown can also be performed by multiple electronic devices 300. Similarly, the functions of the electronic device 300B can also be performed by multiple electronic devices 300.
[0256] This application also provides a computer program product containing instructions. The computer program product may be a software or program product containing instructions capable of running on an electronic device or stored on any usable medium. When the computer program product is run on at least one electronic device, it causes the at least one electronic device to perform an application deployment method.
[0257] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that an electronic device can store, or a data storage device such as a data center that includes one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct an electronic device to perform an application deployment method.
[0258] This application also provides a chip system including a processor for implementing the functions of the data processing unit in the above-described method. In one possible design, the chip system further includes a memory for storing program instructions and / or data. This chip system may be composed of chips or may include chips and other discrete devices.
[0259] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the processes or functions described in the embodiments of this application are performed entirely or partially. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user equipment, or other programmable device. The computer program or instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, the computer program or instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; it can also be an optical medium, such as a digital video disc (DVD); or it can be a semiconductor medium, such as a solid-state drive (SSD).
[0260] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A graph data query method, characterized in that, The method is applied to a storage system, the storage system including computing nodes and multiple storage nodes, the multiple storage nodes being used to store graph data, each storage node being used to store a portion of the graph data, the method comprising: The computing node receives a query request; the query request includes the source identifier of the source vertex in the graph data and the query hop count of the source vertex; The computing node sends the first request to the first storage node according to the query request; the first request includes the source identifier and the first hop count, the first hop count is less than or equal to the query hop count of the source vertex, and the first storage node is the storage node that stores the source vertex among the plurality of storage nodes; The computing node receives a first query result sent by the first storage node based on the first request; the first query result includes: a first vertex set obtained by the first storage node based on the source vertex and the first hop count, the first vertex set including vertices associated with the source vertex stored by the first storage node.
2. The method according to claim 1, characterized in that, The plurality of storage nodes further includes a second storage node, and the method further includes: The computing node sends a second request to the first storage node, and / or a third request to the second storage node, based on the first vertex set; wherein the second request includes a second hop count and a query identifier, the second hop count is less than or equal to the query hop count and greater than the first hop count, the query identifier is used to instruct the first storage node to return a second vertex set, the second vertex set includes vertices pre-queried by the first storage node based on the first vertex set and a reference hop count, and the third request includes the second hop count and a first identifier of a first vertex, the first vertex being a vertex stored in the second storage node from the first vertex set; The computing node receives the second vertex set sent by the first storage node based on the second request, and / or the third vertex set sent by the second storage node based on the third request; the third vertex set includes vertices obtained by the second storage node based on the first vertex and the second hop count; The computing node obtains a second query result based on at least one of the second vertex set and the third vertex set.
3. The method according to claim 2, characterized in that, Before the computing node sends a second request to the first storage node, and / or sends a third request to the second storage node based on the first vertex set, the method further includes: The computing node obtains local vertices and global vertices from the first vertex set; the local vertex refers to a vertex that has a next hop in the first storage node, and the global vertex refers to a vertex that does not have a next hop in the first storage node; The computing node generates the second request and / or the third request based on the local vertex and the global vertex.
4. The method according to any one of claims 1-3, characterized in that, The first set of vertices includes a first subset and a second subset. The first subset includes local vertices, and the second subset includes global vertices. The local vertices are those with a next hop in the first storage node, and the global vertices are those without a next hop in the first storage node.
5. The method according to claim 4, characterized in that, The computing node obtains local vertices and global vertices from the first vertex set, including: The computing node obtains the local vertices based on the first subset and the global vertices based on the second subset.
6. The method according to any one of claims 1-3, characterized in that, The first set of vertices includes a third subset; the third subset includes labeled vertices and unlabeled vertices; the labeled vertices are local vertices, and the unlabeled vertices are global vertices. The local vertices are those with a next hop in the first storage node, and the global vertices are those without a next hop in the first storage node.
7. The method according to claim 6, characterized in that, The computing node obtains local vertices and global vertices from the first vertex set, including: The computing node obtains the local vertex based on the vertices with identifiers in the first vertex set; The computing node obtains the global vertices based on the unidentified vertices in the first vertex set.
8. The method according to claim 3, characterized in that, The computing node obtains local vertices and global vertices from the first vertex set, including: The computing node obtains the first vertex that has a next hop in the first storage node and obtains the local vertex; The computing node obtains the first vertices that are concentrated in the first storage node and have no next hop, thus obtaining the global vertices.
9. A graph data query method, characterized in that, The method is executed by a storage node that stores graph data, wherein the graph data is the first sub-graph data included in the graph to be queried, and the method includes: The storage node receives a first request; the first request includes the source identifier of the source vertex in the first subgraph data and a first hop count, wherein the first hop count is less than or equal to the query hop count of the source vertex; The storage node queries the first subgraph data according to the first request and obtains a first query result; the first query result includes: a first vertex set obtained by the storage node based on the source vertex and the first hop count, the first vertex set including vertices associated with the source vertex stored by the storage node; The storage node obtains a second query result according to the first request; the second query result includes: vertices pre-queried by the storage node based on a second vertex set and a reference hop count, the second vertex set including: vertices in the first subgraph data that have a next hop included in the historical query results; The storage node sends the first query result and the second query result.
10. The method according to claim 9, characterized in that, The storage node queries the first subgraph data according to the first request and obtains the first query result, including: The storage node queries the first subgraph data according to the first request to obtain the first vertex set; the first vertex set includes the vertices stored by the storage node that are associated with the source vertex; The storage node obtains a first subset and a second subset based on the first vertex set; the first subset includes local vertices, and the second subset includes global vertices. The local vertices are those in the storage node that have a next hop in the first vertex set, and the global vertices are those in the storage node that do not have a next hop in the first vertex set. The storage node obtains the first query result based on the first subset and the second subset.
11. The method according to claim 9, characterized in that, The storage node queries the first subgraph data according to the first request and obtains the first query result, including: The storage node queries the first subgraph data according to the first request to obtain the first vertex set; the first vertex set includes the vertices stored by the storage node that are associated with the source vertex; The storage node obtains a third subset based on the first vertex set; the third subset includes vertices with labels and vertices without labels; the vertices with labels are local vertices, and the vertices without labels are global vertices. The local vertices are those in the first vertex set that have a next hop in the first storage node, and the global vertices are those in the first vertex set that do not have a next hop in the storage node. The storage node obtains the first query result based on the third subset.
12. A graph data query method, characterized in that, The method is applied to a storage system, the storage system including computing nodes and multiple storage nodes, the multiple storage nodes being used to store graph data, each storage node being used to store a portion of the graph data, the method comprising: The computing node receives a query request; the query request includes the source identifier of the source vertex in the graph data and the query hop count of the source vertex; The computing node sends the first request to the first storage node according to the query request; the first request includes the source identifier and a first hop count, the first hop count is less than or equal to the query hop count of the source vertex, and the first storage node is the storage node that stores the source vertex among the plurality of storage nodes; The first storage node receives the first request; The first storage node queries the first subgraph data based on the first request and obtains a first query result; the first query result includes: a first vertex set obtained by the first storage node based on the source vertex and the first hop count, the first vertex set including vertices associated with the source vertex stored by the first storage node; The computing node receives the first query result sent by the first storage node.
13. The method according to claim 12, characterized in that, The method further includes: The computing node sends a second request to the first storage node, and / or a third request to the second storage node, based on the first vertex set; wherein the second request includes a second hop count and a query identifier, the second hop count is less than or equal to the query hop count and greater than the first hop count, the query identifier is used to instruct the first storage node to return a second vertex set, the second vertex set includes vertices pre-queried by the first storage node based on the first vertex set and a reference hop count, and the third request includes the second hop count and a first identifier of a first vertex, the first vertex being a vertex stored in the second storage node from the first vertex set; The computing node receives the second vertex set sent by the first storage node based on the second request, and / or the third vertex set sent by the second storage node based on the third request; the third vertex set includes vertices obtained by the second storage node based on the first vertex and the second hop count; The computing node obtains a second query result based on at least one of the second vertex set and the third vertex set.
14. A storage system, characterized in that, The storage system includes computing nodes and multiple storage nodes. The multiple storage nodes are used to store graph data, and the graph data stored on each storage node is a portion of the graph to be queried. The computing node receives query requests; The query request includes the source identifier of the source vertex in the graph data and the query hop count of the source vertex; The computing node sends the first request to the first storage node according to the query request; The first request includes the source identifier and a first hop count, wherein the first hop count is less than or equal to the query hop count of the source vertex, and the first storage node is the storage node that stores the source vertex among the plurality of storage nodes; The first storage node receives the first request; The first storage node queries the first subgraph data based on the first request and obtains the first query result; The first query result includes: a first vertex set obtained by the first storage node based on the source vertex and the first hop count, wherein the first vertex set includes vertices associated with the source vertex stored by the first storage node; The computing node receives the first query result sent by the first storage node.
15. The system according to claim 14, characterized in that, The computing node sends a second request to the first storage node, and / or a third request to the second storage node, based on the first vertex set; wherein the second request includes a second hop count and a query identifier, the second hop count is less than or equal to the query hop count and greater than the first hop count, the query identifier is used to instruct the first storage node to return a second vertex set, the second vertex set includes vertices pre-queried by the first storage node based on the first vertex set and a reference hop count, and the third request includes the second hop count and a first identifier of a first vertex, the first vertex being a vertex stored in the second storage node from the first vertex set; The computing node receives the second vertex set sent by the first storage node based on the second request, and the third vertex set sent by the second storage node based on the third request; the third vertex set includes vertices obtained by the second storage node based on the first vertex and the second hop count; The computing node obtains the second query result based on the second vertex set and the third vertex set.
16. The system according to claim 15, characterized in that, Before the computing node sends a second request to the first storage node, and / or sends a third request to the second storage node based on the first vertex set, the method further includes: The computing node obtains local vertices and global vertices from the first vertex set; the local vertex refers to a vertex that has a next hop in the first storage node, and the global vertex refers to a vertex that does not have a next hop in the first storage node; The computing node generates the second request and / or the third request based on the local vertex and the global vertex.
17. A computing cluster, characterized in that, The computing cluster includes at least one computing node, and each computing node includes a transceiver and a processor. The transceiver of the at least one computing node receives a query request initiated by a user, and the processor of the at least one computing node is used to execute the method as described in any one of claims 1-8 according to the query request.
18. A storage cluster, characterized in that, The storage cluster includes at least one storage node, and each storage node includes a memory and a processor. The memory of the at least one storage node is used to store graph data, and the processor of the at least one storage node is used to execute the method as described in any one of claims 9-11.
19. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes computer instructions; when the computer instructions are executed in a computing device, they cause the computing device to perform the method of any one of claims 1-8, or cause the computing device to perform the method of any one of claims 9-11.
20. A computer program product, characterized in that, When the computer program product is run in a computing device, it causes the computing device to perform the method of any one of claims 1-8, or causes the computing device to perform the method of any one of claims 9-11.