►
From YouTube: RustConf 2018 - Using Raft in Rust by Siddon Tang
Description
RustConf 2018 - Using Raft in Rust by Siddon Tang
The Raft consensus algorithm has been widely adopted in many companies to build a consistent distributed services that are highly available. This topic is about how we implemented Raft in rust to support TiKV, an open-Source distributed transactional Key-Value store. In this topic, I will first give a brief introduction about Raft, and then talk about our Raft implementation in Rust, and in the end, I will show you how to use Raft in Rust to build a simple distributed Key-Value database.
A
Thank
you
very
glad
to
see
you
here
and
it's
not
easy.
I
have
a
long
journey
flying
from
Tyler
to
the
San
Francisco
and
there's
some
Francesa
go
to
tea
to
Poland.
So
very
glad
to
see
you
here
and
today.
I
will
talk
about
how
we're
using
rough-in
Ross
already
put
it
here:
load
rock
free,
oh
great,
amazing,
two
men
and
before
I
start
I
will,
let
me
introduce
myself.
A
A
We
call
it
high
kv
and
is
everything
in
rust
and
in
my
spare
tire,
and
we
also
open
source
Nara
and
have
developed
some
open
sources
like
Russell
Crowe
issues,
and
that
was
rough
eyes
and
we,
which
I
will
talk
about
rate
the
Roth
is,
and
the
java
sea
ice
and
the
cold
Mexico.
The
next
be
is
a
cetera,
that's
what
today's
this
is
agenda
for
this
talk.
A
I
have
four
parts
and
at
first
I
will
talk
about
why
we
needed
to
use
a
raft
and,
at
the
end,
I
will
give
a
brief
introduction
about
raft
and
there
I
will
show
you
how
we
use
rough
in
a
row
in
the
RUS,
sorry
and
I.
Didn't
yell
I
will
talk
about
something
about
our
product.
Tv.
Ok,
let's
begin.
The
first
is
what
what
we
use
raft
and
assume
that
everybody
here
we
want
to
build
database
or
story
server.
So
maybe
the
first
simple
thing
is
that
you
use
one
load,
and
here
you
can.
A
Let
me
use
Mexico
or
post
a
critical
and
that's
okay
and
the
client
read
it
are
two
days
ago
and
currently
right
read
the
data
from
the
road
and
the
it
works
well,
but
you
can
see
the
load
is
only
one
load
and
he's
had
a
single
point.
So
even
though
is
crashed
and
the
service
is
unavailable
horrible
and
furthermore,
if
the
load
can't
be
rock
you're
horrible,
so
you
lose
war.
Your
data,
it's
called,
accept
low
in
some
database.
So
how
can
we
solve
this
problem?
A
And
mostly
here
we
need
replication
and,
and,
as
you
can
see
here,
we
add
a
new
slave,
you
load
and
we
call
the
overload
the
master
and
the
new
load
of
a
slave
lacked
common,
my
stock
pot,
and
we
mostly
for
better
proponents.
We
use
a
synchronized
replication
and
when
the
client
right
attitude
on
master
law
and
the
master
repair,
you
can
okay,
the
data
received
and
the
enter
the
master.
We
are
replicated
the
data
from
to
the
slave
synchronously.
A
This
work
well
in
most
over
by
circle
architecture,
will
use
this
replication
mode,
but,
as
you
can
see,
that
a
single
replication
has
a
problem.
Is
that
because
the
replica
is
a
sink
rollers,
so
sometimes
the
slave
can't
have
the
latest
data.
If
the
master
is
done
and
we
the
slave
is
promoted,
call
you
master,
and
we
found
that
that's
Lee
book.
The
slave
can't
have
the
lowest
data.
A
So
as
this
car,
the
slave
had
one
had
eight
and
a
peep,
but
we
lost
three
and
at
least
do
some
acceptable
acceptable
in
some
critical
database
LRO's.
So
how
can
we
do
so?
This
problem,
and
we
caught
here
mostly,
we
use
a
synchronized
replication,
unlike
a
sinkhole
at
replication
uses
in
collide,
and
the
master
must
guarantee
that
the
data
has
been
replicated
at
your
slave,
then
the
masa
will
reply
to
the
client
at
the
data
is
save
so
uses.
This
way,
we
can
guarantee
that
our
data
is
safety.
Even
the
master
is
crashed.
A
The
nutria
slave
is
promote
your
new
master,
and
we
can
know
that
we
have
world-eater
Lewis
theta
with
countless
our
data.
Guys
had
a
lot
of
problem.
Is
that,
as
you
can
see,
we
have
only
two
loads
and
if
the
matter
you
don't
the
slave,
promote
your
new
master
and
there
used
to
be
so
do
one
load
when
we
meet
single
o
the
single
point
of
problem
again.
So
how
can
we
solve
this
problem
and
mostly
we
can't
use
only
two
load.
We
need
Marquis
loss
and
most
of
those
early.
A
If
we
want
one
node
cubic
be
available
with
the
onliest
reload,
you
know
maybe
the
quorum
and
as
you
can
see
that
for
one
master,
we
need
a
queue
slaves.
And
here
we
because
recipe,
as
I
said
before,
that
we
use
a
synchronized
replication.
But
there's
a
trade-off
here
because
for
the
better
performance
and
high
availability,
because
using
synchronous
replication
can
reduce
performance.
A
So
sometimes
there
we
use
on
a
quorum
replication,
which
means
that
if
the
master
found
that
the
majority
of
the
server's
has
already
received
replicated
the
same
data
in
the
casing,
that
the
data
had
pc
e.
The
say
that
you
see-
and
we
can
sink-
that
that
they
tell
you
the
consistency
as
you
can
see,
that
the
master
just
only
replicas
to
the
data
kula
west
load,
and
I
think
that
the
data
had
been
saved
into
load
and
as
facing
that
a
data
is
saved.
So
and
a
lot
of
problem
comes.
A
Is
that
when
the
master?
Because
now
we
have
a
Cyrillic
hard
or
even
more,
we
have
more
replicas.
And
now
is
the
master
you
Tom,
which
one
which
still
duel
either
to
promote
cure.
You
master
obvious
really
and
we
needed
to
promote
sleep
which
had
the
lowest
data,
but
how
can
we
know
that
big
asleep
had
a
Lewis
data?
So
this
is
our
one
problem:
I
live
here
and
the
other
promo
is
that
the
cola
we
have
market
replicas
and
we
are
you
a
distributed
system
because
we
are
distributed
system
and
HP.
A
Each
load
is
a
community
with
other
loads
through
the
letter
work
because
we
are
a
letter
and
the
letter
work
can
be
broken,
so
we
meet
some
narrow
ladder
really,
and
here
you
can
see
that
the
old
matter
is
isolated
from
other
Cutler.
Sorry,
the
older
muscle
here
and
the
new
matter
report
under
the
loose
matter
is
promoted.
So
here
we
exceed
to
matter
one
old,
still
master
and
a
new
master,
and
at
this
time
unlucky
some
cry
so
do
crack
yo
the
master.
A
So
we
meet
up
a
little
problem
that
can
this
clan
so
do
real
data
from
this
matter.
Yes,
Lola
and
assume
that
we
now
we
have
a
key.
We
live
what
we
live
a
with
value
1
in
the
master.
So
if
the
clan
reader,
a
with
value,
1,
is
ok
but
then
later,
if
we
write
a
new
value
to
this
key
a
and
then
if
the
current
reader
read,
the
data
from
old
master,
still
read
a
with
with
the
value
1.
It
can't
be
accessible
because
it
break
the
data
consistency
and
become
other.
A
We
read
reread
or
we
write
a
new
data,
but
can't
read
us
their
data
and
it
can't
XML
in
that
in
some
critical
database
narrows.
So
how
can
we
solve
this
problem?
As
you
can
see,
I
list
many
problems
from
the
one
node
and
the
to
the
Marquis
load,
and
luckily
we
have
the
joint
sorry.
We
have
the
console
algorithm
and
the
consider
of
the
algorithm
can
help
us
to
solve
this
problem.
A
I
said
yeah
I
said
a
bar
and
in
the
current
work
there
are
two
popular
comes
in
the
algorithm
y
axis
and
the
other
is
rot,
and
here
we
only
talk
about
a
bra,
because
I
think
the
raft
is
more
simple
and
more
easy
than
taxes
and
surreal,
and
you
may
think
that
is
more
easy
to
use
in
production
and
I.
Even
think
that
you
can
use
our
product,
Roth
library
in
the
production,
suanne
bitter,
so
easy,
I,
think
and
I
see
if
you
want
to
master
raft,
I,
think
that
you
only
need
a
cure.
A
A
The
first
is
that
let's
talk
about
election
and
for
the
rock
class,
every
load
has
three
rows:
the
leader,
the
follower
and
the
candidate,
and
every
rough
clutter
has
only
one
leader
and
the
leader
is
elected
by
the
majority
over
the
period,
and
only
if
the
leader
is
elected
and
only
the
leader
can
handle
crying
Oh
can
only
handle
and
class.
No
more
sorry,
the
neither
can
only
not
only
the
right,
but
also
don't
read
must
be
through
the
leader.
A
This
is
a
whole
picture
over
the
election.
I
the
first.
What
appears
are
the
followers
and
after
election
turnout,
the
follower
we
have
become
the
candidate.
The
candidate
will
just
walk
by
yourself
and
the
candidate
will
send
the
world
to
other
peers
when
the
candidate
found
that
even
receive
the
vote
from
the
majority
of
the
CEO,
so
us
and
either
can't
become
the
leader,
of
course,
the
candidate.
A
You
found
that
the
eyes
there
has
someone
become
the
leader
and
either
we
have
become
either
way,
Abby
step
back
for
Bakula
polar
look
when
the
leader
is
when
the
leader
is
the
back
here
and
the
leader
only
to
handle
the
kind
of
requests
when,
for
example,
here
the
kind
we
all
read
some
data
to
the
leader
and
the
leader,
we
are
used,
each
module
we
need
roster.
Here
is
a
rough
algorithm
and
the
to
replicate
based
data
into
other
fall
alerts,
and
here
each
load.
A
We
are
a
panda
commander
to
die
either
own
rough
logs
when
the
leader
found
that
the
majority
of
the
server
had
received
this
rough
log
and
the
user
testing
that
the
rough
log
is
committed.
Well
after
the
rough
log
is
commit
here.
You
can
apply
this
rough
log
and
apply
this
to
the
station
machine,
and
this
is
a
common
replicated
emotion
with
the
graphic
repeated
mrs.
the
reputation
log,
and
this
is
the
core
concept
of
the
raft
and
as
I
said
before,
and
here
Porter,
there
are
many
scenes.
A
I
don't
mention
here
about
the
reflector,
like
slap
sha
and
on
how
the
membership
change
about
how
rough
do
de
el
oued
and
removal,
though,
and
the
hub
of
the
rough
dual
approval.
If
you
want,
you
must
really
want
to
must
master
the
RAF
and
they
used
to
allow
this
concern.
And,
of
course,
you
needed
to
do
many
optimization
to
photograph
and
use
it
in
your
production.
A
A
So
it's
a
cool
stuff
for
us
cue
to
inspire
from
the
etcd
draft
and
the
rough
library
is
a
highly
library
and
its
various
like
you
can
abandon
it
into
a
application
easily
to
provide
it
or
concert
layer
and
the
library
is
only
focused
on
the
consensus
algorithm.
So
you
should
you
should
I
leave
it.
You
need
to
consider
how
to
save
the
rough
log
and
how
to
apply
the
rough
log
and
save
it
into
that
slow
motion
and
how
to
communicate
our
rough
load
by
yourself
and
using
rough
load.
A
It
may
be
using
the
rough
library,
it's
very
easy
and
you
can
see
the
whole
picture
here
and
at
first
you
needed
to
create
a
rough
load
like
ok,
that's
not
really,
our
arrow.
You
need
to
create
a
rough
low
and
when
we
create
our
upload-
and
you
can
see
that
every
rough
flow
is
austere,
machine
and
the
what
we
needed
to
do
is
to
traverse
the
machine
from
this
state
to
other
state
and
mostly,
we
have
through
it
to
grab
a.
Why
is
40
and
which
means
that
we
need
to
gravity.
A
Is
rough
alowed
regularly,
for
example,
every
100
millisecond
with
for
the
cake
tick-tick-tick
to
grab
the
Ruffalo
and
a
lot
of
ways
lat
the
protic
and
we
are
sell.
The
required
to
the
raffle
loader
speak
to
a
leader
explicitly
and
the
recorded
propose.
We
use
a
propose
to
cross
the
Ruffalo,
and
here
is
that
we
sometimes
because
the
rasa-lila
will
receive
the
message
from
other
raffle
load
and
the
Waco.
A
A
The
initial
add
state
over
the
wrath
of
the
Rafah
load.
The
rough
state
include
current
term
the
current
committee
committee,
the
index
and
carnal
and
author
and
increase
return,
a
slice
of
blood
off
log
from
the
low
to
the
high
and
the
term
written
a
cover,
current
a
load
and
the
first
index
and
alice
in
dairyland
us
first
and
a
last.
The
index
of
the
whole
raft
logs
and
the
snapshot
Rotonda
count
the
snapshot
of
a
current
state
machine.
A
You
can
think
that
you
take
a
picture
of
the
sewer
machine
at
that
time,
and
then
you
can
crew
the
crew,
the
buffaloed
and
with
your
storage
and
with
our
computation
yeah
here,
you
can
see
that
the
configuration,
your
very
simple
and
even
each
rough
load
has
a
unique
ID
and
the
end
here
is
a
reduction
tick
and
how
to
be
the
cake.
You
may
still
remember
that
I
mention
the
kick
before
so
for
every
geek,
for
example,
the
electric
eel
is
for
the
hauler.
A
So
when
we,
when
we
kick
ten
times
the
polar,
if
the
terminal
receive
a
message
from
the
leader
and
the
UW
sent
began
to
the
candidate
and
become
to
the
election
again
the
harpy,
that
means
that
when
peak
sweetheart
and
the
leader
we
ascend
a
hot
beat
to
other
followers,
and
so
well
after
we
create
a
rough
load.
We
can
do
something
here.
You
can
see.
A
I
said
before
the
tea
right,
the
chicken
drive
rock
Ruffalo
that
regularly
and
you
snap
to
receive
the
remove
messages
from
other
load
and
just
grab
it,
and
the
youth
use
a
pro
boat
to
receive
the
commander
from
the
clan
and
the
gravy
is
cue
when,
when
we
travel
the
Ruffalo
and
you
may
be
into
the
ready
state,
we
can
call.
The
load
has
already
function
to
check
whether
the
Ruffalo
is
already
or
Lord,
and
when
the
rock
below
is
already,
we
can
get
these
ready
and
the
hair.
A
If
you
can
see
it
is
entry
and
we
can
append
this
entry
to
the
rough
logs,
and
here
is
message
we
can
send
the
message
to
the
other,
remove
low
and
here
is
committed
or
Russell
Rafa
logs,
and
we
can
apply
this
to
the
Slayer
machine
after
we
finish
them
or
we
can
call
advanced
and
I
don't
measure
some,
but
in
the
ready
we
also
need
a
two-hander,
so
structure
or
handled
a
leader
challenge
from
change
or
committed
induction.
But
I,
don't
mention
I,
don't
list
here
in
this
poll.
A
Anybody
know
here.
Oh
la
parka,
B
is
the
e.
Is
the
CCF
sandbox
project,
but
I
use
a
lot
here.
Alongs
may
be
either
will
be
a
lot
in
the
air
at
the
end
of
this
smart
I
under
here,
I
just
allows
it,
and
now
maybe
tacky.
Are
you
missing
that
heck?
We
may
be
the
first
raft
database
storage
database
project
in
the
scenes
yet
you'd
written
by
rot.
The
first
are
written
by
rust,
the
database
so
and
our
ambition
and
B.