SAG / ARCHITECTURE NOTE

Job Queues, Retries, and Dead Letters: Safely Operating Long Analyses

Explains what job queues are and why they are needed, how they work, and how to apply them in the SAG architecture, with practical checklists grounded in research and official documentation.

Download Markdown

Definition in one sentence

A job queue is a structure that separates long-running analyses from requests and explicitly manages their status, retries, and failure isolation.

Key answer: Networks and external services fail, and serverless execution times are limited. Returning failures as if they were successes or retrying indefinitely creates cost and trust issues.

Why is this technology needed?

Networks and external services fail, and serverless execution times are limited. Returning failures as if they were successes or retrying indefinitely creates cost and trust issues.

How it works

Define states such as queued, running, retryable, dead_letter, and awaiting_review, and transition between them atomically. Use exponential backoff and a retry budget, and send permanent failures for operational review.

When designing a system, accuracy is not the only consideration. Latency, cost, data boundaries, refresh cadence, and behavior on failure must also be defined to make results reproducible in production. It is safer to leave values that automation cannot determine with confidence as unmeasured or requiring review, rather than changing them to 0 or marking them as successful.

Connection to SAG technology

SAG jobs recover interrupted running jobs to retryable and isolate them as dead letter when the retry budget is exhausted. Long analyses are performed outside write transactions.

Practical checklist

  • Define a state transition table and the actors permitted to make transitions
  • Classify errors that can be retried
  • Create a procedure for reprocessing dead letters
  • Distinguish the statuses of failures, empty results, and permission errors from success
  • Revalidate before and after changes under the same conditions

Research and official documentation

Reference documents provide support for principles and recommendations. They do not guarantee search visibility, AI mentions, rankings, or revenue; the actual effects of implementation must be verified through observations of service data under the same conditions.

How to continue reading about this technology

Explore tenant permissions, job retries, caches, and approval history.

Articles