Menu

NonoDB in practice #2: background jobs with leases and retries, no Redis
📰

NonoDB in practice #2: background jobs with leases and retries, no Redis

DEV Community: mongodb·Greg·14 days ago
#MBkfzVgq
#devtomongodb#devto#dev#jobs#status
Long article (2073 words) — no AI summary yet.
Reading 0:00
15s threshold

he second-most-common reason I reach for Redis is a job queue.

Not a high-throughput event bus — just "send this email", "sync this customer",

"generate this PDF". A few hundred jobs a day on a single VM. And yet the

default advice is to add BullMQ or Sidekiq, which means adding Redis, which

means another process to monitor, another persistence model to reason about,

and another backup job nobody wrote.

There is a middle path that fits the same small deployment as the app: keep the

jobs in the same database as the data, and make the queue semantics explicit

with a single atomic operation.

In this post we build a durable job queue with:

atomic claim (no two workers run the same job),

fenced leases (a slow worker cannot finish a job after losing it),

exponential backoff and a maximum attempt count,

idempotent enqueue,

at-least-once delivery, and handlers that can live with that.

The database is NonoDB, a single Rust daemon over LMDB.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.