Refactor WorkersMap to WorkerAttributes
What does this MR do and why?
This MR copies methods in Gitlab::SidekiqMiddleware::ConcurrencyLimit::WorkersMap
and move them into respective WorkerAttributes
concern.
To derisk the changes, we added a feature flag sidekiq_concurrency_limit_middleware_v2
in the concurrency limit client/server middleware (which is the primary caller of the WorkersMap
). The WorkersMap
will then be removed once we remove the sidekiq_concurrency_limit_middleware_v2
feature flag too.
This also fixes:
-
ConcurrencyLimitSampler
not picking up workers with default concurrency limit -
ResumeWorker
does not resume workers with default concurrency limit too. -
ResumeWorker
does not respect the current limit of the worker (when throttled). This should have been implemented in !194627 (merged)
References
gitlab-com/gl-infra/data-access/durability/team#254 (closed)
How to set up and validate locally
ConcurrencyLimitSampler
- Enable sidekiq exporter in GDK:
❯ cat gdk.yml | yq '.gitlab.rails_background_jobs'
sidekiq_exporter_enabled: true
sidekiq_exporter_port: 3807
sidekiq_health_check_enabled: false
sidekiq_health_check_port: 3907
sidekiq_queues:
- default
- mailers
timeout: 10
verbose: false
- There should be hundreds of metrics reported in
/metrics
❯ curl -s 'gdk.test:3807/metrics' | rg sidekiq_concurrency_limit_current_concurrent_jobs | wc -l
950
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Marco Gregorius