Skip to content

perf: cap the bot's memory use - #73

Merged
SuprexDE merged 1 commit into
mainfrom
perf/memory
Oct 8, 2026
Merged

SuprexDE merged 1 commit into
mainfrom
perf/memory

Conversation

@SuprexDE

@SuprexDE SuprexDE commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

The bot container uses about 544 MB of its 1 GiB limit on a server that is short on RAM. MaxRAMPercentage=75 lets 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=30 so free heap is returned to the system, metaspace capped at 192 MB, code cache at 64 MB, 512 KB thread stacks, and ExitOnOutOfMemoryError so restart: always restarts a bot that runs out of heap.
  • Hikari pool limited to 4 connections (1 idle) instead of 10.

Expected footprint is around 300–350 MB; not measured yet. If the heap turns out too small (container restarts), raise -Xmx to 320m.

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.
@SuprexDE
SuprexDE merged commit 77d9b02 into main Oct 8, 2026
1 check passed
@SuprexDE
SuprexDE deleted the perf/memory branch October 8, 2026 15:27
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