SlideShare a Scribd company logo
Presenter: Collaborators:
Min Shen (LinkedIn) Jeremy Simpson (LinkedIn)
Myunghwan Kim (LinkedIn)
Maneesh Varshney (LinkedIn)
Random Walk on Large-
Scale Graphs with Spark
Graph @ LinkedIn
• Connections between 500M LinkedIn members form a large-scale
graph
• Useful information can be extracted from this graph
• Raises the requirement for scalable distributed graph algorithms
Big Graph Challenges
• To make a distributed graph algorithm scale:
– Minimize data transfer between vertices
– Reduce cost of transferring data between vertices
• Challenges we face implementing scalable graph algorithms
– Inefficient to implement on MapReduce
– Specialized graph engines could miss optimization opportunities for certain
algorithms
Random Walk Algorithm
• Random-Walk algorithm is one such example.
Random Walk
• Random walk with personalized restart has applications such as
Personalized PageRank (PPR).
• PPR identifies important nodes in the graph from the perspective of
individual nodes.
• Well suited for generating personalized recommendations of
candidate members for our members to connect to.
Problem Statement
• Input:
– Graph G = <V, E>
– N: Number of random walkers starting from each vertex
– α: Probability to restart/terminate the walk
– L: Max walk length before the random walker terminates the walk
• Output:
– Collections of (s, t) pairs: Each represents a sample of the position t of a random
walker starting from s.
Algorithm Overview
Algorithm pseudo-code on a single processor:
random_walk {
// (s, t): A walker starting vertex s, currently at vertex t
for each local random walker (s, t) {
do {
if (rand(0, 1) < α) {
break
} else {
t = a random neighbor of t
}
} while (t is in local graph partition && walker hasn’t reached max walk length)
if (walker (s, t) not terminated) {
send (s, t) to vertex t
} else {
emit (s, t)
}
}
}
Algorithm Design – Graph Partition
• Graph represented as partitioned adjacency list.
• Each graph partition stored in memory-efficient format supporting:
– Query if a vertex is inside a partition
– Fetch all the neighbor of a local vertex
How Spark makes it better
• Spark’s multi-core execution model
– By making the graph partition data structures JVM-static and thread-safe, they
can be shared between tasks running in the same executor.
– Graph is only physically partitioned across executors.
– With executors of larger number of vcores, the number of physical graph
partitions can be small while the execution parallelism can be high.
Algorithm Design – Stage execution
• Execution of the algorithm is divided into stages:
Algorithm Design – Stage execution
• Example of a single random walker
How Spark makes it better
• Generate routing table from graph partitions as a routing RDD
• Spark’s zipPartition operator efficiently leverages the routing table
How Spark makes it better
• Advantages brought by the zipPartitions operator
– Minimize the size of the routing table
– Graph partition still stored in memory-efficient format
– Only need to shuffle random walkers once per stage
– Bring fault-tolerance to the customized graph partition data structure
Algorithm Design – Reduce Shuffle
• Starting all random walkers at once is not scalable
– Too much data shuffled in the initial stages
• Incremental computation
– Start p% of the random walkers in each stage
– Some old walkers terminate in each stage
– Max number of walkers to process in each stage is bounded by N * p% / α
– We select max number of random walkers to process in each stage vs. total
number of stages
Algorithm Design – Reduce Shuffle
• Illustration of incremental computation
How Spark makes it better
• Illustration of shuffle file reuse
How Spark makes it better
• Spark’s shuffle file management
– Enables us to process random walkers incrementally and effectively gather the
final results
– Each shuffle file is reused twice: between stages and when gathering the final
results
– Leverage external shuffle server to manage the shuffle files so the cost is not
incurred inside Spark executors
Benchmark
• Setup
– 200 executors requested from a shared YARN cluster
– 10G memory and 10 vcores for each executor
– Take the entire LinkedIn member connection graph as input
– N = 500, α = 0.4, L = 20
• Memory foot print of the custom graph partition data structure
Store the graph as an
RDD of adjacency lists
Store the graph using the
custom data structure
300G 260G
Benchmark
• Trade off between workload per stage vs. total number of stages
– % walkers per stage vs. max shuffle size and runtime per stage
Benchmark
• Trade off between workload per stage vs. total number of stages
– % walkers per stage vs. # of stages and total runtime
Conclusion
• Very convenient to implement scalable graph algorithms using
Spark’s programming interface
• Sophisticated algorithm optimization + Spark’s performance =
Efficient scalable graph algorithm implementation
Thanks!
Contact:
Min Shen (mshen@linkedin.com)
Backup slides
What is BSP
• Random walk algorithm can be fit into bulk synchronous parallel
(BSP) computation model.
• BSP proceeds in a series of global supersteps.
Why BSP is not a good fit
• However, for personalized random-walk algorithm:
– Individual walks are independent to each other. There’s no need to synchronize
between the walks.
– The random walker only needs local information when determining which node to
move to. Information about the state/attribute of the previous nodes in the walk
does not need to be piggybacked with the message being sent.
• These observations lead us to designing this algorithm on top of
Spark to leverage:
– Its capability of defining complex computation paradigm beyond simple
MapReduce
– Its flexibility compared with specialized graph processing engines
Algorithm Design – Reduce Shuffle
• Local aggregation of random walkers
– Random walkers generated in each stage could be aggregated

