From bb0cffe4eb9db478a8503c4d555494155f4774b6 Mon Sep 17 00:00:00 2001 From: Garrett Allen <98648590+Gerrrt@users.noreply.github.com> Date: Sat, 21 Nov 2026 23:04:32 +0000 Subject: [PATCH] chore(sensitive): re-derive memory limits from a month of RSS; Home Assistant to 1536m Peak and median container_memory_rss over 2026-10-22 -> 11-21 (the TSDB's whole retention). Home Assistant peaked at 816 MiB of its 1g and goes to 1536m; every other limit stands, with its numbers recorded beside it. Co-Authored-By: Claude Opus 5.5 --- docs/changelog.md | 10 +++++ .../runbooks/build-the-sensitive-tier-host.md | 4 +- stacks/sensitive/README.md | 7 +++- stacks/sensitive/compose.yaml | 40 ++++++++++--------- 4 files changed, 40 insertions(+), 21 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 56ed0031..ec047d8c 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -19,6 +19,16 @@ docstring gives: it is a record, not a claim about now. ## 2026-11-21 +- **`trinity`'s memory limits re-derived from a month of RSS; Home + Assistant's goes to 1536m.** The stack README asked for it once the host had + run a month. Peak and median `container_memory_rss` over 2026-10-22 to 11-21, + the TSDB's whole retention, against each limit: Home Assistant peaked at 816 + MiB of 1024 (median 536), the only service above two-thirds of its limit, so + it went to 1536m. Immich's server 2046 of 3072, AdGuard 954 of 1536, + Stirling-PDF 868 and Paperless-ngx 692 of 3072 (their load tests' 1454 and + 1716 still set them), Immich's machine learning 708 of 4096, and everything + else under 350 MiB. Those stand. + - **A tripped breaker set off the WAN's receive errors a fourth time, and another of the XB7's ports cleared them.** A breaker tripped and the XB7 lost power; `morpheus` stayed up, since `em0`'s error counter carried on from diff --git a/docs/runbooks/build-the-sensitive-tier-host.md b/docs/runbooks/build-the-sensitive-tier-host.md index af6b39a8..149e4dc0 100644 --- a/docs/runbooks/build-the-sensitive-tier-host.md +++ b/docs/runbooks/build-the-sensitive-tier-host.md @@ -559,8 +559,8 @@ Then the stack README's list, on the host it was written for: - **Home Assistant keeps booting under its hardening.** It is healthy above; the `dhcp` integration's `CAP_NET_RAW` error is the one expected line. - **AdGuard answers the prober and nobody else.** That is §11, step 1. -- **The limits.** Nothing to do today. The README says re-derive after a - month. +- **The limits.** Nothing to do today. After a month, re-derive them from + `container_memory_rss` the way the stack README's 2026-11-21 pass did. The agent, from `prometheus`: diff --git a/stacks/sensitive/README.md b/stacks/sensitive/README.md index 64067a87..0363d491 100644 --- a/stacks/sensitive/README.md +++ b/stacks/sensitive/README.md @@ -368,7 +368,12 @@ time and lives in Caddy's `/data` volume, never on disk here. image-only: a peak of 1716 MiB, no OOM kill, 3.0 cores at the busiest minute and 0.2 s throttled in total, 3 min 54 s for the 50 pages, and Vaultwarden through Caddy never slower than 19 ms meanwhile. Both limits - stand. Re-derive from `container_memory_rss` once `trinity` has run a month. + stood. **Re-derived on 2026-11-21** from `container_memory_rss` over the + TSDB's whole thirty days (2026-10-22 to 11-21), #114's way: Home Assistant + peaked at 816 MiB, 80 % of its 1g, and went to 1536m. Every other service + peaked at or under two-thirds of its limit (Immich's server 2046 of 3072, + AdGuard 954 of 1536, the rest lower), and they stand; `compose.yaml` keeps + the numbers beside each. - **Caddy joins the operator's group.** `gen-certs.sh` writes the leaf's key `0640`, owned by whoever ran it, and root inside a container that has dropped `CAP_DAC_OVERRIDE` is bound by that mode like any other uid — measured: the diff --git a/stacks/sensitive/compose.yaml b/stacks/sensitive/compose.yaml index 9f18a3db..a9498b62 100644 --- a/stacks/sensitive/compose.yaml +++ b/stacks/sensitive/compose.yaml @@ -409,15 +409,16 @@ services: # `mqtt` as well, for the broker (DIFFERENCE 14, ADR-0104). networks: [sensitive, mqtt] init: false - # A ceiling to catch a leak, not a measurement: #114's method — median and - # peak over a fortnight of real use — replaces it once the tier runs. The - # only number there is: 316 MiB RSS at the end of a first boot on the - # pinned image, with default_config loaded and no devices, and 35 - # tasks against the anchor's pids_limit of 512. Python threads count as - # tasks and Home Assistant is thread-heavy — its executor alone may hold - # 64 — so the margin under 512 is stated rather than assumed. - mem_limit: 1g - memswap_limit: 1g + # Was 1g, a ceiling set from 316 MiB RSS at the end of a first boot with + # no devices. #114's method replaced it: over 2026-10-22 -> 11-21, the + # TSDB's whole thirty days, RSS had a median of 536 MiB and a peak of 816, + # 80 % of that 1g. 1536m is 1.9x the peak, the house's devices and their + # integrations included. The first boot also counted 35 tasks against the + # anchor's pids_limit of 512. Python threads count as tasks and Home + # Assistant is thread-heavy — its executor alone may hold 64 — so the + # margin under 512 is stated rather than assumed. + mem_limit: 1536m + memswap_limit: 1536m cap_drop: [ALL] security_opt: - no-new-privileges:true @@ -1040,10 +1041,13 @@ services: # under 8 MiB. The ceilings sit well above those and below anything that # would let one container take the 32 GB host down; they exist to turn a # leak into an OOM kill of one service, which ContainerOomKilled then - # names. Re-derive them the way #114 - # did once trinity has run a fortnight with real uploads and a transcode or - # two — `max_over_time(container_memory_rss{name=~"sensitive-immich.*"}[14d])` - # — and move the number and this paragraph together. + # names. Re-derived the way #114 did, from container_memory_rss over + # 2026-10-22 -> 11-21 (the TSDB's whole thirty days), median / peak MiB: + # server 821 / 2046 (1.5x under 3072m), machine learning 196 / 708 (5.8x), + # Postgres 7 / 344, Valkey 4 / 8. All four stand. The server is at #114's + # 1.5x floor and is not cut; machine learning keeps room for both models + # and a batch at once, which the month did not show; Postgres's RSS leaves + # out its shared buffers, so it says nothing against upstream's floor. immich-server: <<: *service-defaults image: ghcr.io/immich-app/immich-server:v3.4.1@sha256:7c489add298fc2f92cda4c777de6462aa206877e04087b815f62c7664af0b53b @@ -1345,10 +1349,9 @@ services: # the whole install plus room for one document's OCR. Measured on trinity on # 2026-09-28: memory.peak 1716 MiB across five one-page scans and a 50-page # 300 dpi backlog, no oom_kill — 56 % of the limit, kept rather than cut on - # one sample, since a longer or denser scan grows the working set. The - # estate sizes from fourteen days of RSS; re-derive from - # container_memory_rss once trinity has run a month, the way - # stacks/observability did for its seven. + # one sample, since a longer or denser scan grows the working set. Over + # 2026-10-22 -> 11-21 container_memory_rss had a median of 688 MiB and a + # peak of 692: no backlog that month, so the backlog's 1716 still sets it. # # The healthcheck is the image's own (curl against 8000, which ALLOWED_HOSTS # always admits for localhost), written out so check_compose_health.py @@ -1597,7 +1600,8 @@ services: # oom_kill. The heap is capped at 40 % (about 1.2 GiB), down from the 70 % # the entrypoint picks, so the heap, the JVM's off-heap, LibreOffice, # tesseract and a full 1 GiB /tmp all fit under 3072m together. - # Re-derive from container_memory_rss after a month, as for the rest. `cpus: 2` + # Over 2026-10-22 -> 11-21 container_memory_rss had a median of 757 MiB and + # a peak of 868, under the test's 1454, so 3072m stands. `cpus: 2` # is DIFFERENCE 10 again: an OCR here must not take cores Paperless's # ceiling of four is counting on. stirling-pdf: