distributed systems cs 15-440 programming models- part v replication and consistency- part i lecture...
TRANSCRIPT
![Page 1: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/1.jpg)
Distributed SystemsCS 15-440
Programming Models- Part V
Replication and Consistency- Part I
Lecture 18, Oct 29, 2014
Mohammad Hammoud
1
![Page 2: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/2.jpg)
Today… Last Session:
Programming Models – Part IV: Pregel
Today’s Session: Programming Models – Part V: GraphLab Replication and Consistency- Part I: Motivation, Overview & Types of
Consistency Models
Announcements: Project 3 is now posted. It is due on Wednesday Nov 12, 2014 by
midnight PS4 is now posted. It is due on Saturday Nov 15, 2014
by midnight We will practice more on MPI tomorrow in the recitation
2
![Page 3: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/3.jpg)
Objectives
Discussion on Programming Models
Why parallelizing our programs?
Parallel computer architectures
Traditional Models of parallel programming
Types of Parallel Programs
Message Passing Interface (MPI)
MapReduce, Pregel and GraphLab
MapReduce, Pregel and GraphLab
Last 4 Sessions
Cont’d
![Page 4: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/4.jpg)
Objectives
Discussion on Programming Models
Why parallelizing our programs?
Parallel computer architectures
Traditional Models of parallel programming
Types of Parallel Programs
Message Passing Interface (MPI)
MapReduce, Pregel and GraphLab
![Page 5: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/5.jpg)
The GraphLab Analytics Engine
5
GraphLab
Motivation &
Definition
The Programming
Model
Input, Output &
Components
The Architectural
Model
Fault-Tolerance
The Computation
Model
![Page 6: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/6.jpg)
Motivation for GraphLab
There is an exponential growth in the scale of Machine Learning and Data Mining (MLDM) algorithms
Designing, implementing and testing MLDM at large-scale are challenging due to: Synchronization Deadlocks Scheduling Distributed state management Fault-tolerance
The interest on analytics engines that can execute MLDM algorithms automatically and efficiently is increasing MapReduce is inefficient with iterative jobs (common in MLDM algorithms) Pregel cannot run asynchronous problems (common in MLDM algorithms)
6
![Page 7: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/7.jpg)
What is GraphLab?
GraphLab is a large-scale graph-parallel distributed analytics engine
Some Characteristics:• In-Memory (opposite to MapReduce and similar to Pregel)• High scalability• Automatic fault-tolerance• Flexibility in expressing arbitrary graph algorithms (more flexible
than Pregel)• Shared-Memory abstraction (opposite to Pregel but similar to
MapReduce)• Peer-to-peer architecture (dissimilar to Pregel and MapReduce)• Asynchronous (dissimilar to Pregel and MapReduce)
7
![Page 8: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/8.jpg)
The GraphLab Analytics Engine
8
GraphLab
Motivation &
Definition
The Programming
Model
Input, Output &
Components
The Architectural
Model
Fault-Tolerance
The Computation
Model
![Page 9: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/9.jpg)
GraphLab assumes problems modeled as graphs
It adopts two phases, the initialization and the execution phases
Input, Graph Flow and Output
9
Initialization PhaseInitialization Phase GraphLab Execution PhaseGraphLab Execution Phase
Distributed File system
(MapReduce) Graph Builder
Distributed File system
Raw Graph Data
Raw Graph Data
Raw Graph Data
Raw Graph Data
Parsing + PartitioningParsing +
Partitioning
Atom Collection
Atom Collection
Index Construction
Index Construction
Atom IndexAtom Index
Atom File
Atom File
Atom File
Atom File
Atom File
Atom File
Atom File
Atom File
Atom File
Atom File
Atom File
Atom File
Cluster Distributed File system
TCP RPC Comms
TCP RPC Comms
Atom IndexAtom Index
Atom File
Atom File
Atom File
Atom File
Atom File
Atom File
Atom File
Atom File
Atom File
Atom File
Atom File
Atom File
Monitoring + Atom
Placement
Monitoring + Atom
Placement
GL EngineGL Engine
GL EngineGL Engine
GL EngineGL Engine
![Page 10: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/10.jpg)
Components of the GraphLab Engine: The Data-Graph
The GraphLab engine incorporates three main parts:1. The data-graph, which represents the user program state at a cluster machine
10
Data-Graph
Vertex
Edge
![Page 11: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/11.jpg)
The GraphLab engine incorporates three main parts:2. The update function, which involves two main sub-functions:
2.1- Altering data within a scope of a vertex
2.2- Scheduling future update functions at neighboring vertices
vv
Sv
The scope of a vertex v (i.e., Sv) is the data stored in v and in all v’s adjacent edges and vertices
Components of the GraphLab Engine: The Update Function
![Page 12: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/12.jpg)
Components of the GraphLab Engine: The Update Function
The GraphLab engine incorporates three main parts:2. The update function, which involves two main sub-functions:
2.1- Altering data within a scope of a vertex
2.2- Scheduling future update functions at neighboring vertices
The update function
Schedule v
![Page 13: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/13.jpg)
Components of the GraphLab Engine: The Update Function
The GraphLab engine incorporates three main parts:2. The update function, which involves two main sub-functions:
2.1- Altering data within a scope of a vertex
2.2- Scheduling future update functions at neighboring vertices
CPU 1CPU 1
CPU 2CPU 2
ee ff gg
kkjjiihh
ddccbbaa bb
iihh
aa
ii
bb ee ff
jj
cc
Sch
edule
rSch
edule
r
The process repeats until the scheduler is emptyThe process repeats until the scheduler is empty
![Page 14: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/14.jpg)
Components of the GraphLab Engine: The Sync Operation
The GraphLab engine incorporates three main parts:3. The sync operation, which maintains global statistics describing data
stored in the data-graph
Global values maintained by the sync operation can be written by all update functions across the cluster machines
The sync operation is similar to Pregel’s aggregators
A mutual exclusion mechanism is applied by the sync operation to avoid write-write conflicts
For scalability reasons, the sync operation is not enabled by default
![Page 15: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/15.jpg)
The GraphLab Analytics Engine
15
GraphLab
Motivation &
Definition
The Programming
Model
Input, Output &
Components
The Architectural
Model
Fault-Tolerance
The Computation
Model
![Page 16: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/16.jpg)
The Architectural Model
GraphLab adopts a peer-to-peer architecture All engine instances are symmetric Engine instances communicate together using Remote Procedure Call
(RPC) protocol over TCP/IP The first triggered engine has an additional responsibility of being a
monitoring/master engine
Advantages: Highly scalable Precludes centralized bottlenecks and single point of failures
Main disadvantage: Complexity
![Page 17: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/17.jpg)
The GraphLab Analytics Engine
17
GraphLab
Motivation &
Definition
The Programming
Model
Input, Output &
Components
The Architectural
Model
Fault-Tolerance
The Computation
Model
![Page 18: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/18.jpg)
The Programming Model
GraphLab offers a shared-memory programming model
It allows scopes to overlap and vertices to read/write from/to their scopes
![Page 19: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/19.jpg)
Consistency Models in GraphLab
GraphLab guarantees sequential consistency Provides the same result as a sequential execution of the computational steps
User-defined consistency models Full Consistency Vertex Consistency Edge Consistency
19
Vertex v
![Page 20: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/20.jpg)
Consistency Models in GraphLab
D1 D2 D3 D4 D5
D1↔2D1↔2 D2↔3
D2↔3 D3↔4D3↔4 D4↔5
D4↔5
1 2 3 4 5
D1 D2 D3 D4 D5
D1↔2D1↔2 D2↔3
D2↔3 D3↔4D3↔4 D4↔5
D4↔5
1 2 3 4 5
ReadWrite
ReadWrite
D1 D2 D3 D4 D5
D1↔2D1↔2 D2↔3
D2↔3 D3↔4D3↔4 D4↔5
D4↔5
1 2 3 4 5
ReadWrite
![Page 21: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/21.jpg)
The GraphLab Analytics Engine
21
GraphLab
Motivation &
Definition
The Programming
Model
Input, Output &
Components
The Architectural
Model
Fault-Tolerance
The Computation
Model
![Page 22: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/22.jpg)
The Computation Model
GraphLab employs an asynchronous computation model
It suggests two asynchronous engines Chromatic Engine Locking Engine
The chromatic engine executes vertices partially asynchronous It applies vertex coloring (e.g., no adjacent vertices share the same color) All vertices with the same color are executed before proceeding to a different color
The locking engine executes vertices fully asynchronously Data on vertices and edges are susceptible to corruption It applies a permission-based distributed mutual exclusion mechanism to
avoid read-write and write-write hazards
![Page 23: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/23.jpg)
The GraphLab Analytics Engine
23
GraphLab
Motivation &
Definition
The Programming
Model
Input, Output &
Components
The Architectural
Model
Fault-Tolerance
The Computation
Model
![Page 24: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/24.jpg)
Fault-Tolerance in GraphLab
GraphLab uses distributed checkpointing to recover from machine failures
It suggests two checkpointing mechanisms Synchronous checkpointing (it suspends the entire execution of GraphLab) Asynchronous checkpointing
![Page 25: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/25.jpg)
How Does GraphLab Compare to MapReduce and Pregel?
25
![Page 26: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/26.jpg)
GraphLab vs. Pregel vs. MapReduceAspect Hadoop
MapReducePregel GraphLab
Programming Model
Shared-Memory Message-Passing Shared-Memory
Aspect Hadoop MapReduce
Pregel GraphLab
Programming Model
Shared-Memory Message-Passing Shared-Memory
Computation Model
Synchronous Synchronous Asynchronous
Aspect Hadoop MapReduce
Pregel GraphLab
Programming Model
Shared-Memory Message-Passing Shared-Memory
Computation Model
Synchronous Synchronous Asynchronous
Parallelism Model
Data-Parallel Graph-Parallel Graph-Parallel
Aspect Hadoop MapReduce
Pregel GraphLab
Programming Model
Shared-Memory Message-Passing Shared-Memory
Computation Model
Synchronous Synchronous Asynchronous
Parallelism Model
Data-Parallel Graph-Parallel Graph-Parallel
Architectural Model
Master-Slave Master-Slave Peer-to-Peer
Aspect Hadoop MapReduce
Pregel GraphLab
Programming Model
Shared-Memory Message-Passing Shared-Memory
Computation Model
Synchronous Synchronous Asynchronous
Parallelism Model
Data-Parallel Graph-Parallel Graph-Parallel
Architectural Model
Master-Slave Master-Slave Peer-to-Peer
Task/Vertex Scheduling
Model
Pull-Based Push-Based Push-Based
Aspect Hadoop MapReduce
Pregel GraphLab
Programming Model
Shared-Memory Message-Passing Shared-Memory
Computation Model
Synchronous Synchronous Asynchronous
Parallelism Model
Data-Parallel Graph-Parallel Graph-Parallel
Architectural Model
Master-Slave Master-Slave Peer-to-Peer
Task/Vertex Scheduling
Model
Pull-Based Push-Based Push-Based
Application Suitability
Loosely-Connected/
Embarrassingly Parallel Applications
Strongly-Connected Applications
Strongly-Connected Applications (more
precisely MLDM apps)
![Page 27: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/27.jpg)
Today…
Replication and Consistency Motivation Overview Types of Consistency Models
27
A New Chapter
![Page 28: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/28.jpg)
Why Replication?Replication is the process of maintaining the data at multiple computers
Replication is necessary for:1. Improving performance
A client can access the replicated copy of the data that is near to its location
2. Increasing the availability of servicesReplication can mask failures such as server crashes and network disconnection
3. Enhancing the scalability of the systemRequests to the data can be distributed to many servers which contain replicated copies of the data
4. Securing against malicious attacksEven if some replicas are malicious, secure data can be guaranteed to the client by relying on the replicated copies at the non-compromised servers
28
![Page 29: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/29.jpg)
1. Replication for Improving Performance
Example ApplicationsCaching webpages at the client browser
Caching IP addresses at clients and DNS Name Servers
Caching in Content Delivery Network (CDNs)Commonly accessed contents, such as software and streaming media, are cached at various network locations
29
Main Server
Replicated Servers
![Page 30: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/30.jpg)
2. Replication for High-Availability
Availability can be increased by storing the data at replicated locations (instead of storing one copy of the data at a server)
Example: Google File-System replicates the data at computers across different racks, clusters and data-centers
If one computer or a rack or a cluster crashes, then the data can still be accessed from another source
30
![Page 31: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/31.jpg)
3. Replication for Enhancing Scalability
Distributing the data across replicated servers helps in avoiding bottlenecks at the main server
It balances the load between the main and the replicated servers
Example: Content Delivery Networks decrease the load on main servers of the website
31
Main Server
Replicated Servers
![Page 32: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/32.jpg)
4. Replication for Securing Against Malicious Attacks
If a minority of the servers that hold the data are malicious, the non-malicious servers can outvote the malicious servers, thus providing security
The technique can also be used to provide fault-tolerance against non-malicious but faulty servers
Example: In a peer-to-peer system, peers can coordinate to prevent delivering faulty data to the requester
32n = Servers with correct data = Servers with faulty datan = Servers that do not
have the requested data
Number of servers with correct data outvote the
faulty servers
![Page 33: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/33.jpg)
Why Consistency?
In a DS with replicated data, one of the main problems is keeping the data consistent
An example:In an e-commerce application, the bank database has been replicated across two servers
Maintaining consistency of replicated data is a challenge
33
Bal=1000 Bal=1000
Replicated Database
Event 1 = Add $1000 Event 2 = Add interest of 5%
Bal=2000
1 2
Bal=10503 Bal=20504Bal=2100
![Page 34: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/34.jpg)
Overview of Consistency and Replication
Consistency Models
Data-Centric Consistency Models
Client-Centric Consistency Models
Replica Management
When, where and by whom replicas should be placed?
Which consistency model to use for keeping replicas consistent?
Consistency ProtocolsWe study various implementations of consistency models
34
Next lectures
Today’s lecture
![Page 35: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/35.jpg)
Overview
Consistency ModelsData-Centric Consistency Models
Client-Centric Consistency Models
Replica Management
Consistency Protocols
35
![Page 36: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/36.jpg)
Introduction to Consistency and Replication
Process 1 Process 2 Process 3
Local Copy
Distributed data-store
![Page 37: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/37.jpg)
Maintaining Consistency of Replicated Data
37
x=0 x=0 x=0 x=0
Replica 1 Replica 2 Replica 3 Replica n
Process 1
Process 2
Process 3
R(x)b=Read variable x; Result is b
W(x)b= Write variable x; Result is b
P1 =Process P1 =Timeline at P1
R(x)0
R(x)0
W(x)2
x=2 x=2 x=2 x=2
R(x)?R(x)2
W(x)5
R(x)?R(x)5
x=5 x=5 x=5 x=5
DATA-STORE
Strict Consistency •Data is always fresh
• After a write operation, the update is propagated to all the replicas • A read operation will result in reading the most recent write
•If there are occasional writes and reads, this leads to large overheads
![Page 38: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/38.jpg)
Maintaining Consistency of Replicated Data (Cont’d)
38
x=0 x=0 x=0 x=0
Replica 1 Replica 2 Replica 3 Replica n
Process 1
Process 2
Process 3
R(x)b=Read variable x; Result is b
W(x)b= Write variable x; Result is b
P1 =Process P1 =Timeline at P1
R(x)0
R(x)5
W(x)2
x=2 x=2 x=2 x=2
R(x)?R(x)3
W(x)5
R(x)?R(x)5
x=0 x=5 x=3
DATA-STORE
Loose Consistency •Data might be stale
• A read operation may result in reading a value that was written long back• Replicas are generally out-of-sync
•The replicas may sync at coarse grained time, thus reducing the overhead
![Page 39: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/39.jpg)
Trade-offs in Maintaining Consistency
Maintaining consistency should balance between the strictness of consistency versus efficiency
Good-enough consistency depends on your application
39
Strict Consistency
Generally hard to implement, and is inefficient
Loose Consistency
Easier to implement, and is efficient
![Page 40: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/40.jpg)
Consistency ModelA consistency model is a contract between
the process that wants to use the data, and
the replicated data repository (or data-store)
A consistency model states the level of consistency provided by the data-store to the processes while reading and writing the data
40
![Page 41: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/41.jpg)
Types of Consistency Models
41
![Page 42: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/42.jpg)
Summary
42
![Page 43: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/43.jpg)
Next Three Classes
Data-Centric Consistency Models
Sequential and Causal Consistency Models
Client-Centric Consistency ModelsEventual Consistency, Monotonic Reads, Monotonic Writes, Read Your Writes and Writes Follow Reads
Replica ManagementReplica management studies:
when, where and by whom replicas should be placed
which consistency model to use for keeping replicas consistent
Consistency ProtocolsWe study various implementations of consistency models
43
![Page 44: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/44.jpg)
References[1] Haifeng Yu and Amin Vahdat, “Design and evaluation of a conit-based continuous consistency model for replicated services”
[2] http://tech.amikelive.com/node-285/using-content-delivery-networks-cdn-to-speed-up-content-load-on-the-web/
[3] http://en.wikipedia.org/wiki/Replication_(computer_science)
[4] http://en.wikipedia.org/wiki/Content_delivery_network
[5] http://www.cdk5.net
[6] http://www.dis.uniroma1.it/~baldoni/ordered%2520communication%25202008.ppt
[7] http://www.cs.uiuc.edu/class/fa09/cs425/L5tmp.ppt
44
![Page 45: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/45.jpg)
Back-up Slides
45
![Page 46: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/46.jpg)
PageRank PageRank is a link analysis algorithm
The rank value indicates an importance of a particular web page
A hyperlink to a page counts as a vote of support
A page that is linked to by many pages with high PageRank receives a high rank itself
A PageRank of 0.5 means there is a 50% chance that a person clicking on a random link will be directed to the document with the 0.5 PageRank
![Page 47: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/47.jpg)
PageRank (Cont’d) Iterate:
Where: α is the random reset probability L[j] is the number of links on page j
1 32
4 65
![Page 48: Distributed Systems CS 15-440 Programming Models- Part V Replication and Consistency- Part I Lecture 18, Oct 29, 2014 Mohammad Hammoud 1](https://reader036.vdocuments.mx/reader036/viewer/2022081503/56649d6e5503460f94a4f9fe/html5/thumbnails/48.jpg)
pagerank(i, scope){ // Get Neighborhood data (R[i], Wij, R[j]) scope;
// Update the vertex data
// Reschedule Neighbors if needed if R[i] changes then reschedule_neighbors_of(i); }
;][)1(][][
iNj
ji jRWiR
PageRank Example in GraphLab PageRank algorithm is defined as a per-vertex operation working on the scope
of the vertex
Dynamic computation
Distributed Systems CS 15-440 Programming Models- Part I Lecture 13, Oct 13, 2014 Mohammad Hammoud 1
Consistency of Assessment (Validation) Webinar – Part 1 Renae Guthridge WA Training Institute (WATI)
Distributed Systems CS 15-440 Programming Models- Part IV Lecture 16, Nov 4, 2013 Mohammad Hammoud 1