Set default --max-requests for API workers to prevent unbounded RSS growth#7529
Open
Set default --max-requests for API workers to prevent unbounded RSS growth#7529
Conversation
…rowth API workers currently run with max_requests=0 (unlimited lifetime), which means glibc heap fragmentation accumulates indefinitely and RSS grows without bound (~1 kB/request from normal Django ORM alloc/dealloc churn). Set max_requests=10000 and max_requests_jitter=500 as defaults for PulpApiWorker. Workers are gracefully recycled after ~10000 requests, resetting fragmented heap memory. The jitter prevents all workers from restarting simultaneously. The defaults only apply when max_requests has not been explicitly configured (via CLI, config file, or GUNICORN_CMD_ARGS), so existing deployments that set their own values are unaffected. closes pulp#7482 Assisted-by: Claude (Anthropic) Made-with: Cursor
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.
Summary
max_requests=10000andmax_requests_jitter=500as defaults for API workersmax_requestshas not been explicitly configured (via CLI, config file, orGUNICORN_CMD_ARGS)Context
Follow-up from the discussion in #7481 where @ggainey and @dralley agreed that setting sensible
--max-requestsdefaults is the right approach. See #7482 for the full profiling data showing ~1 kB/request RSS growth from glibc heap fragmentation under normal Django ORM workload.Implementation note
The defaults are set in
PulpcoreApiApplication.load_app_specific_config()rather than as click option defaults to preserve the config precedence chain: if a user has already configuredmax_requestsvia a config file,GUNICORN_CMD_ARGS, or CLI flag, their value is respected and not overridden.Test plan
--max-requests 0on CLI disables recyclingGUNICORN_CMD_ARGS="--max-requests 5000"overrides the default📜 Checklist
See: Pull Request Walkthrough
Made with Cursor