More Related Content

What's hot (20)

PPTX
Apache Spark overview
DataArt
 
PDF
Parquet performance tuning: the missing guide
Ryan Blue
 
PPTX
Key-Value NoSQL Database
Heman Hosainpana
 
ODP
Introduction to Structured Streaming
Knoldus Inc.
 
PDF
Apache spark - Architecture , Overview & libraries
Walaa Hamdy Assy
 
PPTX
Big Data Analytics with Hadoop
Philippe Julio
 
PDF
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...
Databricks
 
PPTX
Hadoop at Bloomberg:Medium data for the financial industry
Matthew Hunt
 
PPTX
Azure Synapse Analytics Overview (r2)
James Serra
 
PDF
Data Pipline Observability meetup
Omid Vahdaty
 
PPTX
PySpark dataframe
Jaemun Jung
 
PPTX
Using Apache Arrow, Calcite, and Parquet to Build a Relational Cache
Dremio Corporation
 
PDF
Kaggle presentation
HJ van Veen
 
PDF
Enterprise Architecture vs. Data Architecture
DATAVERSITY
 
PPTX
Spark architecture
GauravBiswas9
 
PPTX
Apache airflow
Pavel Alexeev
 
PDF
Impact of big data on analytics
Capgemini
 
PDF
Achieving Lakehouse Models with Spark 3.0
Databricks
 
PDF
The Parquet Format and Performance Optimization Opportunities
Databricks
 
PDF
Introduction to Azure Data Lake
Antonios Chatzipavlis
 
Apache Spark overview
DataArt
 
Parquet performance tuning: the missing guide
Ryan Blue
 
Key-Value NoSQL Database
Heman Hosainpana
 
Introduction to Structured Streaming
Knoldus Inc.
 
Apache spark - Architecture , Overview & libraries
Walaa Hamdy Assy
 
Big Data Analytics with Hadoop
Philippe Julio
 
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...
Databricks
 
Hadoop at Bloomberg:Medium data for the financial industry
Matthew Hunt
 
Azure Synapse Analytics Overview (r2)
James Serra
 
Data Pipline Observability meetup
Omid Vahdaty
 
PySpark dataframe
Jaemun Jung
 
Using Apache Arrow, Calcite, and Parquet to Build a Relational Cache
Dremio Corporation
 
Kaggle presentation
HJ van Veen
 
Enterprise Architecture vs. Data Architecture
DATAVERSITY
 
Spark architecture
GauravBiswas9
 
Apache airflow
Pavel Alexeev
 
Impact of big data on analytics
Capgemini
 
Achieving Lakehouse Models with Spark 3.0
Databricks
 
