Skip to content

Interactive labs

Every hands-on lab in the course, grouped by what you practise. Each card names the lessons where the lab appears and, when there is one, a page where you can open it on its own.

Every number in a lab comes from a model that lists what it leaves out, under the lab. The values are illustrative: they show how a system behaves, not what a real product would do.

106 labs in 16 groups.

Load, latency and queues

Push traffic at a system and watch queues form, latency climb and the first component give way.

The network path

Count what a request spends on the wire before the server has done any work: lookups, handshakes, connections kept open and caches at the edge.

Back-of-envelope estimates

Turn a few assumptions into numbers: requests per second, bytes stored, a link speed, a monthly bill, memory for a cache, downtime over a year.

Scaling out and spreading the load

Add servers and share the work between them: how a policy follows the traffic, and how a balancer decides where each request goes.

  • Autoscaling lab

    Simulator

    Run an autoscaling policy against a traffic pattern and see when the group of instances falls behind because new ones take time to start.

    Used in
  • Load-balancing lab

    Simulator

    Send the same requests through each balancing algorithm, slow down or lose a server, and compare what each one does.

    Used in

Caching

Keep copies close to the work, and see what they save, when they go stale and what happens when they disappear.

Transactions and isolation

Run concurrent transactions at each isolation level, with locks and with row versions, and see which anomaly each level lets through.

  • Dirty read

    Simulator

    Read a value that another transaction has written and then rolled back, and see which levels let it happen.

    Used in
  • Non-repeatable read

    Simulator

    Read the same row twice while another transaction commits a change in between, and see which levels give two different answers.

    Used in
  • Phantom read

    Simulator

    Count the rows that match a search twice while another transaction inserts one in between, and see which levels let a new row appear.

    Used in
  • Lost update

    Simulator

    Let two transactions read a balance, add a deposit each and write it back, and see which levels lose one of the deposits.

    Used in
  • Write skew

    Simulator

    Let two on-call doctors each go off call after checking that the other is still on, and see which levels let both leave.

    Used in
  • Deadlock

    Simulator

    Make two transactions wait for each other’s rows, and watch the database find the cycle and abort one of them.

    Used in
  • Same locks, same order

    Simulator

    Take the rows of the same two transfers in the same order, and see the second transaction wait instead of being aborted by a deadlock.

    Used in
  • Deadlock between three

    Simulator

    Let three transactions wait for each other in a ring, and see the database break the cycle by aborting one of them.

    Used in

Replication and failover

Copy writes from a primary to replicas and see what lag, a synchronous or asynchronous acknowledgement, a crash and a network partition each do to the data clients see.

Data across machines

Spread data over several shards and see what each way of placing it costs when the number of shards changes or the traffic is uneven.

  • Four ways to partition keys

    Simulator

    Compare range, hash mod N, consistent hashing and a directory on the same ten thousand keys, and count the keys that move when a shard is added or removed.

    Used in
  • Hash mod N and a new shard

    Simulator

    Add a shard to a hash mod N layout and see almost every key move to another shard.

    Used in
  • Consistent hashing and a new shard

    Simulator

    Add a shard to a consistent-hashing ring and see that only the keys the new shard takes over are moved.

    Used in
  • Virtual nodes and an even split

    Simulator

    Raise the number of virtual nodes on a ring and watch the share of keys on each shard even out.

    Used in
  • Hot keys and hot shards

    Simulator

    Send much of the traffic to a few neighbouring keys and see which strategies leave one shard doing most of the work.

    Used in
  • Rebalancing

    Simulator

    Rebalance a directory and a range layout under hot keys and compare how many keys each one has to move.

    Used in

Consistency, time and consensus

Cut the network between nodes and see what each choice does to consistency and availability, then see how quorums, clocks and leader elections behave when nodes cannot agree.

Queues and streams

Send messages through a work queue or a partitioned log and see what a slow consumer, a crash, a lost acknowledgement or a hot key does to the backlog and to what is delivered.

Rate limiting

Send steady, bursty and spiky traffic at five rate limiters and several gateways, and see what each one lets through, what it rejects and how far a distributed limit can drift.

Observability

Read the dashboards, a trace and an error budget the way an on-call engineer does, and find the component that causes an incident.

Deployment

Put a worse version on a fleet all at once, rolling, blue/green and as a canary, on the same traffic, and compare the users hit, the time to notice, the time to undo and the capacity lost.

