Overview
Conveyor is a distributed task queue for background work such as sending emails, resizing images and generating reports. Producers push jobs through a small gRPC API, and a pool of workers pulls them, runs them and reports back.
The problem
Simple queues lose work when a worker crashes halfway through a job, and they give little visibility into what is stuck. I wanted a queue that never silently drops a job and that shows exactly where the bottleneck is.
How it works
- Jobs are stored in Redis sorted sets keyed by priority and run time, so delayed and scheduled jobs come for free.
- Each worker takes a time-limited lease on a job. If it stops sending heartbeats, the lease expires and the job goes back to the queue.
- Failed jobs retry with exponential backoff and move to a dead-letter queue after the final attempt.
- Every component exports Prometheus metrics, visualised in a Grafana dashboard.
Results
In load tests on three small cloud machines, Conveyor processed 40,000 jobs per minute with a p99 scheduling delay of 85 ms. Killing workers at random during the test lost zero jobs.
What I learned
Designing for failure first changed how I write services. Idempotent job handlers, careful timeouts and good metrics mattered more than raw speed.