The Parquet Format and Performance Optimization Opportunities
Databricks
 
Introduction to Azure Data Lake
Antonios Chatzipavlis
 

Similar to Random Walks on Large Scale Graphs with Apache Spark with Min Shen (20)

PDF
Distributed processing of large graphs in python
Jose Quesada (hiring)
 
ODP
Spark Deep Dive
Corey Nolet
 
PPTX
PPT.pptx
PalakshVismay1
 
PPTX
Everything About Graphs in Data Structures.pptx
MdSabbirAhmedEkhon
 
PDF
Benchmarking tool for graph algorithms
Yash Khandelwal
 
PDF
Benchmarking Tool for Graph Algorithms
Yash Khandelwal
 
PDF
Graph Algorithms - Map-Reduce Graph Processing
Jason J Pulikkottil
 
PPTX
Basic Graph Algorithms Vertex (Node): lk
ymwjd5j8pb
 
PPT
Bigdata processing with Spark - part II
Arjen de Vries
 
PDF
Introduction to apache spark
UserReport
 
PDF
Ling liu part 02:big graph processing
jins0618
 
PDF
Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...
Databricks
 
PPTX
Dive into spark2
Gal Marder
 
PDF
TriHUG talk on Spark and Shark
trihug
 
PDF
Spark shuffle introduction
colorant
 
PPTX
Automatic Scaling Iterative Computations
Guozhang Wang
 
PPTX
Study Notes: Apache Spark
Gao Yunzhong
 
PPTX
Spark Overview and Performance Issues
Antonios Katsarakis
 
PDF
Zoltán Zvara - Advanced visualization of Flink and Spark jobs

Flink Forward
 
PPTX
Apache Spark GraphX highlights.
Doug Needham
 
Distributed processing of large graphs in python
Jose Quesada (hiring)
 
Spark Deep Dive
Corey Nolet
 
PPT.pptx
PalakshVismay1
 
Everything About Graphs in Data Structures.pptx
MdSabbirAhmedEkhon
 
Benchmarking tool for graph algorithms
Yash Khandelwal
 
Benchmarking Tool for Graph Algorithms
Yash Khandelwal
 
Graph Algorithms - Map-Reduce Graph Processing
Jason J Pulikkottil
 
Basic Graph Algorithms Vertex (Node): lk
ymwjd5j8pb
 
Bigdata processing with Spark - part II
Arjen de Vries
 
Introduction to apache spark
UserReport
 
Ling liu part 02:big graph processing
jins0618
 
Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...
Databricks
 
Dive into spark2
Gal Marder
 
TriHUG talk on Spark and Shark
trihug
 
Spark shuffle introduction
colorant
 
Automatic Scaling Iterative Computations
Guozhang Wang
 
Study Notes: Apache Spark
Gao Yunzhong
 
Spark Overview and Performance Issues
Antonios Katsarakis
 
Zoltán Zvara - Advanced visualization of Flink and Spark jobs

Flink Forward
 
Apache Spark GraphX highlights.
Doug Needham
 
Ad

More from Databricks (20)

PPTX
DW Migration Webinar-March 2022.pptx
Databricks
 
PPTX
Data Lakehouse Symposium | Day 1 | Part 1
Databricks
 
PPT
Data Lakehouse Symposium | Day 1 | Part 2
Databricks
 
PPTX
Data Lakehouse Symposium | Day 2
Databricks
 
PPTX
Data Lakehouse Symposium | Day 4
Databricks
 
PDF
5 Critical Steps to Clean Your Data Swamp When Migrating Off of Hadoop
Databricks
 
PDF
Democratizing Data Quality Through a Centralized Platform
Databricks
 
PDF
Learn to Use Databricks for Data Science
Databricks
 
PDF
Why APM Is Not the Same As ML Monitoring
Databricks
 
PDF
The Function, the Context, and the Data—Enabling ML Ops at Stitch Fix
Databricks
 
