Drop the use of namespace in Sidekiq and Mailroom delivery
What does this MR do and why?
This MR drops the use of namespace in Redis for Sidekiq and Mailroom delivery.
See gitlab-com/gl-infra/scalability#2288 (closed)
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
Part 1: running on master
branch with namespace
- Start gdk using
gdk start
. Stop background jobs usinggdk stop rails-background-jobs
- Open a rails console with
gdk rails c
and run a dummy job
[1] pry(main)> Chaos::SleepWorker.perform_async(13)
=> "e9611e428695bd51b893329b"
[2] pry(main)> Chaos::SleepWorker.perform_in(10, 13)
=> "688b4fd43262db8245703120"
- Confirm on redis that namespaced queue is used.
➜ gitlab git:(master) ✗ gdk redis-cli -n 1 zcard resque:gitlab:schedule
(integer) 1
➜ gitlab git:(master) ✗ gdk redis-cli -n 1 llen resque:gitlab:queue:default
(integer) 1
Part 2: running this branch without namespace
- Restart gdk on this branch
> git checkout sc1-deprecate-namespace
> gdk restart
> gdk stop rails-background-jobs
- Open a rails console to test the enqueues
➜ gitlab git:(sc1-deprecate-namespace) ✗ gdk rails c
Loading development environment (Rails 7.0.8)
[1] pry(main)> Chaos::SleepWorker.perform_in(10, 13)
=> "6f7906d72972ab8773a979d2"
[2] pry(main)> Chaos::SleepWorker.perform_async(13)
=> "5db2e9d0abc57c37e2ba822d"
- Verify on Redis:
➜ gitlab git:(sc1-deprecate-namespace) ✗ gdk redis-cli -n 1
redis /Users/sylvesterchin/work/gitlab-development-kit/redis/redis.socket[1]> zcard schedule
(integer) 1
redis /Users/sylvesterchin/work/gitlab-development-kit/redis/redis.socket[1]> llen queue:default
(integer) 1
Part 3: Post-deploy Migration
- Run or redo the migration
bin/rails db:migrate:redo:main VERSION=20231003045342 RAILS_ENV=development
bin/rails db:migrate:up:main VERSION=20231003045342 RAILS_ENV=development # run this if it is the first time
- Verify on Redis that the pdm moves namespaced jobs to non-namespaced data structures.
redis /Users/sylvesterchin/work/gitlab-development-kit/redis/redis.socket[1]> zcard resque:gitlab:schedule
(integer) 0
redis /Users/sylvesterchin/work/gitlab-development-kit/redis/redis.socket[1]> llen resque:gitlab:queue:default
(integer) 0
redis /Users/sylvesterchin/work/gitlab-development-kit/redis/redis.socket[1]> llen queue:default
(integer) 2
redis /Users/sylvesterchin/work/gitlab-development-kit/redis/redis.socket[1]> zcard schedule
(integer) 2
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Sylvester Chin