Skip to content

coord/cluster: per-op PUT/GET latency histogram (v0.12 phase 2) - #3

Merged
incognick merged 1 commit into
mainfrom
v0.12-latency-measurement
Jun 29, 2026
Merged

coord/cluster: per-op PUT/GET latency histogram (v0.12 phase 2)#3
incognick merged 1 commit into
mainfrom
v0.12-latency-measurement

Conversation

@incognick

Copy link
Copy Markdown
Contributor

v0.12 adaptive load shedding — Phase 2 of 5 (ADR-0039 part 1), on top of Phase 1's metrics.Histogram.

The coordinator now times each object PUT and GET from admission to completion through the seam clock, and reports the service time to internal/cluster via a new ObserveLatency hook on coord.Config. The cluster wires it to a new hamster_s3_request_duration_seconds{method} histogram (DefaultLatencyBuckets).

Design:

  • Decoupled, matching the existing streaming load gauges — the coordinator never imports internal/metrics; the cluster supplies the callback.
  • Success-only: a refused/failed op isn't a service-time sample (this is the baseline the limiter's minRTT/curRTT will build on).
  • One sample per client GET: timing wraps a public GetEntry boundary over an untimed getEntry worker, so a multipart read (which recurses per covering part) is counted once, not per part. Verified GetEntry has no other internal callers.
  • The method label (PUT/GET) matches the existing hamster_s3_requests_total{method,code} counter for clean dashboard correlation.

Tests (deterministic, sim-driven): TestLatencyObservedThroughSeamClock (observed seconds == simulated elapsed to the nanosecond, correct label, real histogram snapshot matches) and TestLatencyNotObservedOnError (a failed GET records nothing). task check/build/test + -race + e2e green.

The coordinator times each object PUT and GET from admission to completion
through the seam clock and reports the service time via a new ObserveLatency
hook on coord.Config — success terminals only, since a refused or failed op is
not a service-time sample. internal/cluster wires the hook to a new
hamster_s3_request_duration_seconds{method} histogram (DefaultLatencyBuckets),
the same coord->cluster decoupling the streaming load gauges use: the
coordinator never imports internal/metrics. The GET timing wraps a public
GetEntry boundary over an untimed getEntry worker, so a multipart read is one
sample per client GET, not one per covering part.

ADR-0039 part 1 — the measurement foundation for the minRTT/curRTT gradient and
the limiter. Deterministic and simulator-driven: advancing the sim clock by a
known amount across an op yields exactly that observed duration.

Signed-off-by: Nicholas Phillips <nsphilli@gmail.com>
@incognick
incognick enabled auto-merge June 29, 2026 02:25
@incognick
incognick added this pull request to the merge queue Jun 29, 2026
Merged via the queue into main with commit 0170253 Jun 29, 2026
7 checks passed
@incognick
incognick deleted the v0.12-latency-measurement branch June 29, 2026 02:34
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.

1 participant