Menu

How to measure queue depth and the age of the oldest unprocessed job (Postgres, Redis/Sidekiq and BullMQ)
📰

How to measure queue depth and the age of the oldest unprocessed job (Postgres, Redis/Sidekiq and BullMQ)

DEV Community: redis·delay.run·3 days ago
#xlBN9ufB
#devtoredis#devto#dev#latency#depth
Long article (1287 words) — no AI summary yet.
Reading 0:00
15s threshold

Reliable HTTP cron and delayed-job scheduling with automatic retries and full run logs — delay.run

"The workers are running" is not the same as "the work is on time". A queue can be accepting jobs, a process can be up, and the oldest unprocessed job can be 45 minutes past its run_at . If you only alert on process liveness or on a 5xx from the web app, you will learn about that 45 minutes from a customer.

Depth (how many jobs are waiting) and age (how late the oldest due job already is) are the two numbers that catch this. They are cheap to read if you measure them the same way the worker does, and expensive if you SELECT FOR UPDATE the live queue to do it.

What to measure

Two figures, per queue, on a short interval (30–60 seconds is plenty):

Depth: how many jobs are ready to run right now (due, not reserved, not done, not in a dead-letter).

Age: now minus the time the oldest of those jobs became runnable ( run_at or enqueued_at , depending on the system). Age of zero with depth of zero is healthy.…

Continue reading — create a free account

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