PDF
Stage Level Scheduling Improving Big Data and AI Integration
Databricks
 
PDF
Simplify Data Conversion from Spark to TensorFlow and PyTorch
Databricks
 
PDF
Scaling your Data Pipelines with Apache Spark on Kubernetes
Databricks
 
PDF
Scaling and Unifying SciKit Learn and Apache Spark Pipelines
Databricks
 
PDF
Sawtooth Windows for Feature Aggregations
Databricks
 
PDF
Redis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
Databricks
 
PDF
Re-imagine Data Monitoring with whylogs and Spark
Databricks
 
PDF
Raven: End-to-end Optimization of ML Prediction Queries
Databricks
 
PDF
Processing Large Datasets for ADAS Applications using Apache Spark
Databricks
 
PDF
Massive Data Processing in Adobe Using Delta Lake
Databricks
 
DW Migration Webinar-March 2022.pptx
Databricks
 
Data Lakehouse Symposium | Day 1 | Part 1
Databricks
 
Data Lakehouse Symposium | Day 1 | Part 2
Databricks
 
Data Lakehouse Symposium | Day 2
Databricks
 
Data Lakehouse Symposium | Day 4
Databricks
 
5 Critical Steps to Clean Your Data Swamp When Migrating Off of Hadoop
Databricks
 
Democratizing Data Quality Through a Centralized Platform
Databricks
 
Learn to Use Databricks for Data Science
Databricks
 
Why APM Is Not the Same As ML Monitoring
Databricks
 
The Function, the Context, and the Data—Enabling ML Ops at Stitch Fix
Databricks
 
Stage Level Scheduling Improving Big Data and AI Integration
Databricks
 
Simplify Data Conversion from Spark to TensorFlow and PyTorch
Databricks
 
Scaling your Data Pipelines with Apache Spark on Kubernetes
Databricks
 
Scaling and Unifying SciKit Learn and Apache Spark Pipelines
Databricks
 
Sawtooth Windows for Feature Aggregations
Databricks
 
Redis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
Databricks
 
Re-imagine Data Monitoring with whylogs and Spark
Databricks
 
Raven: End-to-end Optimization of ML Prediction Queries
Databricks
 
Processing Large Datasets for ADAS Applications using Apache Spark
Databricks
 
Massive Data Processing in Adobe Using Delta Lake
Databricks
 
Ad

Recently uploaded (20)

PPTX
apidays Helsinki & North 2025 - From Chaos to Clarity: Designing (AI-Ready) A...
apidays
 
PDF
How to Connect Your On-Premises Site to AWS Using Site-to-Site VPN.pdf
Tamanna
 
PDF
apidays Helsinki & North 2025 - Monetizing AI APIs: The New API Economy, Alla...
apidays
 
PDF
What does good look like - CRAP Brighton 8 July 2025
Jan Kierzyk
 
PDF
WEF_Future_of_Global_Fintech_Second_Edition_2025.pdf
AproximacionAlFuturo
 
PPTX
apidays Helsinki & North 2025 - APIs at Scale: Designing for Alignment, Trust...
apidays
 
