Skip to content

Apply Sidekiq sharding router to Sidekiq::Job::Setter

Sylvester Chin requested to merge sc1-sidekiq-shard-route-job-setter into master

What does this MR do and why?

This MR applies Sidekiq sharding router to Sidekiq::Job::Setter.

This covers cases where a Sidekiq job class uses a Setter. This occurs in Sidekiq Crons, SidekiqStatus and deferring jobs.

Refer to gitlab-com/gl-infra/scalability#2817

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.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. Start a local docker for Redis
docker run -p 6378:6379 -d redis:6.2-alpine
  1. Update config files
➜  gitlab git:(sc1-maildelivery-shard-awareness) ✗ cat config/redis.yml
---
development:
  queues_shard_catchall_a:
    url: "redis://localhost:6378"

Also update config/gitlab.yml with:

## Sidekiq
  sidekiq:
    log_format: json # (default is also supported)
    routing_rules:
      - ["tags=needs_own_queue", null]
      - ["*", "default", "queues_shard_catchall_a"]
  1. Enable feature flags
Feature.enable(:enable_sidekiq_shard_router)
Feature.enable(:sidekiq_route_to_queues_shard_catchall_a)
  1. Run gdk restart

  2. Run gdk tail rails-background-jobs -- observe that no jobs logs show up other than the occasional "job_status":"deduplicated"

  3. On another terminal, run SIDEKIQ_SHARD_NAME=queues_shard_catchall_a bundle exec ruby bin/sidekiq-cluster default,chaos -e development --timeout 10 --max-concurrency 10 --min_concurrency 10. All jobs logs should be here

  4. repeating this on master branch would give us different results. In step 5, we would observe cronjobs being performed there.

Edited by Sylvester Chin

Merge request reports