Conversation
…ontent Remove --max-requests from pulp-api. The previous value of 20 caused workers to recycle after every 20 requests, creating hidden counter resets in Prometheus histogram metrics that made SLI ratios exceed 1. Memory analysis over 24h shows no leak (825-1004 MiB against 5120 MiB limit, no upward drift). Raise pulp-content --max-requests from 20 to 10000 (jitter 500) as a memory safety net while making counter resets negligible for metrics. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts Gunicorn worker recycling behavior to eliminate frequent worker restarts in pulp-api and significantly reduce them in pulp-content, improving Prometheus histogram metric stability and SLI correctness. Sequence diagram for API write request and stable histogram metricssequenceDiagram
actor User
participant Ingress
participant PulpAPI_Pod
participant GunicornWorker
participant OTel_Collector
participant Prometheus
User->>Ingress: HTTP API write request
Ingress->>PulpAPI_Pod: Forward request
PulpAPI_Pod->>GunicornWorker: Dispatch via pulpcore-api
GunicornWorker-->>User: Response
GunicornWorker->>OTel_Collector: Emit APIWriteRequestLatency metrics
OTel_Collector->>Prometheus: Export histogram time series
loop Many_requests_without_worker_recycle
User->>Ingress: Subsequent write request
Ingress->>PulpAPI_Pod: Forward request
PulpAPI_Pod->>GunicornWorker: Reuse same long-lived worker
GunicornWorker-->>User: Response
GunicornWorker->>OTel_Collector: Increment histogram counters
OTel_Collector->>Prometheus: Send monotonically increasing counters
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Gunicorn
--max-requests=20causes workers to recycle after every 20 requests. With only 1 worker per pod, this creates frequent counter resets in Prometheus histogram metrics. When the post-reset counter value coincidentally equals the pre-reset value (common with small counters in the 0–20 range), Prometheus cannot detect the reset — producing SLI ratios > 1 for theAPIWriteRequestLatencySLO.This is the root cause behind the histogram invariant violations. The OTel pipeline fix in #1127 (removing
groupbyattrsworker aggregation) reduced the problem but couldn't eliminate it because the counter values are too small for reliable reset detection.Fix
--max-requestsand--max-requests-jitterentirely. Memory analysis over 24h shows no leak — usage oscillates 825–1004 MiB against a 5120 MiB limit (4x headroom) with no upward drift.--max-requestsfrom 20 to 10000 (jitter 500) as a memory safety net. Counter values will reach ~10000 before reset, making coincidental value matches statistically negligible.Test plan
APIWriteRequestLatencySLI stays ≤ 1🤖 Generated with Claude Code
Summary by Sourcery
Adjust Gunicorn worker recycling settings for pulp-api and pulp-content to improve metric stability and operational behavior.
Build: