Log inStart free
LESSON 33.05 · 5 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Replication, partitioning and sharding

Watch 24 chat sessions split over nodes, copy, and survive a failed node.


Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 33.05 · SESSION STORE140 MB ON 1 NODE OF 64 MB
01
Stage 1 of 5 · One node
One node holds 64 MB. The 24 sessions need 140 MB, so one node cannot hold them.
Explain it simply

Each small box is one chat session, its stored history. A node is one machine with 64 MB of space. The bar under N1 shows 140 MB, more than twice what fits. The part past the line does not fit.

All 24 sessions sit in node N1. Its bar shows 140 MB against a 64 MB line.

session (dashed: a copy)node, 64 MB; dashed line: even sharedotted box: node not in useover the line, failed or lostcopy that takes over
N164 MBN2emptyN3emptyN4emptyN5spare140 MB stored64 MBS01S02S03S04S05S06S07S08S09S10S11S12S13S14S15S16S17S18S19S20S21S22S23S24one node24 sessions need 140 MB; one node holds 64 MB140 / 64 = 2.19 nodes of space at leastN164 MBN2emptyN3emptyN4emptyN5spare140 MB stored64 MBS01S02S03S04S05S06S07S08S09S10S11S12S13S14S15S16S17S18S19S20S21S22S23S24one node24 sessions need 140 MB; one node holds 64 MB140 / 64 = 2.19 nodes of space at least
Toy: 24 sessions, 140 MB, nodes of 64 MB
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
M=∑sms>C\sy{M}{data}{M} = \sum_s \sy{m}{data}{m_s} > \sy{C}{param}{C}
M=140 MB>C=64 MBM = 140\ \text{MB} > C = 64\ \text{MB}

The total size of the sessions is more than one node holds.

Common mix-ups

MYTHEqual session counts give each node equal work.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With only 1 copy of each session, what does the failure of N2 lose?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
  • 4 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.