Play n Tools

Free tools & games for everyone

Free · No sign-up · No accounts

Distributed systems lab

How many computers stay in step: read and write quorums, Lamport and vector clocks on random message runs, and consistent hashing.

How to use

  1. Quorums: choose how many copies of the data there are (N), how many must confirm a write (W) and how many are asked on a read (R). The lab says whether reads always see the latest write, how many failures each side survives, and how likely it is to work when servers are up with a given chance.
  2. Logical clocks: make a random run of processes sending and receiving messages. The table shows each event's Lamport time and vector clock; compare any two events to see whether one happened before the other or they are concurrent.
  3. Consistent hashing: type server names, the number of virtual nodes per server and the number of keys. See how evenly the keys spread and how many move when a new server joins.

Keyboard and touch

TabMove between tabs, boxes and buttons
EnterWork out the open tab
TouchEvery control works by tapping

Tips

  • With 3 copies, W = 2 and R = 2 is the classic choice: reads see the latest write and one server can be down.
  • W = N and R = 1 gives fast reads but a single failed server blocks every write.
  • Two events with the same Lamport time are always concurrent; a smaller Lamport time alone does not prove an order.
  • More virtual nodes spread keys more evenly: try 1 and then 100.

About this tool

Quorums: a read set and a write set must share a server when R + W > N, so a read always reaches a copy with the latest acknowledged write. Availability is the binomial chance that at least W (or R) of N independent servers are up. Lamport clocks add 1 at every event and take the larger time on receipt; vector clocks keep one counter per process and take the element-wise maximum on receipt. Event a happened before b exactly when a's vector is less than or equal to b's in every place and smaller in at least one.

Consistent hashing places each server at many points on a ring with the 32-bit FNV-1a hash of "name#number"; each key "key-1", "key-2" ... belongs to the first server point at or after the key's hash. Adding a server moves only the keys that land just before its new points. The random runs are made with a seeded generator, so a run number always gives the same events. Everything runs in your browser.

See you tomorrow!

A fresh daily puzzle every morning, and new tools added every month.

Browse every product