PPTX
apidays Helsinki & North 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (A...
apidays
 
PPTX
apidays Helsinki & North 2025 - Vero APIs - Experiences of API development in...
apidays
 
PPTX
GenAI-Introduction-to-Copilot-for-Bing-March-2025-FOR-HUB.pptx
cleydsonborges1
 
PDF
apidays Helsinki & North 2025 - How (not) to run a Graphql Stewardship Group,...
apidays
 
PPTX
Aict presentation on dpplppp sjdhfh.pptx
vabaso5932
 
PDF
Avatar for apidays apidays PRO June 07, 2025 0 5 apidays Helsinki & North 2...
apidays
 
PDF
apidays Helsinki & North 2025 - REST in Peace? Hunting the Dominant Design fo...
apidays
 
PDF
Context Engineering for AI Agents, approaches, memories.pdf
Tamanna
 
PPTX
apidays Singapore 2025 - From Data to Insights: Building AI-Powered Data APIs...
apidays
 
PPTX
apidays Singapore 2025 - Designing for Change, Julie Schiller (Google)
apidays
 
PPTX
AI Presentation Tool Pitch Deck Presentation.pptx
ShyamPanthavoor1
 
PDF
Copia de Strategic Roadmap Infographics by Slidesgo.pptx (1).pdf
ssuserd4c6911
 
PDF
apidays Helsinki & North 2025 - APIs in the healthcare sector: hospitals inte...
apidays
 
PPTX
apidays Munich 2025 - Building an AWS Serverless Application with Terraform, ...
apidays
 
apidays Helsinki & North 2025 - From Chaos to Clarity: Designing (AI-Ready) A...
apidays
 
How to Connect Your On-Premises Site to AWS Using Site-to-Site VPN.pdf
Tamanna
 
apidays Helsinki & North 2025 - Monetizing AI APIs: The New API Economy, Alla...
apidays
 
What does good look like - CRAP Brighton 8 July 2025
Jan Kierzyk
 
WEF_Future_of_Global_Fintech_Second_Edition_2025.pdf
AproximacionAlFuturo
 
apidays Helsinki & North 2025 - APIs at Scale: Designing for Alignment, Trust...
apidays
 
apidays Helsinki & North 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (A...
apidays
 
apidays Helsinki & North 2025 - Vero APIs - Experiences of API development in...
apidays
 
GenAI-Introduction-to-Copilot-for-Bing-March-2025-FOR-HUB.pptx
cleydsonborges1
 
apidays Helsinki & North 2025 - How (not) to run a Graphql Stewardship Group,...
apidays
 
Aict presentation on dpplppp sjdhfh.pptx
vabaso5932
 
Avatar for apidays apidays PRO June 07, 2025 0 5 apidays Helsinki & North 2...
apidays
 
apidays Helsinki & North 2025 - REST in Peace? Hunting the Dominant Design fo...
apidays
 
Context Engineering for AI Agents, approaches, memories.pdf
Tamanna
 
apidays Singapore 2025 - From Data to Insights: Building AI-Powered Data APIs...
apidays
 
apidays Singapore 2025 - Designing for Change, Julie Schiller (Google)
apidays
 
AI Presentation Tool Pitch Deck Presentation.pptx
ShyamPanthavoor1
 
Copia de Strategic Roadmap Infographics by Slidesgo.pptx (1).pdf
ssuserd4c6911
 
apidays Helsinki & North 2025 - APIs in the healthcare sector: hospitals inte...
apidays
 
apidays Munich 2025 - Building an AWS Serverless Application with Terraform, ...
apidays
 

Random Walks on Large Scale Graphs with Apache Spark with Min Shen

  • 1. Presenter: Collaborators: Min Shen (LinkedIn) Jeremy Simpson (LinkedIn) Myunghwan Kim (LinkedIn) Maneesh Varshney (LinkedIn) Random Walk on Large- Scale Graphs with Spark
  • 2. Graph @ LinkedIn • Connections between 500M LinkedIn members form a large-scale graph • Useful information can be extracted from this graph • Raises the requirement for scalable distributed graph algorithms
  • 3. Big Graph Challenges • To make a distributed graph algorithm scale: – Minimize data transfer between vertices – Reduce cost of transferring data between vertices • Challenges we face implementing scalable graph algorithms – Inefficient to implement on MapReduce – Specialized graph engines could miss optimization opportunities for certain algorithms
  • 4. Random Walk Algorithm • Random-Walk algorithm is one such example.
  • 5. Random Walk • Random walk with personalized restart has applications such as Personalized PageRank (PPR). • PPR identifies important nodes in the graph from the perspective of individual nodes. • Well suited for generating personalized recommendations of candidate members for our members to connect to.
  • 6. Problem Statement • Input: – Graph G = <V, E> – N: Number of random walkers starting from each vertex – α: Probability to restart/terminate the walk – L: Max walk length before the random walker terminates the walk • Output: – Collections of (s, t) pairs: Each represents a sample of the position t of a random walker starting from s.
  • 7. Algorithm Overview Algorithm pseudo-code on a single processor: random_walk { // (s, t): A walker starting vertex s, currently at vertex t for each local random walker (s, t) { do { if (rand(0, 1) < α) { break } else { t = a random neighbor of t } } while (t is in local graph partition && walker hasn’t reached max walk length) if (walker (s, t) not terminated) { send (s, t) to vertex t } else { emit (s, t) } } }
  • 8. Algorithm Design – Graph Partition • Graph represented as partitioned adjacency list. • Each graph partition stored in memory-efficient format supporting: – Query if a vertex is inside a partition – Fetch all the neighbor of a local vertex
  • 9. How Spark makes it better • Spark’s multi-core execution model – By making the graph partition data structures JVM-static and thread-safe, they can be shared between tasks running in the same executor. – Graph is only physically partitioned across executors. – With executors of larger number of vcores, the number of physical graph partitions can be small while the execution parallelism can be high.
  • 10. Algorithm Design – Stage execution • Execution of the algorithm is divided into stages:
  • 11. Algorithm Design – Stage execution • Example of a single random walker
  • 12. How Spark makes it better • Generate routing table from graph partitions as a routing RDD • Spark’s zipPartition operator efficiently leverages the routing table
  • 13. How Spark makes it better • Advantages brought by the zipPartitions operator – Minimize the size of the routing table – Graph partition still stored in memory-efficient format – Only need to shuffle random walkers once per stage – Bring fault-tolerance to the customized graph partition data structure
  • 14. Algorithm Design – Reduce Shuffle • Starting all random walkers at once is not scalable – Too much data shuffled in the initial stages • Incremental computation – Start p% of the random walkers in each stage – Some old walkers terminate in each stage – Max number of walkers to process in each stage is bounded by N * p% / α – We select max number of random walkers to process in each stage vs. total number of stages
  • 15. Algorithm Design – Reduce Shuffle • Illustration of incremental computation
  • 16. How Spark makes it better • Illustration of shuffle file reuse
  • 17. How Spark makes it better • Spark’s shuffle file management – Enables us to process random walkers incrementally and effectively gather the final results – Each shuffle file is reused twice: between stages and when gathering the final results – Leverage external shuffle server to manage the shuffle files so the cost is not incurred inside Spark executors
  • 18. Benchmark • Setup – 200 executors requested from a shared YARN cluster – 10G memory and 10 vcores for each executor – Take the entire LinkedIn member connection graph as input – N = 500, α = 0.4, L = 20 • Memory foot print of the custom graph partition data structure Store the graph as an RDD of adjacency lists Store the graph using the custom data structure 300G 260G
  • 19. Benchmark • Trade off between workload per stage vs. total number of stages – % walkers per stage vs. max shuffle size and runtime per stage
  • 20. Benchmark • Trade off between workload per stage vs. total number of stages – % walkers per stage vs. # of stages and total runtime
  • 21. Conclusion • Very convenient to implement scalable graph algorithms using Spark’s programming interface • Sophisticated algorithm optimization + Spark’s performance = Efficient scalable graph algorithm implementation
  • 24. What is BSP • Random walk algorithm can be fit into bulk synchronous parallel (BSP) computation model. • BSP proceeds in a series of global supersteps.
  • 25. Why BSP is not a good fit • However, for personalized random-walk algorithm: – Individual walks are independent to each other. There’s no need to synchronize between the walks. – The random walker only needs local information when determining which node to move to. Information about the state/attribute of the previous nodes in the walk does not need to be piggybacked with the message being sent. • These observations lead us to designing this algorithm on top of Spark to leverage: – Its capability of defining complex computation paradigm beyond simple MapReduce – Its flexibility compared with specialized graph processing engines
  • 26. Algorithm Design – Reduce Shuffle • Local aggregation of random walkers – Random walkers generated in each stage could be aggregated