Skip to content

Remove queue selector and negate options from Sidekiq cluster CLI

What does this MR do and why?

Part of gitlab-com/gl-infra/scalability#2220 (closed)

  • Remove --queue-selector and --negate option from sidekiq-cluster CLI (breaking change)
  • Expand * in queue_groups to only the queues mentioned in routing rules + mailers.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

Without routing rules

  1. Ensure sidekiq.routing_rules is empty/undefined in gitlab.yml

  2. Restart gdk restart rails-background-jobs if needed

  3. Run sidekiq

    ❯ bin/sidekiq-cluster --dryrun a,b,c
    bundle exec sidekiq -c20 -edevelopment -t25 -gqueues:default,mailers -r/Users/gregoriusmarco/Documents/workspace/gdk-10-22/gitlab -qdefault,1 -qmailers,1
  4. The queues can be replaced to default and mailers because routing rules is set to [['*', 'default']] by default (https://gitlab.com/gitlab-org/gitlab/-/blob/8197b3f957111f748d5ac75be367176faa7c0d09/config/settings.rb#L176-180). Any other queues specified shouldn't be listened to.

  5. Run sidekiq with *

    ❯ bin/sidekiq-cluster --dryrun '*' '*'
    bundle exec sidekiq -c20 -edevelopment -t25 -gqueues:default,mailers -r/Users/gregoriusmarco/Documents/workspace/gdk-10-22/gitlab -qdefault,1 -qmailers,1
    bundle exec sidekiq -c20 -edevelopment -t25 -gqueues:default,mailers -r/Users/gregoriusmarco/Documents/workspace/gdk-10-22/gitlab -qdefault,1 -qmailers,1
  6. Also expanded to default and mailers (also current behavior)

With routing rules

  1. Apply below routing rules in gitlab.yml

        routing_rules:
          - ["resource_boundary=cpu", "cpu-bound"]
          - ["resource_boundary=memory", "memory-bound"]
          - ["*", "default"]
  2. Run sidekiq cluster:

    ❯ bin/sidekiq-cluster --dryrun '*' cpu-bound
    bundle exec sidekiq -c5 -edevelopment -t25 -gqueues:cpu-bound,memory-bound,default,mailers -r/Users/gregoriusmarco/Documents/workspace/gdk-10-22/gitlab -qcpu-bound,1 -qmemory-bound,1 -qdefault,1 -qmailers,1
    bundle exec sidekiq -c2 -edevelopment -t25 -gqueues:cpu-bound -r/Users/gregoriusmarco/Documents/workspace/gdk-10-22/gitlab -qcpu-bound,1

    Note that * is expanded to queues from the routing rules in the first process, whereas cpu-bound stays the same.

Edited by Gregorius Marco

Merge request reports