Loading
Increase ref cache trust TTL
What does this MR do and why?
Contributes to https://gitlab.com/gitlab-org/gitlab/-/work_items/627425
Problem
Metrics show that the majority of cases for a cache rebuild are due to trust key expirations: https://dashboards.gitlab.net/goto/afx4lhovbnbb4f?orgId=1
The previous value of 1 hour was chosen arbitrarily and intentionally quite low to self-heal quicker if something goes wrong.
The new cache has been operational on GitLab.com for several months, and it should be safe to increase the trust duration to benefit from cache hits.
Solution
- Add a project-scoped flag for a six-hour trust TTL with up to 30 minutes of jitter.
- Apply the selected TTL to both direct Redis and Lua trust writers.
- Cover enabled and disabled behavior for empty and non-empty caches.
References
How to set up and validate locally
- The
increase_ref_cache_trust_ttlflag is default-disabled and scoped to projects. - With the flag disabled, verify the existing one-hour trust TTL and no jitter.
- Enable the flag for a project and verify the six-hour TTL with up to 30 minutes of jitter.
- Run the focused RSpec spec. Verification completed with 173 examples, with no RuboCop offenses. The feature flag definition also loads successfully.
Edited by Vasilii Iakliushin
