Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
Próximos SlideShares
Carregando em…5
×

# Introducing Apache Giraph for Large Scale Graph Processing

29.900 visualizações

• Full Name
Comment goes here.

Are you sure you want to Yes No

Tem certeza que deseja  Sim  Não
Insira sua mensagem aqui

### Introducing Apache Giraph for Large Scale Graph Processing

1. 1. Introducing Apache Giraph for Large Scale Graph Processing Sebastian Schelter PhD student at the Database Systems and Information Management Group of TU Berlin Committer and PMC member at Apache Mahout and Apache Giraph mail ssc@apache.org blog http://ssc.io
2. 2. Graph recapgraph: abstract representation of a set of objects(vertices), where some pairs of these objects areconnected by links (edges), which can be directed orundirectedGraphs can be used to model arbitrary things likeroad networks, social networks, flows of goods, etc.Majority of graph algorithms Bare iterative and traversethe graph in some way A D C
3. 3. Real world graphs are really large!• the World Wide Web has several billion pages with several billion links• Facebook‘s social graph had more than 700 million users and more than 68 billion friendships in 2011• twitter‘s social graph has billions of follower relationships
4. 4. Why not use MapReduce/Hadoop?• Example: PageRank, Google‘s famous algorithm for measuring the authority of a webpage based on the underlying network of hyperlinks• defined recursively: each vertex distributes its authority to its neighbors in equal proportions pj pi   dj j  ( j , i ) 
5. 5. Textbook approach to PageRank in MapReduce• PageRank p is the principal eigenvector of the Markov matrix M defined by the transition probabilities between web pages• it can be obtained by iteratively multiplying an initial PageRank vector by M (power iteration) p  M p0 k row 1 of M ∙ row 2 of M ∙ pi pi+1 row n of M ∙
6. 6. Drawbacks• Not intuitive: only crazy scientists think in matrices and eigenvectors• Unnecessarily slow: Each iteration is scheduled as separate MapReduce job with lots of overhead – the graph structure is read from disk – the map output is spilled to disk – the intermediary result is written to HDFS• Hard to implement: a join has to be implemented by hand, lots of work, best strategy is data dependent
7. 7. Google Pregel• distributed system especially developed for large scale graph processing• intuitive API that let‘s you ‚think like a vertex‘• Bulk Synchronous Parallel (BSP) as execution model• fault tolerance by checkpointing
8. 8. Bulk Synchronous Parallel (BSP) processorslocal computation superstepcommunicationbarriersynchronization
9. 9. Vertex-centric BSP• each vertex has an id, a value, a list of its adjacent vertex ids and the corresponding edge values• each vertex is invoked in each superstep, can recompute its value and send messages to other vertices, which are delivered over superstep barriers• advanced features : termination votes, combiners, aggregators, topology mutations vertex1 vertex1 vertex1 vertex2 vertex2 vertex2 vertex3 vertex3 vertex3 superstep i superstep i + 1 superstep i + 2
10. 10. Master-slave architecture• vertices are partitioned and assigned to workers – default: hash-partitioning – custom partitioning possible• master assigns and coordinates, while workers execute vertices Master and communicate with each other Worker 1 Worker 2 Worker 3
11. 11. PageRank in Pregelclass PageRankVertex { void compute(Iterator messages) { if (getSuperstep() > 0) { // recompute own PageRank from the neighbors messages pageRank = sum(messages); pj  setVertexValue(pageRank); } pi  j  ( j , i )  dj if (getSuperstep() < k) { // send updated PageRank to each neighbor sendMessageToAllNeighbors(pageRank / getNumOutEdges()); } else { voteToHalt(); // terminate }}}
12. 12. PageRank toy example .17 .33.33 .33 .33 Superstep 0 .17 .17 .17 Input graph .25 .34.17 .50 .34 Superstep 1 A B C .09 .25 .09 .22 .34.25 .43 .34 Superstep 2 .13 .22 .13
13. 13. Cool, where can I download it?• Pregel is proprietary, but: – Apache Giraph is an open source implementation of Pregel – runs on standard Hadoop infrastructure – computation is executed in memory – can be a job in a pipeline (MapReduce, Hive) – uses Apache ZooKeeper for synchronization