Skip to content

Implement ResourceUsageLimit sidekiq server middleware

Sylvester Chin requested to merge sc1-sk-resource-limit-middleware into master

What does this MR do and why?

This MR implements a ResourceUsageLimit Sidekiq server middleware. It is behind a feature flag. The middleware uses a wrapper over Gitlab::ApplicationRateLimiter to track resource usages. The resource in question refers to any key tracked in the SafeRequestStore such as cpu, redis, database, gitaly durations/counts etc. But for this MR and gitlab.com's short-term scalability concerns, we focus on db_main_duration_s and db_ci_duration_s.

The resource usage limits are hardcoded with some sane values based on gitlab-com/gl-infra/scalability#3859. Note that the follow-up tasks will be to enable users to configure the limits using ApplicationSettings (gitlab-com/gl-infra/scalability#3920).

Note: This MR was broken out from !168193 (closed) and improved.

References

Please include cross links to any resources that are relevant to this MR This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

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

Numbered steps to set up and validate the change are strongly suggested.

Edited by Sylvester Chin

Merge request reports

Loading