Cache gitlab-pages internal endpoint response
What
For GET /api/internal/pages?host=HOST
. This is the API endpoint that gets called by GitLab pages when a request comes in and we haven't cached in gitlab-pages what needs to be served for this.
Given that the satisfiedThreshold
for writing headers for a response is 0.5s, ideally, this would be even faster than the threshold set for web-pages
. We think 0.5s for serving a static page is an acceptable target.
Proposed solution
Since this information generally does not change a lot, we could add a cache for the JSON response of this endpoint to help the metrics.
The cache must use the to level (root) namespace id as the key
Iteration
Based on the SPIKE done before (#359972 (closed)) This issue will handle:
- Cache creation and usage (behind a feature flag)
- Cache invalidation with the
Pages deployed
event
The other events (&7920 (closed)) that might invalidate the cache will be introduced later.