Repository navigation
perf: cap the bot's memory use - #73
Merged
Merged
Conversation
Use a fixed 256 MB heap with the serial GC that returns free memory to the system, limit metaspace, code cache and thread stacks, exit on OutOfMemoryError so the container restarts, and shrink the Hikari pool to 4 connections.
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.
The bot container uses about 544 MB of its 1 GiB limit on a server that is short on RAM.
MaxRAMPercentage=75lets the heap grow to 768 MB and the default GC rarely gives memory back.JAVA_TOOL_OPTIONS: fixed 256 MB heap with the serial GC,MinHeapFreeRatio=10/MaxHeapFreeRatio=30so free heap is returned to the system, metaspace capped at 192 MB, code cache at 64 MB, 512 KB thread stacks, andExitOnOutOfMemoryErrorsorestart: alwaysrestarts a bot that runs out of heap.Expected footprint is around 300–350 MB; not measured yet. If the heap turns out too small (container restarts), raise
-Xmxto 320m.