The present invention relates to the field of Internet technologies, and specifically, to a graph data processing method and apparatus, and a system.
With rapid development of the Internet, a data volume in the network increases explosively. Valuable information may be obtained by analyzing mass data, so as to discover a new market opportunity or a new business model. However, the data volume in the network is extremely large. To improve data analysis efficiency, data needs to be modeled, that is, data needs to be presented by using a specific model. A graph is excellent in model presentation. The graph can visually present correlated entities and relationships between the entities. Therefore, in many big data analysis scenarios, to-be-processed data is presented in a graph form, and the graph is analyzed and processed, to obtain information required by a user. Data presented in a graph form is usually referred to as graph data, and analysis and processing of the graph data are also referred to as graph computing. A vertex of the graph stores a value corresponding to an entity, and an edge indicates a relationship between entities. Typically, social network data, a call detail record (CDR), a reference relationship between essays, financial transaction data, and the like may be modeled by using a graph. The graph computing has become a basic module in a big data processing system.
As shown in
Because graph data increases rapidly in scale, the scale of the to-be-processed graph data may exceed an entire memory of a graph processing system. As a result, a graph processing task fails. In addition, because the graph data is closely related, if only a part of the graph data is loaded to the memory for processing at a time, an adjacency relationship between vertexes in the graph data is usually destroyed. As a result, the data is poor in locality. Due to the poor locality of the data, data related to currently computed data needs to be read from a magnetic disk frequently in a graph computing process. This causes large I/O overheads.
To better support large-scale graph computing, embodiments of the present invention provide a graph data processing method, to use massive memory resources in a distributed system to process graph data. This ensures normal processing of mass graph data, and reduces I/O overheads of the system. The embodiments of the present invention further provide a corresponding apparatus and system.
According to a first aspect of the present invention, a graph data processing method in a distributed system is provided. The distributed system includes a master node and a plurality of worker nodes. The master node and the worker nodes may be physical hosts connected by using a network, or may be virtual machines deployed on commodity hardware resources. The method includes: obtaining, by the master node, graph data, where the graph data may be obtained by the master node from a specific data source such as a database or a file system, or may be obtained by the master node from a storage resource of the master node, the graph data includes M vertexes and a plurality of directional edges, each edge connects two of the M vertexes, a direction of each edge is from a source vertex to a destination vertex in the two vertexes, and M is an integer greater than 2; dividing, by the master node, the graph data, to obtain P shards, where each shard includes an incoming edge of at least one target vertex, the incoming edge is an edge directed to the target vertex, a sum of quantities of target vertexes corresponding to the P shards is equal to M, the target vertices corresponding to each shard are different, P is a positive integer greater than 1, and the P shards include a first shard and a second shard; determining, by the master node, at least two edge sets from each shard; scheduling, by the master node to at least two worker nodes for processing, at least two edge sets included in the first shard in the P shards; and scheduling, by the master node to the at least two worker nodes for processing, an associate edge set included in the second shard, where the associate edge set is an edge set that includes an outgoing edge of a target vertex corresponding to the first shard, and the outgoing edge is an edge directed from the target vertex in the first shard. The at least two worker nodes are worker nodes to which the edge sets are scheduled, and a quantity of at least two edge sets is not less than a quantity of at least two worker nodes. It can be learned from the first aspect that the graph data is processed by using the distributed system. The graph data is processed into the shards. Then, the shard is further divided into the edges sets. Edge sets in a same shard are scheduled to at least two worker nodes for graph data processing. Massive memory resources in the distributed system are fully used to process the graph data. This ensures normal processing of mass graph data, improves scalability of graph processing in a distributed computing environment, and improves overall throughput of the system. In addition, the outgoing edge of the target vertex in the second shard is scheduled to a worker node of the incoming edge, to reduce input/output (I/O) overheads of communication between the worker nodes and ensure timeliness of graph computing.
With reference to the first aspect, in a first possible implementation, the step of determining, by the master node, at least two edge sets from each shard includes: filling, by the master node, values of edges in the P shards into a data structure in a P×P matrix form according to directions of edges, to obtain P2 data blocks, where each data block is an edge set, each shard includes at least two data blocks, the P×P matrix is formed by using the M vertexes as a horizontal axis and a vertical axis; and if a vertex on the horizontal axis is a source vertex, a vertex on the vertical axis is a destination vertex; or if a vertex on the horizontal axis is a destination vertex, a vertex on the vertical axis is a source vertex. If the shards include a same quantity of target vertexes, the data blocks have a same size. If the shards include different quantities of target vertexes, the data blocks may have different sizes. It can be learned from the first possible implementation of the first aspect that an edge set is determined in a matrix form, so that the edge set is determined in a more orderly way, thereby improving efficiency of determining the edge set, and further improving efficiency of graph data processing.
With reference to the first possible implementation of the first aspect, in a second possible implementation, the method further includes: setting, by the master node, a unique block identifier for each of the P2 data blocks; determining, by the master node, a correspondence between the block identifiers of the P2 data blocks and a plurality of worker nodes; and scheduling, by the master node according to the correspondence to the at least two worker nodes for processing, at least two data blocks included in the first shard. It can be learned from the second possible implementation of the first aspect that the data blocks can be scheduled according to the block identifiers after the block identifiers are set for the data blocks. Therefore, the data blocks are scheduled in a more orderly and more efficient way, so as to improve efficiency of graph data processing.
With reference to the second possible implementation of the first aspect, in a third possible implementation, the step of scheduling, by the master node to the at least two worker nodes for processing, an associate edge set included in the second shard includes: scheduling, by the master node according to the correspondence to the at least two worker nodes for processing, data blocks corresponding to the associate edge set. It can be learned from the third possible implementation of the first aspect that the data blocks in the second shard are also scheduled according to block identifiers. Therefore, the data blocks are scheduled in a more orderly and more efficient way, so as to improve efficiency of graph data processing.
With reference to the second or the third possible implementation of the first aspect, in a fourth possible implementation, the method further includes: setting, by the master node, a synchronization flag, where the synchronization flag is used to instruct a worker node where a first data block is located to perform data synchronization with a worker node where a second data block is located after processing the first data block, the first data block is a last scheduled data block according to a scheduling sequence in the first shard, and the second data block is a last scheduled data block in the data blocks corresponding to the associate edge set. It can be learned from the fourth possible implementation of the first aspect that a synchronization flag needs to be set for worker nodes processing a same group of edge sets to instruct a worker node to perform data synchronization with one or more other worker nodes according to the synchronization flag after the worker node processing a last edge set of the same group, to ensure graph data consistency.
With reference to the first aspect, in a fifth possible implementation, the determining, by the master node, at least two edge sets from each shard includes: determining, by the master node, a degree of a target vertex in each shard, where the degree indicates closeness of association between the target vertex and another vertex; and when a degree of a first target vertex exceeds a preset threshold, classifying, by the master node, incoming edges of the first target vertex into a same edge set. It can be learned from the fifth possible implementation of the first aspect that, to reduce I/O overheads, the edge set may be further obtained by means of classification according to the degree of the target vertex. Incoming edges of target vertexes whose degrees exceed a preset threshold are classified to a same edge set, to reduce I/O overheads of communication between the worker nodes.
According to a second aspect of the present invention, a graph data processing method is provided. The method is applied to a distributed system. The distributed system includes a master node and a plurality of worker nodes. Each worker node includes an I/O interface, a hard disk, a memory, and a processor. The method includes: receiving, by a first worker node by using an I/O interface, X edge sets that are scheduled by the master node according to a scheduling sequence from P shards, where the P shards are obtained after the master node divides graph data, the graph data includes M vertexes and a plurality of directional edges, each edge connects two of the M vertexes, a direction of each edge is from a source vertex to a destination vertex in the two vertexes, M is an integer greater than 2, each shard includes an incoming edge of at least one target vertex, the incoming edge is an edge directed to the target vertex, a sum of quantities of target vertexes corresponding to the P shards is equal to M, the target vertices corresponding to each shard are different, P is a positive integer greater than 1, and X is a positive integer; storing the X edge sets in a hard disk by using the I/O interface of the first worker node; and loading, by a processor of the first worker node to a memory according to the scheduling sequence of the master node, Y edge sets in the X edge sets stored in the hard disk, and extracting data of Z edge sets from the memory for graph computing, where X≥Y≥Z, and X, Y, and Z are all positive integers. It can be learned from the second aspect that the graph data is processed by using the distributed system, so that massive memory resources in the distributed system are fully used to process the graph data. This ensures normal processing of mass graph data, improves scalability of graph processing in a distributed computing environment, and improves overall throughput of the system. In addition, the worker node performs streaming processing on edge sets in a multilevel loading manner according to the scheduling sequence of the master node from the hard disk to the memory and then from the memory to the processor, so as to reduce memory occupation, reduce memory overheads, and improve efficiency of graph computing.
With reference to the second aspect, in a first possible implementation, each edge set is a data block, the P shards include P2 data blocks, the P2 data blocks are obtained after the master node fills values of edges in the P shards into a data structure in a P×P matrix form according to directions of edges, the P shards include a first shard and a second shard, and the method further includes: performing, by the processor of the first worker node, data synchronization with a second worker node where a second data block is located according to a synchronization flag after the processor of the first worker node processing a first data block, where the first data block is a data block that is last scheduled to the first worker node according to a scheduling sequence in the first shard, and the second data block is a data block that is last scheduled to the second worker node in the second shard and that includes an outgoing edge of a target vertex corresponding to the first shard. It can be learned from the first possible implementation of the second aspect that a synchronization flag needs to be set for worker nodes processing a same group of edge sets to instruct a worker node to perform data synchronization with one or more other worker nodes according to the synchronization flag after the worker node processing a last edge set of the same group, to ensure graph data consistency.
According to a third aspect of the present invention, a graph data processing apparatus is provided. The apparatus is configured to implement a function of the method provided in the first aspect or any optional implementation of the first aspect, and is implemented by using hardware/software. The hardware/software includes units corresponding to the foregoing function.
According to a fourth aspect of the present invention, a graph data processing apparatus is provided. The apparatus is configured to implement a function of the method provided in the second aspect or any optional implementation of the second aspect, and is implemented by using hardware/software. The hardware/software includes units corresponding to the foregoing function.
According to a fifth aspect of the present invention, a graph data processing apparatus is provided. The graph data processing apparatus may be a master node in a distributed system. The distributed system further includes a plurality of worker nodes. The graph data processing apparatus includes an I/O interface, a memory, a hard disk, and a processor. The I/O interface is configured to obtain graph data. The graph data may be obtained from an external database, or may be obtained from a storage resource of the graph data processing apparatus, for example, obtained from a hard disk. The graph data includes M vertexes and a plurality of directional edges, each edge connects two of the M vertexes, a direction of each edge is from a source vertex to a destination vertex in the two vertexes, and M is an integer greater than 2. The processor is configured to divide the graph data, to obtain P shards, where each shard includes an incoming edge of at least one target vertex, the incoming edge is an edge directed to the target vertex, a sum of quantities of target vertexes corresponding to the P shards is equal to M, the target vertices corresponding to each shard are different, P is a positive integer greater than 1, and the P shards include a first shard and a second shard. The processor of the graph data processing apparatus is further configured to: determine at least two edge sets from each shard; schedule, by using the I/O interface to at least two worker nodes for processing, at least two edge sets included in the first shard; and schedule, to the at least two worker nodes for processing, an associate edge set included in the second shard, where the associate edge set is an edge set that includes an outgoing edge of a target vertex corresponding to the first shard, and the outgoing edge is an edge directed from the target vertex in the first shard. The at least two worker nodes are worker nodes to which the edge sets are scheduled, and a quantity of at least two edge sets is not less than a quantity of at least two worker nodes.
With reference to the fifth aspect, the processor is specifically configured to implement a function of the method provided in the first aspect or any optional implementation of the first aspect.
According to a sixth aspect of the present invention, a graph data processing apparatus is provided. The graph data processing apparatus may be a worker node in a distributed system. The distributed system further includes a master node. The graph data processing apparatus includes an I/O interface, a memory, a hard disk, and a processor. The I/O interface is configured to receive X edge sets that are scheduled by the master node according to a scheduling sequence from P shards, where the P shards are obtained after the master node divides graph data, the graph data includes M vertexes and a plurality of directional edges, each edge connects two of the M vertexes, a direction of each edge is from a source vertex to a destination vertex in the two vertexes, M is an integer greater than 2, each shard includes an incoming edge of at least one target vertex, the incoming edge is an edge directed to the target vertex, a sum of quantities of target vertexes corresponding to the P shards is equal to M, the target vertices corresponding to each shard are different, P is a positive integer greater than 1, and X is a positive integer. The hard disk is configured to store the X edge sets received by using the I/O interface. The processor loads, to the memory according to the scheduling sequence of the master node, Y edge sets in the X edge sets stored in the hard disk, and extracts data of Z edge sets from the memory for graph computing, where X≥Y≥Z, and X, Y, and Z are all positive integers.
With reference to the sixth aspect, the processor is configured to implement a function of the method provided in the second aspect or any optional implementation of the second aspect, and is implemented by using hardware/software. The hardware/software includes units corresponding to the foregoing function.
According to a seventh aspect of the present invention, a computer storage medium is provided. The computer storage medium stores a graph data processing program in the first aspect or any optional implementation of the first aspect.
According to an eighth aspect of the present invention, a computer storage medium is provided. The computer storage medium stores a graph data processing program in the second aspect or any optional implementation of the second aspect.
According to a ninth aspect of the present invention, a distributed system is provided. The distributed system includes a master node and a plurality of worker nodes. Both the master node and the worker nodes may be independent physical hosts, or may be virtual machines configured on a physical host. The master node may be the graph data processing apparatus described in the third aspect or the fifth aspect. The worker node may be the graph data processing apparatus described in the fourth aspect or the sixth aspect.
According to a tenth aspect of the present invention, a graph data processing method is provided. The method is applied to a distributed system. The distributed system includes a master node and a plurality of worker nodes. The master node and the worker nodes may be independent physical hosts, or may be virtual machines configured on a physical host. The method includes: obtaining, by the master node, graph data, where the graph data may be obtained by the master node from a database, or may be obtained by the master node from a storage resource of the master node, the graph data includes M vertexes and a plurality of directional edges, each edge connects two of the M vertexes, a direction of each edge is from a source vertex to a destination vertex in the two vertexes, and M is a positive integer greater than 2; determining, by the master node, at least two edge sets from the graph data; and scheduling, by the master node, the at least two edge sets to at least two of the plurality of worker nodes for graph computing. It can be learned from the tenth aspect that the graph data is processed by using the distributed system. The edge sets are scheduled to the at least two worker nodes for graph data processing. Massive memory resources in the distributed system are fully used to process the graph data. This ensures normal processing of mass graph data, improves scalability of graph processing in a distributed computing environment, and improves overall throughput of the system.
Embodiments of the present invention provide a graph data processing method, to process and store graph data by using massive memory resources in a distributed system. This ensures normal processing of mass graph data, improves scalability of graph processing in a distributed computing environment, improves overall throughput of the system, and reduces input/output (I/O) overheads of communication between worker nodes. The embodiments of the present invention further provide a corresponding apparatus and system. Details are separately provided in the following.
The following describes the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are merely some but not all of the embodiments of the present invention. In this specification, claims, and accompanying drawings of the present invention, the terms “first”, “second”, “third”, “fourth”, and the like (if exists) are intended to distinguish between similar objects but do not necessarily indicate a specific order or sequence.
For a graph (also referred to as graph data in the embodiments of the present invention), for example, as shown in
An embodiment of the present invention provides a distributed system. The distributed system can be used to process graph data. As shown in
In addition, the distributed system provided in this embodiment of the present invention may be a distributed system in a virtualization scenario. The distributed system in the virtualization scenario is shown in
Specifically, the virtual machines 1002 are one or more virtual computers that are simulated on a common hardware resource by using virtual machine software. The virtual machine works like a real computer. An operating system and an application program can be installed on the virtual machine. The virtual machine can further access a network resource. For an application program running on the virtual machine, the virtual machine works like a real computer.
The hardware layer is a hardware platform running in the virtualization environment, and may be abstract hardware resources of one or more physical hosts. The hardware layer may include various types of hardware. For example, the hardware layer includes a processor 1004 (for example, a CPU) and a memory 1005, and may further include a network adapter 1003 (for example, an RDMA network adapter), a high-speed/low-speed input/output (I/O) device, and another device with a specific processing function.
In addition, the distributed system in the virtualization scenario may further include a host (Host) serving as a management layer, to manage and allocate a hardware resource, present a virtual hardware platform for the virtual machines, and implement scheduling and isolation of the virtual machines. The host may be a virtual machine monitor (VMM). In addition, the VMM sometimes cooperates with a privileged virtual machine to form a host. The virtual hardware platform provides various hardware resources for the virtual machines running on the virtual hardware platform. For example, the virtual hardware platform provides a virtual processor (for example, a VCPU), a virtual memory, a virtual disk, a virtual network adapter, or the like. The virtual disk may be corresponding to a file or a logical block device of the host. The virtual machines run on the virtual hardware platform that is prepared by the host for the virtual machines, and one or more virtual machines run on the host.
The privileged virtual machine is a special virtual machine that may also be referred to as a drive domain. For example, the special virtual machine is referred to as Dom0 on a Xen Hyperviserver platform. Drivers of real physical devices such as a network adapter and a SCSI disk are installed in the virtual machine, so as to detect and directly access these real physical devices. Another virtual machine uses a corresponding mechanism provided by the Hypervisor to access the real physical devices by using the privileged virtual machine.
The distributed system provided in the present invention may use a bulk synchronous parallel (BSP) computing model that is also referred to as a bulk synchronization model or a BSP model. The master is responsible for dividing the entire graph data, allocating a computing task to the worker, and synchronizing messages. Each worker has a message queue, and each superstep is an iteration. In a superstep, each worker reads the message queue of the worker and performs parallel computing. Synchronization is performed between a plurality of supersteps. The workers send messages to exchange data. Specific principles and details of the BSP model belong to the prior art. Details are not provided herein.
The embodiments of the present invention further provide a method for processing graph data by using the distributed system described above. The master node 10 divides and schedules the graph data, processes “big data” into “small data”, and schedules the small data to a plurality of worker nodes for parallel processing. The plurality of worker nodes complete graph computing together, to avoid a problem that a task of processing graph data fails due to insufficient hardware resources especially insufficient memory resources when a single-chip microcomputer or a single physical machine processes the graph data.
Specifically, refer to
As shown in
101. A master node obtains graph data, where the graph data includes M vertexes and a plurality of directional edges, each edge connects two of the M vertexes, a direction of each edge is from a source vertex to a destination vertex in the two vertexes, and M is an integer greater than 2.
The graph data in this embodiment of the present invention may be obtained by the master node from a database used to store graph data, for example, the database 40 shown in
For a form of presenting the graph data and a description about the vertexes and the edges in the graph, refer to
102. The master node divides the graph data, to obtain P shards, where each shard includes an incoming edge of at least one target vertex, the incoming edge is an edge directed to the target vertex, a sum of quantities of target vertexes corresponding to the P shards is equal to M, the target vertices corresponding to each shard are different, P is a positive integer greater than 1, and the P shards include a first shard and a second shard.
It should be noted that, in most scenarios, the master node divides the graph data into a plurality of shards, but in some special scenarios, if the graph data is extremely small, the graph data does not need to be divided, that is, only one shard exists. This embodiment of the present invention is described by using an example of a scenario of a plurality of shards.
The graph data is divided according to the vertexes. The M vertexes may be divided. The shards may be corresponding to a same quantity of vertexes or different quantities of vertexes. The shards are corresponding to different vertexes regardless of whether the shards are corresponding to the same quantity of vertexes or different quantities of vertexes. For example, as shown in
This embodiment of the present invention is described by using an example in which the shards are corresponding to the same quantity of target vertexes. Refer to
103. The master node determines at least two edge sets from each shard.
The edge sets may be determined according to a source vertex. For example, each edge set includes a target vertex in a shard and incoming edges of determined R source vertexes, where R is a positive integer. Alternatively, the edge sets may be determined according to importance degrees of target vertexes, or may be determined according to a matrix form. That the edge sets are determined according to importance degrees of destination vertexes or according to the matrix form is described in detail in the following. Details are not provided herein. Actually, a division manner of the edge set may not be specifically limited, provided that each shard is divided into at least two parts. Because the shard is a set of edges of the target vertexes included in the shard, each part obtained after division may be an edge set.
104. The master node schedules, to at least two worker nodes for processing, at least two edge sets included in the first shard.
The first shard in this embodiment of the present invention is a relative concept. Any shard in the P shards may be understood as the first shard, and a shard other than the first shard may be understood as the second shard. That is, if the shard 1 is the first shard, the shard 2 and the shard 3 are the second shards relative to the shard 1. Likewise, if the shard 2 is the first shard, the shard 1 and the shard 3 are the second shards relative to the shard 2. If the shard 3 is the first shard, the shard 1 and the shard 2 are the second shards relative to the shard 3.
For a process of scheduling edge sets, refer to
It should be noted that the at least two worker nodes in this embodiment of the present invention are worker nodes to which the edge sets are scheduled, and a quantity of at least two edge sets is not less than a quantity of at least two worker nodes.
105. The master node schedules, to the at least two worker nodes (for example, the worker node 1 and the worker node 2 in
106. The worker nodes perform graph computing on the scheduled edge sets.
In this embodiment of the present invention, a relationship between the first shard and the second shard has been described in the foregoing embodiment. Refer to the foregoing description for understanding. Details are not described herein again. As shown in
In this embodiment of the present invention, the graph data is processed by using the distributed system. The graph data is processed into the shards. Then, the edges sets in the shards are scheduled to the at least two worker nodes for graph data processing. Massive memory resources in the distributed system are fully used to process the graph data. This ensures normal processing of mass graph data, improves scalability of graph processing in a distributed computing environment, and improves overall throughput of the system. The outgoing edge of the target vertex in the first shard is scheduled to a worker node of the incoming edge, to reduce input/output (I/O) overheads of communication between the worker nodes.
A logical architecture of the distributed system is shown in
In another embodiment of the graph data processing method provided in the embodiments of the present invention, that the master node determines at least two edge sets from each shard may include:
In this embodiment of the present invention, if the vertexes in the graph data are horizontally and vertically arranged, when a vertex on a horizontal axis is a source vertex, a vertex on a vertical axis is a destination vertex; or if a vertex on a horizontal axis is a destination vertex, a vertex on a vertical axis is a source vertex. In this way, an M×M matrix can be formed, including M×M blocks. A value of an edge from a source vertex and a destination vertex can be filled in each block. During processing, the graph data is scheduled according to the edge sets. Therefore, the M×M matrix may be processed according to the quantity of target vertexes included in each shard. For example, if each shard includes N target vertexes, the graph data can be processed into a P×P matrix, and P=M/N. Certainly, if the shards include different quantities of target vertexes, the graph data can also be processed into a P×P matrix, and data blocks have different sizes in a data structure of the formed matrix form. It can be learned from the foregoing that an edge set is determined in a matrix form, so that the edge set is determined in a more orderly way, thereby improving efficiency of determining the edge set, and further improving efficiency of graph data processing.
As shown in
As shown in
Optionally, in another embodiment of the graph data processing method provided in the embodiments of the present invention, the method may further include:
That the master node schedules, to at least two worker nodes for processing, at least two edge sets included in the first shard may include:
In this embodiment of the present invention, for ease of scheduling, a block identifier that can indicate a sequence relationship may be set for each data block. For example, as shown in
After the block identifier is set for the data block, it is necessary to record the correspondence between the block identifier and the data block, to facilitate proper scheduling. After the block identifier is set, the master node only needs to schedule the data blocks of the incoming edges to the worker nodes according to the sequence of setting the block identifiers. It can be learned from the foregoing that the data blocks can be scheduled according to the block identifiers after the block identifiers are set for the data blocks. Therefore, the data blocks are scheduled in a more orderly and more efficient way, so as to improve efficiency of graph data processing.
Optionally, in another embodiment of the graph data processing method provided in the embodiments of the present invention, that the master node schedules, to the at least two worker nodes for processing, an associate edge set included in the second shard may include:
In this embodiment of the present invention, as shown in
From a perspective of a worker node, in another embodiment of the graph data processing method provided in the embodiments of the present invention, each worker node includes an I/O interface, a hard disk, a memory, and a processor.
A first worker node receives, by using an I/O interface, X edge sets that are scheduled by a master node according to a scheduling sequence from P shards. The P shards are obtained after the master node divides graph data. The graph data includes M vertexes and a plurality of directional edges. Each edge connects two of the M vertexes. A direction of each edge is from a source vertex to a destination vertex in the two vertexes. M is an integer greater than 2. Each shard includes an incoming edge of at least one target vertex. The incoming edge is an edge directed to the target vertex. A sum of quantities of target vertexes corresponding to the P shards is equal to M. The target vertices corresponding to each shard are different. P is a positive integer greater than 1, and X is a positive integer.
The X edge sets are stored in a hard disk by using the I/O interface of the first worker node.
A processor of the first worker node loads, to a memory according to the scheduling sequence of the master node, Y edge sets in the X edge sets stored in the hard disk, and extracts data of Z edge sets from the memory for graph computing, where X≥Y≥Z, and X, Y, and Z are all positive integers.
In this embodiment of the present invention,
As shown in
Generally, a quantity of edge sets in a hard disk of a worker node is greater than a quantity of edge sets in a memory, and the quantity of edge sets in the memory is greater than a quantity of edge sets processed by a CPU. During graph computing, the CPU loads a small quantity of edge sets to the memory according to a scheduling sequence, and then performs graph computing on the edge sets one by one according to the scheduling sequence. That is, the worker node uses a streaming processing manner. In the streaming processing manner, the memory can be less occupied, memory overheads can be reduced, and efficiency of graph computing can be improved.
Optionally, from a perspective of the master node, in another embodiment of the graph data processing method provided in the embodiments of the present invention, the method may further include:
The synchronization flag is used to instruct a worker node where a first data block is located to perform data synchronization with a worker node where a second data block is located after processing the first data block. The first data block is a last scheduled data block according to a scheduling sequence in the first shard, and the second data block is a last scheduled data block in the data blocks corresponding to the associate edge set.
In this embodiment of the present invention, a shard 1, a shard 2, and a shard 3 are used as an example. Three data blocks 1, 4, and 7 in the shard 1, a data block 2 in the shard 2, and a data block 3 in the shard 3 belong to an edge set associated with destination vertexes 1 and 2. The data blocks 1, 4, 7, 2, and 3 may be understood as a data group. Because the data blocks 1, 4, and 7 are not scheduled to a same worker node, a worker node needs to be synchronized with another node after the worker node processing a last data block in a group allocated to the worker node. After all worker nodes complete processing all data blocks in this group, the worker node can perform graph computing of a next group of data blocks.
As shown in
Optionally, in another embodiment of the graph data processing method provided in the embodiments of the present invention, that the master node determines the at least two edge sets from each shard may include:
As described in the foregoing embodiment, shards are obtained by means of division according to a matrix form. Actually, to reduce I/O overheads, the edge sets can be obtained by means of classification according to degrees of target vertexes. For example, in target vertexes corresponding to the shard 1, if a degree of a target vertex 2 is extremely high and exceeds a preset threshold, all incoming edges of the target vertex 2 may be classified to a same edge set.
In an embodiment, if the distributed system uses the deployment manner shown in
In an embodiment, if the distributed system uses the deployment manner shown in
Referring to
The obtaining unit 601 may be the I/O interface in
The obtaining unit 601 may perform an operation process of step 101 in
The processing unit 602 may perform an operation process of step 102 in
The determining unit 603 may perform an operation process of step 103 in
The scheduling unit 604, the setting unit 605, and the recording unit 606 may separately perform corresponding operation processes of the graph data processing method.
For functions of the foregoing units, refer to related descriptions corresponding to
Referring to
The receiving unit 701, the first storage unit 702, the second storage unit 703, and the processing unit 704 may separately perform operation processes corresponding to the worker node side in the graph data processing method. For functions of the units 701 to 704, refer to descriptions on the worker node side in the graph data processing method. Details are not described herein again.
A person of ordinary skill in the art may understand that all or some steps performed by the master node and the worker nodes described in the foregoing embodiments may be implemented by a program instructing related hardware (such as a processor). The program may be stored in a computer readable storage medium. The storage medium may include: a ROM, a RAM, a magnetic disk, an optical disc, or the like. According to a general explanation, the term “program” used in this embodiment of the present invention should include but not be limited to an instruction, an instruction set, code, a code segment, a subroutine, a software module, an application, a software package, a thread, a process, a function, a firmware, a middleware, and the like.
The graph data processing method and apparatus, and the system provided in the embodiments of the present invention are described in detail above. The principles and implementations of the present invention are describes herein by using specific examples. The description about the embodiments is merely used to help understand the method and core ideas of the present invention. In addition, a person of ordinary skill in the art can make modifications to the present invention in terms of the specific implementations and application scopes according to the ideas of the present invention. Therefore, the content of this specification shall not be construed as a limit to the present invention.
Number | Date | Country | Kind |
---|---|---|---|
201611081960.0 | Nov 2016 | CN | national |
This application is a continuation of International Patent Application No. PCT/CN2017/112117, filed on Nov. 21, 2017, which claims priority to Chinese Patent Application No. 201611081960.0, filed on Nov. 30, 2016. The disclosures of the aforementioned applications are hereby incorporated by reference in their entireties.
Number | Name | Date | Kind |
---|---|---|---|
20130042082 | Tamura | Feb 2013 | A1 |
20140143280 | Duan et al. | May 2014 | A1 |
20140351239 | Davis | Nov 2014 | A1 |
20150120697 | Asner et al. | Apr 2015 | A1 |
20150302063 | Nigam | Oct 2015 | A1 |
20160110434 | Kakaraddi et al. | Apr 2016 | A1 |
20170083566 | Das | Mar 2017 | A1 |
20170091334 | Kabiljo | Mar 2017 | A1 |
Number | Date | Country |
---|---|---|
101986661 | Mar 2011 | CN |
102722553 | Oct 2012 | CN |
103294807 | Sep 2013 | CN |
103631878 | Mar 2014 | CN |
104331270 | Feb 2015 | CN |
104572651 | Apr 2015 | CN |
104899156 | Sep 2015 | CN |
104952032 | Sep 2015 | CN |
105138536 | Dec 2015 | CN |
105205033 | Dec 2015 | CN |
105224528 | Jan 2016 | CN |
105590321 | May 2016 | CN |
105677755 | Jun 2016 | CN |
106202175 | Dec 2016 | CN |
106354729 | Jan 2017 | CN |
Entry |
---|
Yu Tao, “Research on Segmentation and Computing Platform of Large Scale Graphs,” Fudan University, Chinese Excellent Master″s Dissertation Full-text Database, 2013, Issue 3, 2 pages (English abstract). |
Office Action issued in Chinese Application No. 201611081960.0 dated Mar. 25, 2021, 30 pages (with English translation). |
Gonzalez et al., “GraphX: Graph Processing in a Distributed Dataflow Framework” 11th USENIX Symposium on Operating Systems Design and Implementation Oct. 6-8, 2014, 16 pages. |
Ham et al., “Graphicionado: A High-Performance and Energy-Efficient Accelerator for Graph Analytics”, IEEE/ACM MICRO 2016, 13 pages. |
Kyrola, et al., “GraphChi: Large-scale graph computation on just a PC” 10th USENIX Symposium on Operating Systems Design and Implementation, OSDI 2012, 16 pages. |
Low, et al., “GraphLab: A New Parallel Framework for Machine Learning” arXiv:1006.4990v1 [cs.LG], Jun. 25, 2010, 11 pages. |
PCT International Search Report and Written Opinion in International Application No. 2017/112,117, dated Feb. 26, 2018, 16 pages (With English translation). |
Wu et al., “Big Data Management and Processing, part 17, Large Graph Computing Systems” K29224_C017, 2017, 18 pages. |
Zhou et al., “Fast Iterative Graph Computation with Resource Aware Graph Parallel Abstractions” HPDC'15, Jun. 15-20, 2015, 12 pages. |
Zhu et al., “Gemini: A Computation-Centric Distributed Graph Processing System” 12th USENIX Symposium on Operating Systems Design and Implementation, Nov. 2-4, 2016, 17 pages. |
Tychyg's Blog (online), “Summary of Clustering Algorithms in Complex Networks,” post by user “Have Fun with Data” (FDI#KE), retrieved from URL <https://www.cnblogs.com/tychyg/p/5277137.html>, Mar. 2016, 8 pages (with English abstract). |
Chitra et al., “Global Vertex-Edge Domination Sets in Total Graph and Product Graph of Path Pn Cycle Cn,” International Conference on Mathematical Modelling and Scientific Computation, Mar. 2012, 10 pages. |
Office Action issued in Chinese Application No. 201611081960.0 dated Sep. 24, 2021, 7 pages (with English translation). |
Number | Date | Country | |
---|---|---|---|
20190278808 A1 | Sep 2019 | US |
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2017/112117 | Nov 2017 | US |
Child | 16426287 | US |