← Projects

Durable Jobs

A Go and PostgreSQL background-job service built to survive retries, vanished workers, and bad deploys, with recovery drills measured on AWS.

Stack
Go, PostgreSQL, Kubernetes, AWS EKS, Terraform, Prometheus, Grafana
Source
github.com/ZhuoqunWei/durable-jobs

A job queue is easy until a client retries, a worker disappears halfway through a job, or a deploy goes wrong. Durable Jobs is a small service that handles each of those cases explicitly, plus a lab that breaks it on purpose and records how long recovery takes.

How it works

Timeline. Worker A claims the job with token 7 and stalls. Its lease expires. Worker B claims the job with token 8. Worker A wakes up and commits with token 7, which is rejected. Worker B commits with token 8, which is accepted, and the job is done. Worker APostgreSQLWorker Blease expirestime →claims · token 7stallswakes uplate commit · token 7rejectedlease · token 7lease · token 8doneclaims · token 8commit · token 8accepted
Leases and fencing. Worker A claims the job and stalls. Once its lease expires, worker B claims the job with a newer token and finishes it. When A wakes up, its commit still carries token 7, so it is rejected.

Reliability lab

Terraform provisions a private EKS environment: internal HTTPS load balancing, private DNS, workload identities, and encrypted database storage. Six failure drills cover worker interruption, a database restart, slow writes, a failed rollout, invalid jobs, and retry exhaustion. A separate load test measures normal traffic.

Worker interrupted after claiming a joblease expired, job succeeded on retry
33.3 s
PostgreSQL pod restartsame persistent volume
13.4 s
Bad API rollouttwo old replicas stayed available
6.5 s
Time to recover. Seconds from the injected failure to recovery in three of the six drills. For the bad rollout, the time to restore the previous pod template.
jobs succeeded
600 / 600
p95 from enqueue to completion
960 ms
failure drills, plus the load test
6
Steady load. One minute at a target of 10 submissions per second, with one worker.

These are synthetic results from a short single-node lab (one t3.medium node, two API replicas, one worker, one PostgreSQL pod) on September 28–29, 2026. They aren’t production capacity or availability claims, and the pod restart isn’t a backup-restore test.

Hosted CI runs container, race, integration, and smoke checks, offline infrastructure checks, and a disposable Kubernetes recovery demo.