21
The Two Generals Problem A taste of distributed systems

The Two Generals Problem

  • Upload
    voltdb

  • View
    386

  • Download
    0

Embed Size (px)

Citation preview

The Two Generals Problem

A taste of distributed systems…

Why? •  Distributed systems touch everyone’s lives

at some point or another. •  People ask, why can’t stuff just work? •  Answer: Distributed Systems are hard.

•  Two Generals Problem is a fun problem I can maybe describe in 5 minutes.

Set the Scene

•  To make things confusing, we’re going to explain this problem with ninjas instead of generals.

The most important thing to know is that ninjas need to attack all at once!

Overview

THE NINJAS MUST ATTACK AT THE SAME TIME OR JEAN-CLAUDE WILL KILL THEM IN AWESOME WAYS.

Overview

THE NINJAS MUST ATTACK AT THE SAME TIME OR JEAN-CLAUDE WILL KILL THEM IN AWESOME WAYS.

Overview

THE ONLY WAY TO COORDINATE AND DECIDE AN ATTACK TIME IS BY SENDING MESSENGERS TO SNEAK BY JEAN-CLAUDE.

When you send a messenger into the forest:

+ =

Sometimes:

+ = +

Other Times:

Ninja Plan #1 10:05pm Attack!

Got it!

Ninja Plan #1 10:05pm Attack!

Ninja Plan #2 10:05pm Attack!

Got it!

Confirmed

Ninja Plan #2 10:05pm Attack!

Got it!

Confirmed

Ninja Plan #3? Double Confirm?

Any other plans?

•  There are not a lot of other options given the limited rules of this game.

•  Sending messengers at the same time doesn’t really change anything. (for example)

Just Gonna Say It •  It’s mathemagically impossible for the ninja

armies to agree to a time with 100% certainty.

•  This is called: “The Two Generals Problem” E. A. Akkoyunlu, K. Ekanadham, and R. V. Huber in 1975

Just Gonna Say It •  It’s mathemagically impossible for the ninja

armies to agree to a time with 100% certainty.

•  This is called: “The Two Generals Problem” E. A. Akkoyunlu, K. Ekanadham, and R. V. Huber in 1975

IT’S A METAPHOR

•  The ninjas are really computer programs.

•  The forest is an unreliable computer network.

What about a reliable network?

Networks will let you down

•  Sooner or later, Jean-Claude Van Damme will come for your network traffic.

•  Once you accept that networks are terrible, you can start building software that is robust.

Further Thoughts

•  If you have 3 armies of ninjas (or 3 computer programs) you can do more things. 3 is way better.

•  You can, in fact, agree to attack at 10:05pm.

•  But… there’s no guarantee you can agree before 10:05pm has come and gone.

Real World Example

•  Message delivery – what do you do when processes and/or networks fail and delivery state is unknown? – At least once delivery? – At most once delivery?

Real World Example

•  Message delivery – what do you do when processes and/or networks fail and delivery state is unknown? – At least once delivery? – At most once delivery?

•  Turns out exactly once is hard for reasons related to ninja armies.

Time’s Up! •  About your speaker:

–  Name: John Hugg –  Company: VoltDB (Your gracious hosts!) –  Tel: 1-800-DIST-SYS –  Email: [email protected] –  Social Media: @johnhugg –  Quick bio: blah blah fearless blah blah

handsome blah blah charming blah blah suave blah blah poetic blah blah resourceful blah blah hilarious blah blah powerful blah blah debonair blah blah calming blah blah