Skip to content

Count requests still setting up in the eviction autoscaler metric - #921

Draft
sduchesneau wants to merge 2 commits into
developfrom
fix/eviction-autoscaler-metric-count
Draft

Count requests still setting up in the eviction autoscaler metric#921
sduchesneau wants to merge 2 commits into
developfrom
fix/eviction-autoscaler-metric-count

Conversation

@sduchesneau

Copy link
Copy Markdown
Contributor

substreams_tier1_effective_active_requests could read below substreams_active_requests, the metric it is meant to replace as the horizontal autoscaler input. It is a max() of the active-request count and the CPU-derived count, so that should not be possible.

The two were counting different sets of requests. substreams_active_requests increments early in blocks(), while a request only enters the evictor's manager map after session acquisition, the deterministic-error check against the cache store and store cloning. Every request still in setup was counted by one and invisible to the other. Teardown has the same shape: the deferred manager.Remove is registered later than the deferred Tier1ActiveRequests.Dec(), so it runs first.

The evictor now takes its active-request count from the same accessor admission uses (getActiveRequestCount), through a CountActiveRequestsWith hook, falling back to the manager map when unset. The manager map is still the source of eviction candidates — a request in setup has no stats to sample and nothing worth cancelling.

Effect: a pod with requests queued in setup no longer looks emptier to the autoscaler than it is, and the eviction metric agrees with the soft and hard admission limits about how many requests exist.

The evictor counted only requests in its manager map, which they enter after
session acquisition and store setup. Admission and substreams_active_requests
count them from arrival, so the autoscaler metric could read below the plain
count it is meant to replace.
@dfuse-bot

Copy link
Copy Markdown

🔍 Vulnerabilities of ghcr.io/streamingfast/substreams:d9efd5b

📦 Image Reference ghcr.io/streamingfast/substreams:d9efd5b
digestsha256:fddab28041530bb68c1f15983e9f63da11538c3f0a71857a1008d67fa2a22b0d
vulnerabilitiescritical: 0 high: 0 medium: 0 low: 0
platformlinux/amd64
size124 MB
packages380
📦 Base Image ubuntu:24.04
also known as
  • c1ca75be10a22ea09ff0b7bbe8b82ee03553a4f9b795030ee2ec921e42418fc8
  • noble
  • noble-20260810
digestsha256:1e0a86e57d247923571b75e0aaf48a1449cf8c543d51fb3e07a4a7d7bfa79316
vulnerabilitiescritical: 0 high: 0 medium: 24 low: 10

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants