Queue
If you're just starting out, you won't need a queue. But once you reach a certain scale, you cannot go without one.
Why should I care?
A Flarum installation that has no queue configured, will process a wide variety of tasks during the request of a user. The best example of such a task are email notifications. Flarum Subscriptions, Friends of Flarum Follow Tags and IanM Follow Users are just a few extensions that trigger email notifications for new activity. It is probably not a mystery that having a community of ten users will not be much of an issue in this regard. However once you have thousands it is far more likely that these notifications will take a long time, and affect the interaction of users on your community.
To resolve this increasing burden, you can run a Queue. A queue runs on your server, it does not interact with the user and their requests. A user request, however, can dispatch tasks to the queue.
By default, Flarum uses the sync driver, which processes jobs immediately inline during the user's request — convenient, but it means the user waits for every job to complete before getting a response.
How do I set up a queue?
Since Flarum 2.x, the database queue driver is built into Flarum core — no additional extension is required. To enable it, set the queue driver to database in your config.php:
'queue' => [
'driver' => 'database',
],
The database queue re-uses the scheduler to process jobs, so you must have the scheduler configured to run every minute for it to work. See the scheduler guide for setup instructions.
Going further than the database driver
For higher throughput than the database driver can sustain, two extensions build on top of Flarum's queue:
- FoF Redis moves the queue (and, optionally, the cache, sessions and settings) onto a Redis-compatible server such as Redis or Valkey. Jobs are processed by the standard
php flarum queue:workworker, but against Redis instead of the database — faster, and it keeps this load off your database. Failed jobs are kept in Redis too. - FoF Horizon builds on FoF Redis (it requires it) and adds Laravel Horizon on top: supervised, auto-balancing worker processes in place of a single
queue:work, plus a full real-time dashboard showing throughput, wait times, job history, and per-queue metrics. It also enriches the admin queue widget with worker and status information. Choose Horizon when you're running at a scale where you want to tune worker pools per queue and watch the queue's health in detail.
Both integrate with the monitoring, failed-job, pausing and named-queue features described below.