Skip to content

cache metrics: LRU entries & capacity - #4384

Closed
larry-dalmeida wants to merge 1 commit into
zalando:larry-almeida-zse-cache-timeouts-prfrom
larry-dalmeida:metrics-a-lru-gauges
Closed

larry-dalmeida wants to merge 1 commit into
zalando:larry-almeida-zse-cache-timeouts-prfrom
larry-dalmeida:metrics-a-lru-gauges

Conversation

@larry-dalmeida

@larry-dalmeida larry-dalmeida commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary of changes

Adds LRU entry count and total capacity gauges for per-route cache monitoring.

How to Verify

Shared setup

mkdir skipper-review && cd skipper-review
git clone https://github.com/zalando/skipper.git skipper && cd skipper
for PR in 4369 4370 4371 4372 4384 4385 4386 4387; do
  git fetch origin pull/$PR/head:pr-$PR
  git worktree add ../skipper-pr-$PR pr-$PR
done
cd ..
git clone https://github.com/larry-dalmeida/skipper-cache-e2e-tests.git
cd skipper-cache-e2e-tests
make verify SKIPPER_CHECKOUT=../skipper-pr-4387

make verify starts or reuses Minikube, the mock origin and the stack; runs the smoke and coalescing checks; and validates supported dashboard queries. It prints a report path and exits non-zero on failure. For outage evidence, run make chaos SKIPPER_CHECKOUT=../skipper-pr-4387 NAME=origin-stale; it includes its own timed load. Requirements: Python 3.9+, Make, Bash, Git, curl, kubectl, Minikube, Docker and Go compatible with Skipper's go.mod. Free ports: 8080, 8081, 6379, 4318, 9091, 9999, 9911 (8089 for endless load). Dynamic URLs: .runtime/urls.txt; stop with make stop.

Validated on #4387 (d767f636): smoke: 6,398 requests, 0 failures; origin-stale: 155 failed revalidations across 77 routes. Smoke metric checks: 42 PASS, 2 fault-only NOT EXERCISED, 0 FAIL.

Focused tests

go -C ../skipper-pr-4384 test -race -count=1 ./filters/cache -run '^TestShardedByteLRUUsage$'
go -C ../skipper-pr-4384 test -race -count=1 ./metrics -run '^TestPrometheusCacheLRUGauges$'

Expected: Both focused tests pass. Smoke shows entries grow and level off as route keys warm (about 990 entries/route); bytes remain far below the 2 GiB default (about 1 MB).

Checklist

Rollback Plan

Revert this PR to restore previous metrics behavior.

References & Additional Context

Base of metrics stack; followed by #4385. Adds skipper_cache_lru_entries (labelled by route) and skipper_cache_lru_capacity_bytes (the configured L1 limit) so L1 fill can be compared with capacity.

E2E Testing Results

The screenshots below come from a 2-minute smoke run (20261026-145513-smoke) against bda674b0, the top of this stack, which includes this PR. They show skipper_cache_lru_entries growing as keys are cached, and skipper_cache_lru_bytes plotted against the constant skipper_cache_lru_capacity_bytes (2 GiB). Full results: larry-dalmeida/skipper-cache-e2e-tests/results

Test Scenarios:

Scenario Run Skipper build Requests Failures Status
Smoke (screenshots below) 20261026-145513-smoke bda674b0 (top of this stack) 6,306 0% ✓ Pass
Smoke 20261025-201019-smoke 8a80d62e + uncommitted changes 6,270 0% ✓ Pass
Origin Stale 20261025-201220-origin-stale 8a80d62e + uncommitted changes 44,288 27% (expected during chaos) ✓ Pass
Skipper Kill 20261025-202222-skipper-kill 8a80d62e + uncommitted changes 38,969 1% (during restart) ✓ Pass

Validation Panels:

  • Cache entries — skipper_cache_lru_entries climbs from 2 to about 860 entries during the 2-minute run as new keys are cached. It is still rising at the end, with no plateau in this run.
    Cache entries

  • Cache bytes vs capacity — skipper_cache_lru_capacity_bytes is a flat line at 2 GiB. skipper_cache_lru_bytes reaches only about 540 KiB, so at this scale it sits on the 0 B axis. L1 stays far below capacity.
    Cache bytes vs capacity

  • Cache hit ratio (context) — overall hit ratio for the run is 74.2%. Context only; this panel does not use a metric added by this PR.
    Cache hit ratio (context)

@larry-dalmeida larry-dalmeida changed the title [cache metrics A] LRU entries & capacity cache metrics: LRU entries & capacity Oct 26, 2026
Add skipper_cache_lru_entries{route} and skipper_cache_lru_capacity_bytes gauges. ShardedByteLRU.Usage returns bytes and entry count together; Bytes delegates to it.

Signed-off-by: Larry D Almeida <hello@larrydalmeida.com>
@larry-dalmeida

Copy link
Copy Markdown
Collaborator Author

Superseded by #4395, stacked above #4394. Changes consolidated with published metric, dashboard and fault-test evidence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant