Shipping ItLesson 35 of 74

Module 4 · Load, cost and the traffic that is not customers

Work that does not belong in a request

In this lesson

  • 10 min read
  • 7 reading sections
  • Knowledge check
  • Lesson 7 of 10 in this chapter

This chapter’s goalFind your first real ceiling with a load test and raise it using caching, pooling or a queue, without raising the bill.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available
A job’s life, designed for the fact that it will run twiceRequestinserts ajob rowand returnsto the userimmediatelyWorkerclaims onerowFOR UPDATESKIP LOCKED;other workersstep over itCheck theidempotencykeyalready done?mark completeand stopDo the work,then markdonea crashbetween thetwo bringsthe job backOn failure,retry withbackoff andjitter1 s, 2 s, 4s, 8 s, eachplus a randomoffsetAfter Nattempts,dead-letteritand alertwhen thatqueue isdeeper thanzeroPostgres with FOR UPDATE SKIP LOCKED is a perfectly good queue for most projects. Whatever the store,delivery is at least once, so every job carries an idempotency key and every retry is backed off withjitter.
Postgres with FOR UPDATE SKIP LOCKED is a perfectly good queue for most projects. Whatever the store, delivery is at least once, so every job carries an idempotency key and every retry is backed off with jitter.

Figure

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 8Free · no account needed
Lesson steps

The test

Would this still be correct if it took thirty seconds and sometimes failed? If yes, it does not belong in the request.

The usual list: sending email, generating thumbnails or PDFs, calling a slow third-party API, syncing to another system, building an export, sending webhooks out, anything that fans out to many recipients.

Leave them in the request and two things happen. The user waits for work they did not ask to wait for. And when the request times out, the work is lost halfway: the order is saved and the confirmation email is not, with nothing recording that.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the Agents and Automation exam.

Stuck on something?Ask Tri, your AI tutor

How to cite: Addaly (2026) ‘Work that does not belong in a request’, in Shipping It. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/cloud-and-shipping/queues-and-background-work (Accessed: 27 November 2026).