Versioning and Eventual Consistency

1 Lee Lorenz, Brent Sheppard Jenkins,
if
I
want
another
yes‐man,
I’ll
build
one!
 Versioning
and
Eventual
Consistency
 COS
461:
Computer
Networks
 ...
Author: Opal Hamilton
1 downloads 0 Views 3MB Size
1

Lee Lorenz, Brent Sheppard

Jenkins,
if
I
want
another
yes‐man,
I’ll
build
one!


Versioning
and
Eventual
Consistency
 COS
461:
Computer
Networks
 Spring
2011
 Mike
Freedman


hDp://www.cs.princeton.edu/courses/archive/spring11/cos461/


2

Ordering
 •  TCP
sequence
numbers
uniquely
order
packets
 –  One
writer
(sender)
sets
the
sequence
number
 –  Reader
(receiver)
orders
by
seq
number


•  But
recall
distributed
storage:

may
be
more
 than
one
writer
 –  One
soluOon:

If
single
server
sees
all
the
writes,
can
 locally
assign
order
in
the
order
received,
not
sent
 –  Recall
parOOoned
storage:

What
about
ordering
 writes
handled
by
different
servers?


3

Time
and
distributed
systems
 •  With
mulOple
events,
what
happens
first?


A shoots B B dies

4

Time
and
distributed
systems
 •  With
mulOple
events,
what
happens
first?


B shoots A A dies

5

Time
and
distributed
systems
 •  With
mulOple
events,
what
happens
first?


A shoots B

B shoots A

A dies

B dies

6

Just
use
Ome
stamps?

 •  Need
synchronized
clocks
 •  Clock
synch
via
a
Ome
server


p

Time server S

7

CrisOan’s
Algorithm

 •  Uses
a
!me
server
to
synchronize
clocks
 •  Time
server
keeps
the
reference
Ome
 •  Clients
ask
server
for
Ome
and
adjust
their
local
 clock,
based
on
the
response
 –  But
different
network
latency

→

clock
skew?


•  Correct
for
this?

For
links
with
symmetrical
latency:
 




RTT

=

Tresp
received
–
Treq
sent
 Tnew
local
 
=

Tserver

+

(RTT
/
2)
 Errorclock
 
=

Tnew
local

–

Told
local


8

Is
this
sufficient?
 •  Server
latency
due
to
load?
 –  If
can
measure

Tnew
local

=

Tserver
+
(RTT
+
lag
/
2)


•  But
what
about
asymmetric
latency?
 –  RTT
/
2
not
sufficient!


•  What
do
we
need
to
measure
RTT?
 –  Requires
no
clock
dria!


•  What
about
“almost”
concurrent
events?
 –  Clocks
have
micro/milli‐second
precision


9

Events
and
Histories
 •  Processes
execute
sequences
of
events
 •  Events
can
be
of
3
types:

 –  local,
send,
and
receive


•  The
local
history
hp
of
process
p
is
the
 sequence
of
events
executed
by
process



10

Ordering
events
 •  ObservaOon
1:

 –  Events
in
a
local
history
are
totally
ordered
 Process / Host

time

•  ObservaOon
2:

 –  For
every
message
m,
send(m)

precedes

receive(m)
 Host 1

m Host 2

time

time

11

Happens‐Before

(Lamport
[1978])
 •  
RelaOve
Ome?

Define

Happens‐Before
(→)
:
 –  On
the
same
process:
 
a
→
b,
if
!me(a)