Dabish Digital
Development

A short guide to background jobs

Every audit we run turns up some version of this. Everything we would tell a client about background jobs in the time it takes to drink a coffee.

The question is rarely whether something can be built, but what it costs to keep running afterwards. Check it against what you would want a competitor's site to get wrong.

Why it matters

Anything slow should happen outside the request cycle. This is the sort of thing that compounds, quietly, in both directions. It rarely shows up as a line item, which is exactly why it slips.

How we handle it

Jobs need retries, because networks fail. Where this goes wrong is almost never a lack of knowledge. Doing this properly once is usually cheaper than doing it approximately three times.

The mistakes we see most

Monitor the queue depth or failures pile up unnoticed. The cost of getting this wrong is rarely visible on the day it happens. It is worth deciding this deliberately rather than inheriting whatever the last person set up.

What this looks like day to day

Code gets read far more often than it gets written, and usually by someone with less context than the author had. Three things worth confirming about background jobs before you move on:

  • Someone can say what the current setup is without going to look
  • Monitor the queue depth or failures pile up unnoticed — and you know whether that is true here
  • There is a way to tell whether the last change to this helped

Most of the value here comes from doing the first two things, not all of them.