8 steps · ~40 min · intermediate · free

Workers & the Redis job queue

Nimbus Books blocks checkout while it renders each receipt. Move that work behind a Redis queue, consume jobs with workers, store receipts in PostgreSQL, scale the worker fleet and isolate one poison order.

Run this architecture yourself

Start the lab locally with real Docker containers.

Torollo runs locally on desktop with Docker.

npx torollo start

Run the command in a terminal on your computer, then open Workers & the Redis job queue in Torollo.

Docker requiredlocal onlyMIT licensed

Execution plan

8 graded steps against one system as you build it.

Produce

Replace the blocking checkout with a queued job.

01-04
  1. Reopen the store

    Start the web container for the checkout service.

    • check: container "web" is running
  2. The two-second checkout

    Run the checkout that renders a receipt before responding.

    • check: GET :80/ on "web" contains "Nimbus Books"
    • check: GET :80/order on "web" contains "Thank you"
  3. Enter the queue

    Add Redis and connect the web server to the queue.

    • check: container "queue" is running
    • check: web → queue is reachable on :6379
  4. The producer

    Push each order onto the queue and return from checkout.

    • check: GET :80/order on "web" contains "accepted"
    • check: key "stats:orders" exists in "queue"

Consume

Process jobs and keep receipts in shared storage.

05-06
  1. The first worker

    Add a worker that consumes jobs and updates queue counters.

    • check: container "worker-1" is running
    • check: worker-1 → queue is reachable on :6379
    • check: key "stats:receipts" exists in "queue"
    • check: GET :80/ on "web" contains "backlog: 0"
  2. The receipt archive

    Store receipts in PostgreSQL instead of a worker disk.

    • check: container "archive" is running
    • check: worker-1 → archive is reachable on :5432
    • check: table "receipts" exists in "archive"
    • check: web → archive is blocked on :5432

Operate

Scale workers and dead-letter a bad job.

07-08
  1. The flash sale

    Deploy a worker fleet and drain the flash-sale backlog.

    • check: "worker-asg" keeps 3 replicas running
    • check: container "worker-1" is running
    • check: GET :80/ on "web" contains "backlog: 0"
  2. The poison order

    Move an invalid order into the dead-letter queue.

    • check: key "queue:orders:dead" exists in "queue"
    • check: GET :80/order on "web" contains "accepted"

Run locally

Start the roadmap on your machine

Torollo runs the lab in local Docker containers. The roadmap and its validators ship with the MIT-licensed app.

Inspect the source on GitHub

Before you start

  • Docker installed and running
  • A Torollo project created and open on the canvas (start from an empty one)
  • Comfortable running basic commands in a Linux terminal
  • Having played "Deploy a resilient three-tier app" or "Cache-aside with Redis" helps, but this story stands on its own