feat: automatically set GOMEMLIMIT#6809
Merged
mholt merged 4 commits intocaddyserver:masterfrom Jan 27, 2025
Merged
Conversation
mholt
requested changes
Jan 26, 2025
Member
mholt
left a comment
There was a problem hiding this comment.
Thanks Kevin! Do you think we could add a comment to this code (and maybe it could be shared with the gomaxprocs code above it) since I don't think it's obvious why it's useful? Then we will merge!
Collaborator
Author
|
@mholt, done. I also added logs for GOMAXPROCS to improve the overall experience. Commands now start with something like this: |
mohammed90
pushed a commit
to cedricziel/caddy
that referenced
this pull request
Aug 29, 2025
* feat: automatically set GOMEMLIMIT * add system support * comments * add logs
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.
Setting the Go runtime memory limit can improve significantly the performance of Caddy (and FrankenPHP and Mercure, according to our tests), especially on low-resources machines and containers.
This patch uses github.com/KimMachineGun/automemlimit to automatically find a good limit using the currently configured groups. This is especially useful when setting limits to containers using Docker, Kubernetes, LXC, and the like.
This PR is similar to #6047, which does the same things go the max number of processors.
Thanks to @flovntp for the idea and for finding this library!