Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvment: Wont spawn extra queues #1508

Merged
merged 1 commit into from
Oct 16, 2024
Merged

Conversation

alexmontoanelli
Copy link
Contributor

@alexmontoanelli alexmontoanelli commented Oct 14, 2024

Consider the follow setup:

 'defaults' => [
        'supervisor-1' => [
            'connection' => 'redis',
            'queue' => ['default'],
            'balance' => 'auto',
            'autoScalingStrategy' => 'time',
            'maxProcesses' => 1,
            'maxTime' => 0,
            'maxJobs' => 0,
            'memory' => 128,
            'tries' => 1,
            'timeout' => 60,
            'nice' => 0,
        ],
       'supervisor-2' => [
            'connection' => 'redis',
            'queue' => ['high'],
            'balance' => 'auto',
            'autoScalingStrategy' => 'time',
            'maxProcesses' => 1,
            'maxTime' => 0,
            'maxJobs' => 0,
            'memory' => 128,
            'tries' => 1,
            'timeout' => 60,
            'nice' => 0,
        ],
    ],


'production-1' => [
          'supervisor-1' => [
              'maxProcesses' => 10,
              'balanceMaxShift' => 1,
              'balanceCooldown' => 3,
          ],
      ],

'production-2' => [
          'supervisor-2' => [
              'maxProcesses' => 10,
              'balanceMaxShift' => 1,
              'balanceCooldown' => 3,
          ],
      ],

Currently, in every environment, the MasterSupervisor run all the supervisors queues.

In a multi server deployment, if you spawn horizon on second server with the --environment=production-2, you always get a production-1 supervisors too (default queue in this case) (picture 1).
image

With this change, we can selectible choice the supervisors that we want to run on each enviroments, just checking for the maxProcess > 0.

Imagine that you want a horizon instance to only process slow queues, or you have a high power vm/cpu/vps that you just want to run specific queue.

I cant figure out how to dead with this cenario, without this change.

Maybe we can put a global config, to 'dont spawn queues not listed in supervisor'...

What do you think about?

    'production-2' => [
            'supervisor-1' => [
                **'maxProcesses' => 0,**
            ],
            'supervisor-2' => [
                'maxProcesses' => 10,
                'balanceMaxShift' => 1,
                'balanceCooldown' => 3,
            ],
        ],
Screenshot 2024-10-14 at 16 42 57

@taylorotwell taylorotwell merged commit d9c39ce into laravel:5.x Oct 16, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants