►
Description
Learn all about this libp2p PubSub router implementation which represents the double network nature of Gossipsub.
For more information on IPFS
- visit the project website: https://ipfs.io
- or follow IPFS on Twitter: https://twitter.com/IPFS
Sign up to get IPFS news, including releases, ecosystem updates, and community announcements in your inbox, each Tuesday: http://eepurl.com/gL2Pi5
A
Hi
I'm
visa
and
I'm
gonna
talk
to
you
about
the
new
pub/sub
protocol
in
Libby,
2pn
ipfs,
okay.
So
before
we
talk
about
the
new
protocol,
let's
talk
about
the
old
protocol
and
how
it
all
started.
So
the
first
implementation
of
pub/sub
in
ipfs
only
p2p
was
flood
son.
So
that's
the
simplest
possible
particle.
You
can
write
and
it
relies
on
two
things:
I'm
being
pretty
discovery
and
flood
routing.
So
let
me
explain
what
this
actually
means.
I'm
in
peer
discovery
means
that
there
is
no
active
discovery
for
peers.
A
Instead,
you
rely
on
connection
events
on
ambient
connection
events
and
let
an
external
process
drive
your
prayer
discovery,
so
this
makes
it
very
nice
and
simple
to
compose
with
Orbitz
article
discovery
options.
So
the
second
part,
which
is
the
important
part,
is
the
routing,
because
pub/sub
is
all
about
writing
messages
to
all
the
recipients.
It
used
to
be
called
multicast
biocked
in
the
old
days,
but
now
we
don't
even
we
don't
do
multicast.
We
do
pub/sub,
so
floods
abuses,
flood
routing,
which
means,
when
you
receive
a
message,
so
you
want
to
forward
it.
A
You
just
send
it
to
everybody
who
are
connected
to
and
where
it's
on
the
topic.
So
let's
get
some
kind
of
interesting
properties,
so
it's
obviously
trivial
to
implement
and
it's
kind
of
robust,
because
no
matter
what
you
do,
you
know
that,
even
though
you
might
use
a
lot
of
bandwidth,
you
know
you're
gonna
receive
deliver
your
messages
and
the
most
important
part
is
that
it
actually
has
minimum
latency
because
it
takes
the
minimum
latency
paths
across
your
graph.
Now
the
problem
is,
of
course,
that
this
is.
It
doesn't
take
just
a
minimal
latency
path.
A
It
takes
all
the
paths
in
the
graph,
so
this
makes
it
run
with
an
efficient
and
most
problematic
for
all
is
address
unbounded
degree
flooding.
That
means
that
if
you
gave
a
lot
of
connections
or
we're
going
to
send,
you
know
we
have
a
huge
amplification
factor,
which
is
a
problem
for
highly
connected
nodes,
and
you
know
like
large-scale
overlays.
Okay.
So
how
are
we
gonna
control
the
flood
and
build
a
protocol
that
actually
scales
without
breaking
down
the
network?
So
how
was
it
sub
works?
Basically,
it's
a
randomized
mess
construction.
A
So
we
start
with
our
underlay,
which
is
basically
all
the
connections
that
we
have
and
construction
of
an
overlay
mess,
but
first
selecting
a
random
number
of
pairs
with
a
couple
of
parameters
and
then
self-stabilizing
this
overlay
within
some
relaxation
parameters
so
effectively.
What
we
have
here
is
a
parameter,
control,
amplification
factor
because
it's
the
parameters
of
the
protocol,
which
is
in
the
actual
implementation,
it's
about
six,
okay
and
we
trade
latency
for
bandwidth
efficiency.
So
on
stop
on
top
of
the
overlay
construction,
we
actually
augment
the
mess
with
gospel.
A
Forget
about
flow
me,
the
data
so
to
the
peers
that
were
not
sending
messages.
We
occasionally
send
gossip
message
such
as
hey
here
are
the
messages
that
are
here
and
if
you
want,
you
can
ask
them
for
them
for
them,
and
this
allows
us
to
jump
hops.
For
example,
if
you
happen
to
have
an
overlay
that,
although
you
have
a
node
you
are
connected
to,
it
might
be
in
a
long
distance
from
you.
A
So
this
allows
you
to
jump
hops
and
directly
send
send
you
the
messages
and
also,
more
importantly,
it
allows
us
to
repair
overlay
pathologies.
So,
for
example,
if
we
happen
to
have
it's
very
unlikely,
unless
you
are
under
attack
to
go
into
a
state
that
basically
the
overlay
becomes
disconnected,
then
the
the
gossip
propagation
allows
you
to
repair
this
and
turn
it
into
a
possible
network
so
and
less
than
most
important,
perhaps
is
that
they
also
allows
us
to
have
an
extensible
protocol.
A
A
So
one
of
the
one
of
the
extensions
were
already
working
on
it's
epidemic
vodka
streets
on
top
of
gossips
are
so
we
never
got
to
talk
I'm
just
going
to
give
you
a
demo
to
illustrate
how
this
works
so
first
I'm
going
to
capture
the
random
seed
so
that
both
simulations
I'm
gonna
I'm
using
their
network
simulator
here
the
route
to
do
a
network
simulator
the
route
you
while
developing
gossip
sub
but
you're
like
the
same
thing.
This
happens
the
same
code
as
it
runs
when
they
go
a
little
bit
nicer.
A
So
first
I'm
going
to
run
a
flat
sup,
simulator
I'm
gonna
we're
going
to
see
a
bunch
of
fat
with
the
simulation
running
first,
the
other
ladies
connecting
okay.
Now
the
simulation
will
start
and
basically
all
the
messages
are
propagating
and
then
the
simulator
waits
a
little
bit
for
the
net
over
the
quiet
down
before
calling
a
day
and
stopping
the
simulation.
A
So
once
it
stops
its
going
to
give
us
a
little
summary
that
says
that
basically
where's
the
hundred
nodes
and
I
should
say
that
we
have
ten
connections
for
each
node
and
basically,
we
sent
a
single
methods
and
we
generated
seventeen
hundred
and
eighty
six
publish
events.
So
basically
our
ability,
Asian
factor
is
a
nice
and
round
17.
Okay.
A
So,
let's
run
now
the
same
thing
with
gossip
table
and
I
should
say
that
sending
a
single
message
is
absolutely
the
worst
case
scenario
that
we
can
hear
for
gossip
table
because
you're
paying
the
cost
of
building.
They
now
actually
sending
gossip
when
you're
only
sending
a
single
message,
but
even
though
we're
sending
in
a
single
message
this
square,
the
simulation
will
look
like
so
in
subsequent
simulations
I'm
going
to
stop
displaying
the
traces
it's
running,
live
and
we'll
just
give
a
blank
screen.
Instead
of
getting
all
this
junk
coming
down
on
Emacs.
A
A
A
A
It's
much
more
modest,
it
doesn't
blow
up
the
network
and
we
see
these
horns
things
popping
up.
These
are
the
gossip
propagation.
Now,
after
we've
sent
the
message,
we
have
a
little
bit
of
a
tail.
This
is
the
gossip
that
keeps
propagating
about
the
messages
here.
I
should
say
that
doesn't
take
that
long
in
real
life,
but
you
know
the
simulator
is
doing
10
milliseconds
in
in
a
hundred
milliseconds.
A
So
this
only
takes
like
three
seconds,
but
it's
gonna
take
like
30
seconds
right,
wait
for
the
full
30
seconds
for
that
now,
let's
make
things
more
interesting:
let's
increase
our
connectivity.
Let's
say
that
we
have
20
connections
for
it,
okay
and
before
I.
Do
that
this
should
actually,
we
should
actually
take
the
delay.
So
we
have
something
to
compare
so
instead
of
200
millisecond
middle
seconds
to
260
milliseconds,
which
is
not
so
bad.
A
Okay,
now
I'm
gonna
run
a
simulation
that
basically
uses
20
connect,
suspend
on
this
keyboard
really
sax,
that's
what
I
have
to
say:
okay,
now
I'm
I'm
running
in
quiet
mode,
so
it's
gonna
take
a
few
seconds,
so
the
simulator
is
running
in
real
time.
It's
not
simulating
time
so
this
actually
gives
us
real
time.
So
that's
why
it
takes
so
long
to
run
the
simulation
and
after
I'm
gonna
run.
You
know
like
the
same
simulation
with
gossip
tab,
and
here
is
the
first
interesting
fact.
A
A
With
gossip
tab,
I'm
gonna
see
that
the
amplification
factor
remains
in
round
six
and
we
have
we
still
kept
our
gossip.
But
now,
even
though
we're
sending
the
gossip
messages
and
the
early
construction
see,
the
overall
messages
were
sending
in
total
is
actually
much
lower
than
the
flats
up
and
in
order
to
drive,
so
we
can
see
that's
our
amplification
factor.
So
we
still
just
six
six
point
18
and
we
had
you
know
like
a
bunch
of
gossip
messages
that
lingered
on
now
to
get
a
better
view
of
what
actually
happened
in
the
network.
A
Twenty
connections.
Let's
look
at
the
flats,
AB
and
hearing
floods
have
suddenly
gonna
break
the
network,
but
it's
very
fast
gossips
have
on
the
same
on
the
other
world.
On
the
other
hand,
simply
remain
remains,
maintains
the
simple
the
same
modest
profile,
Noah
grew.
Almost
nothing
is
changed
a
little
bit
of
margosa,
basically
getting
sent
out,
because
we
have
more
connections,
okay
and
Stan
already.
A
So
this
is
the
gossip
that
this
lingering
on
for
about
three
seconds,
which
becomes
thirty
seconds
on
the
animation
and
now
I'm
gonna
do
the
same
thing
for
something:
that's
not
worst-case
scenario
for
gossip
tab,
but
instead,
let's
say
that
we
send
ten
messages
within
the
span
of
two
seconds,
like
ten
message
for
five
cents
per
second,
now,
floods
app
is
going
to
cave
the
same.
You
know
a
horrible
row
file,
but
you're
in
gossip
table
is
going
to
amortize
the
cost
of
the
gossip,
and
now
it
becomes
suddenly
much
more
combating
protocol.
A
A
On
the
other
hand,
gossips
AB,
it's
gonna
run
a
little
bit.
You
guys
can
read
it
right
all
right,
yeah
I'm
screen
capturing,
so
it
should
be
much
more
easier
to
read
on
the
script,
getting
a
screen
capture
thing,
and
now
we
see
that
our
modifications
factor
remains.
You
know,
look
at
them
around.
Six
was
where
it's
covering
and
if
you
get
some
factor
from
a
gossip
is
about
two,
which
is
basically
we
end
up
with
a
totally
forgets.
The
factor
was
about
a
so.
A
If
we're
sending
higher
rate
the
gossip
is
going
to
amortize
even
better
and
because
it's
sending
you
know
like
once,
every
second
approximately
and
it
resists
for
about
three
rounds
of
gossip,
so
messages
are
announced
for
three
seconds.
Okay,
so
we
have
higher
rate
of
messages.
The
camps,
no
like
even
better,
and
you
like
to
drive
the
point
forward.
Let's
look
at
flat,
sub
that
and
let's
enjoy
you
know
like
the
flat
as
its
ranking.
The
red
words
gonna
be
a
lot
more
obvious
because
now
we're
having
all
the
messes
propagating
at
the
same
time.
A
Yep
and
the
interesting
part
is
that
now
we're
sending
more
messages.
If
we
look
at
the
total
delay
for
a
transmission
of
all
these
messages,
the
delay
advantage
of
flood
sap
is
basically
disappeared
because
you
know,
like
we
count
a
ton
of
delay
to
send
all
20
messages,
and
I'm
gonna
calculate
this
real
soon.
Okay,.
A
So
that
took
you
know
1.91
seconds
gossips
had
to
2.04
seconds,
so
you
know
exactly
advantage
becomes
marginal
from
floods
have,
but
the
amplification
factor
advantage
for
gossip
sab
is
huge
and
just
to
close
that
I'm
gonna
with
simulation
over
modest
gossip
sab
they're
just
sending
unrest
this
without
ever
flooding
the
network.
Okay
and
that's
about
it.
B
A
Yeah,
that's
small
tornadoes,
okay,
so
it's
now
it's
already
available
in
IPA
face
it
spreads
in,
but
you
have
to
know
bleach,
which
I
mean
pubs
have
is
still
considered
experimental.
My
PFS
we're
soon
gonna
make
it
non
experimental.
Now
that
we
have
methyl
signing
and
you
can
enable
gossip
tab
with
an
option
with
a
configuration
option,
it's
all
recommend
it
in
the
experimental
option
so
that
one
of
the
big
and
important
parts
is
that
it's
completely
backwards
compatible
with
floods
app.