When to add a queue

A queue absorbs a temporary rate mismatch. It does not create processing capacity.

Written deep dive25% previewBy Daniyal Saqib

Read the opening here. A free account gives you the full guide.

Follow one uploaded PDF from acceptance to searchability. Derive the asynchronous boundary from the user’s requirement, preserve accepted work through a crash, and explain why durable waiting still needs enough processing capacity.

01

Begin with the product requirement

The product may acknowledge a durable upload before the document becomes searchable.

A user uploads a PDF so that search and chat can reference it later. The product allows two visible states: the upload is accepted, then the document becomes searchable. That permission is the reason we can consider background processing. A slow operation alone would not establish it. If the user needed the complete searchable result in this response, we would have a different request contract.

Follow document doc-456 and ingestion job ing-123 throughout the guide. The document is the stored input. The job is our responsibility to process that input. The request is only the HTTP interaction used to submit it. Those three lifetimes need not end together: the connection may close while the document and unfinished job remain.

We choose to track the ingestion until it reaches READY or FAILED. We have not promised that every PDF will succeed: a corrupt document may be impossible to process. We have promised that acknowledging responsibility will not silently discard its work. That is the shared correctness requirement, including in this first explanation.

02

Start without a queue

The baseline keeps the upload request open through every required processing stage.

The simplest path validates and stores the PDF, performs OCR, runs required checks, creates embeddings, updates the search index, and then responds. It can be a sensible first implementation when volume is low and those steps reliably fit the user’s wait. Avoid treating the absence of a broker as an automatic design flaw.

Synchronous does not mean that the server handles only one request at a time. It may process many uploads concurrently. Each request still waits for its own slowest stage.

5 more sections to read

Sign in to keep reading

When to add a queue

Continue this section and read the complete guide and explore its visuals.

Free account. No payment required.

Read how we handle account information in our privacy notice.

5 more sections to read

There’s more in the full article

Continue reading with a free account.

Keep reading

Free account. No payment required.

Inside the full article

Continue the guide with 5 more sections.

  1. Separate acceptance from processingRead after sign-in
  2. Follow the queue-backed pathRead after sign-in
  3. Reason about waiting and capacityRead after sign-in
  4. Choose from required behaviorRead after sign-in
  5. Make the decision explainableRead after sign-in
Continue reading

5 more sections to read

Sign in to keep reading

When to add a queue

Continue this section and read the complete guide and explore its visuals.

Free account. No payment required.

Read how we handle account information in our privacy notice.