R
R
Roman Sarvarov2021-09-22 18:28:34
Laravel
Roman Sarvarov, 2021-09-22 18:28:34

Laravel Horizon: many supervisors - few queues or few supervisors - many queues?

What is the difference - many supervisors - few queues or few supervisors - many queues.
As I understand it, the second option is better - because. does balancing work inside the supervisor?

1 option:

'defaults' => [
        'supervisor-1' => [
            'connection' => 'redis',
            'queue' => ['high'],
            'balance' => 'auto',
            'minProcesses' => 1,
            'maxProcesses' => 1,
            'memory' => 128,
            'tries' => 3,
            'nice' => 0,
        ],
        'supervisor-2' => [
            'connection' => 'redis',
            'queue' => ['default'],
            'balance' => 'auto',
            'minProcesses' => 1,
            'maxProcesses' => 1,
            'memory' => 128,
            'tries' => 3,
            'nice' => 10,
        ],
        'supervisor-3' => [
            'connection' => 'redis',
            'queue' => ['low'],
            'balance' => 'auto',
            'minProcesses' => 1,
            'maxProcesses' => 1,
            'memory' => 128,
            'tries' => 3,
            'nice' => 20,
        ],
    ],


Option 2:
'defaults' => [
        'supervisor-1' => [
            'connection' => 'redis',
            'queue' => ['high', 'default', 'low'],
            'balance' => 'auto',
            'minProcesses' => 1,
            'maxProcesses' => 3,
            'memory' => 128,
            'tries' => 3,
            'nice' => 0,
        ],
    ],

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vism, 2021-09-22
@megakor

Yes, in the right direction thought.
Just do the situation usually, different settings.
For example, I have
one supervisor for everything in a row,
the second for uploading and processing photos
And different settings, respectively.
The high queue can also get clogged.
In order not to suffer with the queue, 2 different supervisors, a guarantee that my MEDIA queue will always run and not depend on the load or freezes of the first supervisor

'production' => [
            'supervisor-1' => [
                'connection' => 'redis',
                'queue' => ['high','medium', 'low'],
                'balance' => 'simple',
                'tries' => 3,
                'timeout' => 300,
                'maxProcesses' => 5,
                'balanceMaxShift' => 1,
                'balanceCooldown' => 3,
            ],
            'supervisor-2' => [
                'connection' => 'redis',
                'queue' => [
                    \App\Services\QueueService::QUEUE_NAME__MEDIA_TO_STORAGE,
                    \App\Services\QueueService::QUEUE_NAME__MEDIA_LIBRARY,
                ],
                'balance' => 'simple',
                'tries' => 3,
                'timeout' => 120,
                'maxProcesses' => 1,
                'balanceMaxShift' => 1,
                'balanceCooldown' => 3,
            ],
        ],

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question