Understanding Laravel Horizon's processes and queue settings!

Published 1 week ago by Ranx99

In Laravel Horizon's settings:

'local' => [
    'supervisor-1' => [
        'connection' => 'redis',
        'queue' => ['default'],
        'balance' => 'simple',
        'processes' => 3,
        'tries' => 3,
    ],
],
  • How can I determine the number of processes I should use in processes setting?
  • Is there a limit number of processes?
  • In the queue setting, as I understand this setting is for separating my queues ( Ex: uploadImageQueue, verfyEmailQueue, etc.. ) is this the right? is there a limit for the number of queues I can set?
Best Answer (As Selected By Ranx99)
D9705996

@Ranx99 - I depends on how many registration emails you need to send. Start with one process and monitor the wait time of jobs on that queue. If it gets too large for your application then double your processes, repeat as necessary (obviously within constraints of your hardware).

You can set up a cron job to monitor wait times as per

https://laravel.com/docs/5.7/horizon#metrics

D9705996
D9705996
1 week ago (127,290 XP)

@Ranx99

  1. There is no hard and fast rule on the correct number of processes, depends on how many jobs you are processing. If your noticing an unacceptable wait time then add another process.

  2. Your server specification will ultimately determine how many processes you can run. If you CPU starts running at 100% then you need to reduce you processes, increase hardware or look at distributing your queues across multiple servers.

  3. Queues related to the settings in config/queue.php. You can use these to give different queues different properties like timeout. You can configure as many queues as you need.

Ranx99
Ranx99
1 week ago (1,610 XP)

@D9705996

If I have a website and I want to send a verification email to a registered user's email ( via mailgun for example ). How can I tell what is the number of processes that is good for such a job?

D9705996
D9705996
1 week ago (127,290 XP)

@Ranx99 - I depends on how many registration emails you need to send. Start with one process and monitor the wait time of jobs on that queue. If it gets too large for your application then double your processes, repeat as necessary (obviously within constraints of your hardware).

You can set up a cron job to monitor wait times as per

https://laravel.com/docs/5.7/horizon#metrics

Please sign in or create an account to participate in this conversation.