Expand or contract zoekt index storage reservations

What does this MR do and why?

Update zoekt index storage reservations

Whenever an index is changed it will expand or contract its reserved storage.

An index "reserves" storage so the amount of disk utilization on a node is more stable. The end goal is to use the zoekt index reserved storage bytes as a capacity limit to determine whether the repository it holds should stay or be re-allocated to another zoekt index.

A zoekt node has many zoekt indices, and a zoekt index has many zoekt repositories. When a zoekt node reaches a watermark level, it should have indices removed. At a smaller scale, when a zoekt index reaches a watermark level, it should have its repositories removed.

We ideally want to keep an index's utilization of its reserved_storage_bytes to be about 40% usage. This MR introduces a scheduled task that looks for zoekt indices that have a storage utilization that is either significantly too much (with storage watermarks) or too little (overprovisioned) and will attempt to change the storage reservation to bring that utilization closer to 40%.

Related to #494311 (closed)

Query plan

https://postgres.ai/console/gitlab/gitlab-production-main/sessions/32896/commands/101383

UPDATE "zoekt_indices" SET "reserved_storage_bytes" = 524288000 WHERE "zoekt_indices"."id" = 22777
Time: 12.516 ms  
  - planning: 0.641 ms  
  - execution: 11.875 ms  
    - I/O read: 10.791 ms  
    - I/O write: 0.000 ms  
  
Shared buffers:  
  - hits: 24 (~192.00 KiB) from the buffer pool  
  - reads: 20 (~160.00 KiB) from the OS file cache, including disk I/O  
  - dirtied: 9 (~72.00 KiB)  
  - writes: 0  
  

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 John Mason

Merge request reports

Loading