The Desi Architect
Notes / Docker Sandboxes
Track 06 · Production Playgrounds

Docker Sandboxes & Production Playgrounds

System design is not real until you watch a database crash or a message partition rebalance under load. Run these 75 standalone labs across 6 difficulty tiers on your own machine with Docker Compose and kind, inject chaos, and inspect exact terminal logs and latency spikes.

75 Standalone Sandboxes 6 Difficulty Tiers Docker & kind Ready Bash & PowerShell Ready Zero Cloud Cost

01 /How to run these labs

Every lab in this track is self-contained. You do not need cloud credits. You only need Docker Desktop running on your machine.

1. Spin up with one command

Each lab includes a docker-compose.yml or kind cluster config. Host ports map to isolated ranges (15432, 16405, 18080, 18100, 18300, 19092) to avoid collisions with local services.

2. Trigger real failure modes

Pause a replica to accumulate replication lag, kill a consumer to force a group rebalance, or fire 25 concurrent workers at one row.

3. Verify state with scripts

Execute automated bash or PowerShell test suites that measure latency percentiles, verify atomicity, and test recovery.

Where to start

New to Docker, or 1 to 3 years in? Start at Lab 00 (free). If you can run docker compose up, you are ready. Every lab has Bash and PowerShell scripts.

4 or more years and preparing for senior interviews? Jump to Lab 28 (PostgreSQL MVCC bloat), Lab 38 (Kafka rebalancing when a consumer dies) or Lab 50 (lock fencing tokens).

Filter Track:
Reference

01 /Keep These Open While You Work

New to Docker, SQL, Redis or the terminal? Start with these short guides. They are free, and each lab links back to them. If a lab does not start, begin with the troubleshooting guide.

Tier 0: Start Here

02 /Start Here: Core Fundamentals (Labs 00 to 08)

Foundational environments for engineers new to containerization or SQL transaction internals. Docker Compose lifecycle mechanics, HTTP/DNS caching headers, and relational transaction isolation anomalies.

REDIS BASICS: EVERY COMMAND YOU NEED BEFORE ANY REDIS LAB
🔒 Pro Sandbox

Redis Basics: Every Command You Need Before Any Redis Lab

A guided tour of Redis with redis-cli: strings, counters, expiry, lists, hashes, sets and sorted sets, key naming, KEYS vs SCAN, and why one command is atomic. Everything the cache, rate limiter, queue and lock labs use, explained before you need it.

RAM ~15MB Ports: 16409 Tier 0: Start Here Verified: ran clean 3 timesredis-cliStrings, Lists, Hashes, Sets, Sorted SetsTTL & Atomic Commands Read Guide →
RACE CONDITIONS & LOCKS: YOUR FIRST CONCURRENCY BUG
🔒 Pro Sandbox

Race Conditions & Locks: Your First Concurrency Bug

Make a race condition happen on purpose with a seat counter, fix it with a lock, then see why a lock inside one program does not protect two programs. This is the idea behind every database lock, Redis lock and fencing token that follows.

RAM ~30MB Ports: None (runs inside a container) Tier 0: Start Here Verified: ran clean 3 timesThreads & ProcessesLost UpdatesWhy Locks Stop Working Read Guide →
Tier 1: Building Blocks

03 /Building Blocks (Labs 03 to 12)

The essential building blocks every backend engineer must master before designing distributed clusters. Little's Law, load balancing algorithms, retries with backoff, edge cache control, cache-aside lifecycle, database indexing, keyset pagination, competing consumers, API gateways, and URL shortener engines.

NGINX BASICS: SERVE FILES, PROXY TO AN APP, READ THE LOGS, RELOAD SAFELY
🔒 Pro Sandbox

Nginx Basics: Serve Files, Proxy to an App, Read the Logs, Reload Safely

Read an nginx config for the first time. Serve a page, forward /api to a backend with proxy_pass, read the access and error logs, see what a typo and a dead backend do, and reload the config without dropping a request.

RAM ~30MB Ports: 18150 Tier 1: Building Blocks Verified: ran clean 3 timesnginx 1.27location & proxy_passnginx -t & reload Read Guide →
EDGE CACHING & SURROGATE KEYS
🔒 Pro Sandbox

Edge Reverse Proxy & CDN Cache-Control

Configure Nginx as a reverse proxy edge cache. Master surrogate keys, stale-while-revalidate background refreshes, targeted cache purges, and cookie-based cache leakage prevention.

