concept

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.

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.

When to use background job

Common mistakes

FAQ

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 I use background job?

Asynchronous post-request work. Scheduled cron-style jobs.

What are the most 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.