Background job
A background job is the unit of work in a [[task-queue]] system — a small piece of code that runs out-of-band from a request, may be retried on failure, and reports back via webhook / dashboard / database update.
In more detail
What it means
Background jobs are short-to-medium-running async tasks: send a welcome email, render a PDF, call an LLM, kick off a cron-scheduled report. They differ from full workflows ([[durable-execution]]) by being mostly single-step; workflows are multi-step + stateful. Best practices: keep jobs small (< 5 min ideal), make them idempotent (safe to retry), use structured logging, capture errors to observability (Sentry / Datadog), expose a queue-depth metric to alert on backups. Frameworks differ on what they optimize: Sidekiq + BullMQ are throughput-first; Trigger.dev + Inngest add durable + replay; cloud queues (SQS, Cloud Tasks) trade richer UX for scale and managed-ness.
Part 1 of 2
When to use it, and when not
Use it for
- Asynchronous post-request work.
- Scheduled cron-style jobs.
Part 2 of 2
Common mistakes
- Making jobs too big — long-running jobs survive workers crashes poorly.
- Not making jobs idempotent — retries duplicate side effects.
FAQ
Questions readers ask.
What is background job?
A background job is the unit of work in a [[task-queue]] system — a small piece of code that runs out-of-band from a request, may be retried on failure, and reports back via webhook / dashboard / database update.
When should you use background job?
Asynchronous post-request work. Scheduled cron-style jobs.
What are the common mistakes with background job?
Making jobs too big — long-running jobs survive workers crashes poorly. Not making jobs idempotent — retries duplicate side effects.
Last updated: 2026-06-01. Raw markdown: https://promtable.com/glossary/background-job.md. Found a mistake? Tell us.