RAM ~40MB Ports: 18083 Tier 1: Building Blocks Verified: ran clean 3 timesNginx Edge Cachestale-while-revalidateCache Purging Read Guide →
QUEUE BASICS: YOUR FIRST QUEUE, ACKNOWLEDGEMENTS AND DUPLICATE MESSAGES
🔒 Pro Sandbox

Queue Basics: Your First Queue, Acknowledgements and Duplicate Messages

Build a queue from a Redis list. See producers and consumers share work, lose a message when a worker crashes, fix it with an acknowledgement step, and meet the price of the fix: the same message can arrive twice.

RAM ~15MB Ports: 16412 Tier 1: Building Blocks Verified: ran clean 3 timesProducer & ConsumerAcknowledgementsAt-Least-Once Delivery Read Guide →
Tier 2: Data & Scale

04 /Data & Scale (Labs 13 to 26)

Patterns designed to withstand high data volume, replication lag, sharding, deadlocks, MVCC storage bloat, connection pool exhaustion, cache stampedes, probabilistic counting, rate limiting, and near-real-time search indexing.

MEMORY STRUCTURES & RANKING
🔒 Pro Sandbox

Real-Time Leaderboard with Redis Sorted Sets

Build a sub-millisecond ranking engine with Redis Sorted Sets (ZADD, ZREVRANGE, ZREVRANK). Analyze skip-list memory scaling and prevent big-key latency spikes under millions of scores.

RAM ~60MB Ports: 16408 Tier 2: Data & Scale Verified: ran clean 3 timesRedis 7Skip-Lists & Sorted SetsO(log N) Ranking Read Guide →
DATABASE REPLICATION & DATA CONSISTENCY
FREE PREVIEW📥 Download .zip

PostgreSQL Streaming Replication Lag and Read-Your-Own-Writes

Write profile updates to the primary on port 15432, pause the replica on port 15433, and observe how replication lag produces stale reads. Then test monotonic read token routing.

RAM ~120MB Ports: 15432, 15433 Tier 2: Data & Scale Verified: ran clean 3 timesPostgreSQL 16 (Port 15432)WAL Streaming LSNStale Read Reproduction Read Guide →
Tier 3: Reliability & Messaging

05 /Reliability & Messaging (Labs 27 to 38)

Event streaming ladders, partition rebalances, dead-letter queues, key skew, transactional outbox, idempotency keys, circuit breakers, backpressure, distributed sagas, distributed tracing, and canary deployments.

STREAMING HIGH AVAILABILITY
🔒 Pro Sandbox

Kafka Consumer Group Partition Rebalancing and Pod Eviction

Kill a Kafka consumer with no goodbye and time how long its partition sits unread. See a second consumer join and the partitions split, the session timeout delay, the survivor catching up, and a count that shows no order was lost.

RAM ~1GB Ports: 19092, 18090 Tier 3: Reliability & Messaging Verified: ran clean 3 timesKafka 3.8 KRaft (Port 19092)Session Timeout RecoveryAt-least-once Audit Read Guide →
LOGS, METRICS AND TRACES: THREE WAYS TO FIND WHAT IS SLOW
🔒 Pro Sandbox

Logs, Metrics and Traces: Three Ways to Find What Is Slow

One tiny two-service shop, three kinds of evidence. Find a slow request with logs and see why it is hard, spot the problem with a metric and see what it cannot tell you, then find the exact slow step with a trace.

RAM ~60MB Ports: 18160, 18161 Tier 3: Reliability & Messaging Verified: ran clean 3 timesStructured LogsMetrics & HistogramsRequest Traces Read Guide →
Tier 4: Architect & Chaos

06 /Architect & Chaos (Labs 39 to 49)

Architect-level distributed consensus, zero-downtime schema evolution, distributed locking fencing, Redis Sentinel quorum failover, Raft leader election, Cassandra quorum reads, CDC WAL extraction, Tatkal concurrency locks, multi-region disaster recovery, UPI payment capstone, and chaos engineering drills.

DISTRIBUTED COORDINATION
🔒 Pro Sandbox

Distributed Lock Fencing Tokens & Lease Expiration

Break naive distributed locking with simulated GC pauses. See how an expired lease lets a zombie worker overwrite valid storage data, and implement monotonic fencing tokens to enforce strict server-side write rejection.

RAM ~50MB Ports: 16392, 15439 Tier 4: Architect & Chaos Verified: ran clean 3 timesRedis 7 & PostgreSQL 16 (Port 16392)Monotonic Fencing TokensZombie Worker Defense Read Guide →
HIGH AVAILABILITY & CONSENSUS
🔒 Pro Sandbox

