Improve long-term scalability of CancelRedundantPipelinesService
Summary
In #414833 (closed), we made found a better index to query and shortened the cancelable pipeline window from 7 to 3 days, due to the query performance being bad enough to actually degrade GitLab SaaS.
In addition to the relatively narrow fixes, there was discussion of longer-term scalability solutions: #414833 (comment 1485475470)
Those should be further investigated so we can continue to provide this feature with as-good or better performance as we scale.
Improvements
- Decrease the duration of database queries from
CancelRedundantPipelineService
Risks
- We could accidentally make performance worse
- We could accidentally make the feature less reliable
Involved components
- CancelRedundantPipelineService
Proposals
- #414833 (comment 1485475470)
- Use the current query, but execute it multiple times for different time windows (timestamp-based batching strategy)