Failure and availability

Lose instances, a cache, a database or a primary, or add traffic, delay or writes, and watch what the rest of the system does about it.

The failure labs on one page, with how they work

Case studies

Watch a system start as one server and one database and grow stage by stage, and raise the load at each stage to see which component gives way and what the next stage adds.

  • URL shortener, stage by stage

    Simulator

    Grow a URL shortener from one server and one database to a cache, several servers, read replicas and key ranges, and raise the load at each stage to see what breaks next.

    Used in
    Open on its own page (URL shortener, stage by stage)
  • Pastebin, stage by stage

    Simulator

    Grow a pastebin from one database to object storage, an edge cache, sharded metadata and batched expiry deletes, and raise the load at each stage to see what breaks next.

    Used in
    Open on its own page (Pastebin, stage by stage)
  • Social feed, stage by stage

    Simulator

    Grow a social feed from reading at open time to timelines written in advance, then a hybrid that merges celebrity posts at read time, and raise the load at each stage to see what breaks next.

    Used in
    Open on its own page (Social feed, stage by stage)
  • E-commerce, stage by stage

    Simulator

    Grow an online shop from one database to a catalog cache, a cart store, an inventory service with reservations and a checkout saga, and raise the load at each stage to see what breaks next.

    Used in
    Open on its own page (E-commerce, stage by stage)
  • Payment system, stage by stage

    Simulator

    Grow a payment service from one database to idempotency keys, a double-entry ledger, a sharded database and reconciliation on replicas, and raise the load at each stage to see what breaks next.

    Used in
    Open on its own page (Payment system, stage by stage)
  • Ride sharing, stage by stage

    Simulator

    Grow a ride-sharing service from positions in a database to an in-memory index, grid-cell shards, cells that adapt to density and a gateway that batches location updates, and raise the load at each stage to see what breaks next.

    Used in
    Open on its own page (Ride sharing, stage by stage)
  • Chat, stage by stage

    Simulator

    Grow a chat service from one server and one database to a partitioned message store, gateway servers with a connection registry, a sharded registry and delivery workers behind a log, and raise the load at each stage to see what breaks next.

    Used in
    • ChatModule 28, Case Studies
    Open on its own page (Chat, stage by stage)
  • Global messaging, stage by stage

    Simulator

    Grow a chat service from one region to three regional stacks, a cross-region relay log, a home region per conversation and a residency policy, and raise the load at each stage to see what breaks next.

    Used in
    Open on its own page (Global messaging, stage by stage)
  • Video platform, stage by stage

    Simulator

    Grow an on-demand video service from one server to object storage, a CDN, a transcoding pipeline with adaptive bitrate, an elastic worker fleet and more edge servers, and raise the load at each stage to see what breaks next.

    Used in
    Open on its own page (Video platform, stage by stage)
  • Live streaming, stage by stage

    Simulator

    Grow a live service from one media server to separate ingest and real-time encoding, a CDN, request collapsing and more edge servers, and raise the load at each stage to see what breaks next.

    Used in
    Open on its own page (Live streaming, stage by stage)
  • Search engine, stage by stage

    Simulator

    Grow a search engine from one index server to copies, shards, a results cache and index tiers, and raise the load at each stage to see what breaks next.

    Used in
    Open on its own page (Search engine, stage by stage)
  • Object storage, stage by stage

    Simulator

    Grow an object store from one disk server to separate metadata, three copies of every object and sharded metadata, and raise the load at each stage to see what breaks next.

    Used in
    Open on its own page (Object storage, stage by stage)
  • File storage, stage by stage

    Simulator

    Grow a file-sync service from whole files on one server to chunks, a change feed, sharded metadata, scaled-out servers and deduplication, and raise the load at each stage to see what breaks next.

    Used in
    Open on its own page (File storage, stage by stage)
  • Notification system, stage by stage

    Simulator

    Grow a notification service from sending inside the request to a queue, a preferences cache, a second email provider and a delivery log, and raise the load at each stage to see what breaks next.

    Used in
    Open on its own page (Notification system, stage by stage)

Interview Arena and Builder

Draw an architecture, run it at a target load and read the findings, then practise a full system design interview against the clock.

Built by GhaziAlibi.

© ShardCraft. All rights reserved.