Redis Sentinel Quorum Failover and Split-Brain Prevention

Deploy a 3-node Redis Sentinel quorum cluster. Isolate the primary in an asymmetric network partition, observe +sdown to +odown transition, watch epoch consensus elect a new replica, and prevent split-brain writes with min-replicas-to-write.

RAM ~110MB Ports: 26379, 26380, 26381, 16382 Tier 4: Architect & Chaos Verified: ran clean 3 timesRedis 7 Sentinel (Port 26379)Quorum Leader Electionmin-replicas-to-write Protection Read Guide →
DISTRIBUTED CONSENSUS
🔒 Pro Sandbox

Raft Consensus Algorithm: Leader Election & Log Replication

Observe Raft distributed consensus in an etcd cluster. Trigger split-vote elections, isolate leader network partitions, observe quorum heartbeats, and verify log commit consistency across term increments.

RAM ~120MB Ports: 12379, 12380, 12381 Tier 4: Architect & Chaos Verified: ran clean 3 timesetcd / RaftLeader Election & TermsLog Replication & Quorum Read Guide →
EVENT SOURCING & PROJECTIONS
🔒 Pro Sandbox

CQRS Architecture & Read Model Projections

Separate read and write paths with Command Query Responsibility Segregation (CQRS). Stream domain events from normalized PostgreSQL write stores into denormalized Redis/Elasticsearch read projections.

RAM ~180MB Ports: 15485, 16410 Tier 4: Architect & Chaos Verified: ran clean 3 timesCQRS ArchitectureEvent ProjectionsEventual Read Convergence Read Guide →
Tier 5: Orchestrate

07 /Orchestrate: Kubernetes on Your Laptop (Labs 60 to 65)

Multi-node Kubernetes clusters inside Docker using kind. Self-healing pod lifecycles, service discovery and NodePort load balancing, probe-driven zero-downtime rollouts, Horizontal Pod Autoscaling under Tatkal rush load, and node failure survival.

SERVICES & LOAD BALANCING✨ NEW
🔒 Pro Sandbox

Services and Load Balancing

Expose a dynamic set of pods behind a stable ClusterIP and NodePort Service. Inspect endpoints as pods scale from 3 to 5, and measure random connection load balancing across replicas.

RAM ~1.3GB Ports: 18301 Tier 5: Orchestrate: Kubernetes on your laptop Verified: ran clean 3 timesServiceNodePortkube-proxyEndpoints Read Guide →
PROBES & HEALTHCHECKS✨ NEW
🔒 Pro Sandbox

Readiness, Liveness and Startup Probes

Configure readiness, liveness and startup probes on one app. Simulate traffic drop when a pod becomes unready, trigger container restart on health failure, and avoid startup restart storms.

RAM ~1.3GB Ports: 18302 Tier 5: Orchestrate: Kubernetes on your laptop Verified: ran clean 3 timesReadiness ProbeLiveness ProbeStartup ProbeZero-Downtime Endpoints Read Guide →
ROLLING UPDATES & ROLLBACKS✨ NEW
🔒 Pro Sandbox

Rolling Updates, Rollbacks and Graceful Shutdown

Upgrade an application with maxUnavailable=0 and maxSurge=1 with zero failed requests under load. Push a broken release that crashes on start, verify rollout stalls safely, and undo the rollout.

RAM ~1.3GB Ports: 18303 Tier 5: Orchestrate: Kubernetes on your laptop Verified: ran clean 3 timesRollingUpdateRollout UndoGraceful ShutdownSIGTERM Read Guide →
HORIZONTAL POD AUTOSCALER✨ NEW
🔒 Pro Sandbox

Resources and Autoscaling Under Load

Set CPU/memory requests and limits, deploy metrics-server in kind, and configure HorizontalPodAutoscaler to automatically scale replicas under Tatkal rush load, then scale down safely.

RAM ~1.3GB Ports: 18304 Tier 5: Orchestrate: Kubernetes on your laptop Verified: ran clean 3 timesHPAmetrics-serverCPU Requests & LimitsAutoscaling Read Guide →
NODE FAILURE CAPSTONE✨ NEW
🔒 Pro Sandbox

Node Failure: The Tatkal Capstone

Survive an entire worker node failure during the Tatkal rush. Simulate node death with docker stop, measure endpoint eviction and pod rescheduling under toleration rules, and recover.

RAM ~1.4GB Ports: 18305 Tier 5: Orchestrate: Kubernetes on your laptop Verified: ran clean 3 timesNode FailureTopology SpreadTolerationsTatkal Capstone Read Guide →