Queue Everything That Can Wait

·1 min read·

Synchronous processing is right for operations that must complete before responding. For everything else, a job queue is better.

The operations that must complete synchronously are fewer than most applications assume: validating input, checking authentication, performing the core state change, and returning the result.

Everything else can be queued: sending emails, generating PDFs, processing images, triggering webhooks, running analytics events, updating search indexes.

The benefits compound: the web request returns faster, the queued work can be retried automatically on failure, the queue workers can be scaled independently.

Queue what can wait. Your users will notice the difference.

— Dick Bassey | DevDick | 2022

Share this article
← Back to all writing