Knowledgebase

Queues and Background Work Print

  • phplaravel, performance, database, webhosting, guide, howto, solution, zillionkinghost
  • 0

Deferring slow operations.

WHAT A QUEUE DOES

Accepts work now, performs it later, outside the request.

WHAT TO QUEUE

Sending mail Image and file processing External API calls Report generation Anything slow

WHY

A request should return quickly. Anything slow inside it degrades the experience and risks timeouts.

WHAT IS NEEDED

A queue driver, and a worker process consuming jobs.

WHAT DRIVERS EXIST

Database, which requires nothing additional Dedicated queue systems, for higher volume

WHAT SUITS SHARED HOSTING

The database driver, with a worker started by a scheduled task.

WHY NOT A PERSISTENT WORKER

Long-running processes are frequently restricted, and they consume resources continuously.

WHAT TO CONFIGURE

Retry behaviour A limit on attempts Handling of failed jobs

WHAT TO DO WITH FAILURES

Record them, and be able to inspect and retry.

WHAT TO MONITOR

Queue length, and whether the worker is running.

WHAT TO BE CAREFUL WITH

Jobs that are not safe to run twice.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot