From 4f6525fceb02407e8989c1c6d4bd29eab40c9dd5 Mon Sep 17 00:00:00 2001 From: Chris Alfano Date: Sun, 28 Jun 2026 17:08:45 -0400 Subject: [PATCH] chore(deploy): lower memory limits after gitsheets 1.4.1 heap fix gitsheets 1.4.1 (smol-toml parser, #132) cut the boot footprint dramatically. Measured against the full `published` import: heap >500 MB -> ~123 MB RSS ~806 MB (incident) -> ~321 MB Resize from the leak-era ceilings to the real working set, with margin: NODE_OPTIONS --max-old-space-size 2048 -> 512 (~4x boot heap) requests.memory 1Gi -> 512Mi (> ~321Mi steady RSS) limits.memory 2.5Gi -> 1Gi (~3x steady RSS) Hands the ~3.9Gi nodes ~1.5Gi back vs the old 2.5Gi limit, removing the node-starvation risk that drove the earlier NodeNotReady. Co-Authored-By: Claude Opus 4.8 (1M context) --- deploy/kustomize/base/configmap.yaml | 20 +++++++++----------- deploy/kustomize/base/deployment.yaml | 20 +++++++++++--------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/deploy/kustomize/base/configmap.yaml b/deploy/kustomize/base/configmap.yaml index 925de97..aafce58 100644 --- a/deploy/kustomize/base/configmap.yaml +++ b/deploy/kustomize/base/configmap.yaml @@ -19,18 +19,16 @@ data: NODE_ENV: "production" # Bump Node's old-space heap ceiling above the default (~400Mi on Linux # containers) so the in-memory record set + secondary indices + FTS fit. - # Keep ~25% headroom below the container's memory limit for ephemeral - # work (request handling, gitsheets tree mutations, etc.). # - # 2048 (was 1536): a fresh boot rebuilding in-memory state from the full - # `published` import (~31.8k people + ~10.4k tag-assignments + secondary - # indices) OOM'd at the 1536 ceiling. The native FTS5 store is off-heap; - # the V8 heap holds the record maps + indices. 2048 boots cleanly and runs - # stable; it is deliberately kept modest because these nodes are only - # ~3.9Gi — an earlier 3072/3.5Gi trial let the pod grow until it starved - # the node's kubelet (NodeNotReady). See the memory-optimization issue for - # the (suspiciously large ~60x) on-disk-to-heap expansion worth reducing. - NODE_OPTIONS: "--max-old-space-size=2048" + # 512 (was 2048): gitsheets 1.4.1 switched the TOML parser to smol-toml, + # fixing the #132 heap blowup at its root (@iarna's parser pinned ~12x each + # record's source in V8 sliced/cons-strings). A full boot from the + # `published` import now measures ~123Mi heap / ~321Mi RSS (FTS5 is off-heap + # and tiny, ~40Mi). 512 is ~4x the measured boot heap — ample for request + # handling + gitsheets tree mutations — while leaving the node (~3.9Gi) most + # of its memory back. The earlier 2048/2.5Gi was sized for the leak, not the + # real working set. + NODE_OPTIONS: "--max-old-space-size=512" PORT: "3001" STORAGE_BACKEND: "filesystem" # The runtime-served branch. `published` is the long-term sandbox + prod diff --git a/deploy/kustomize/base/deployment.yaml b/deploy/kustomize/base/deployment.yaml index bddf30b..7bd881f 100644 --- a/deploy/kustomize/base/deployment.yaml +++ b/deploy/kustomize/base/deployment.yaml @@ -64,19 +64,21 @@ spec: resources: requests: cpu: 100m - memory: 1Gi + # ~321Mi measured steady-state RSS (full `published` import + + # indices + FTS) with gitsheets 1.4.1; request sits above that. + memory: 512Mi limits: cpu: 1000m # Holds the full public dataset + secondary indices + FTS in # memory (~31.8k people, 268 projects, 10.4k tag-assignments, …). - # 2.5Gi (was 2Gi): a cold boot rebuilding state from the full - # `published` import exceeded the prior 1536Mi heap; raised to - # NODE_OPTIONS=--max-old-space-size=2048 (see configmap.yaml), - # with the container limit just above that for the off-heap FTS5 - # store + ephemeral request work. Kept at 2.5Gi (not higher) so - # a single pod can't starve a node — these nodes are only ~3.9Gi - # and a 3.5Gi trial drove one NodeNotReady. ~1.4Gi node headroom. - memory: 2560Mi + # 1Gi (was 2.5Gi): gitsheets 1.4.1's smol-toml parser fixed the + # #132 heap blowup — a full boot now measures ~123Mi heap / + # ~321Mi RSS (vs >500Mi heap before). With the heap ceiling at + # NODE_OPTIONS=--max-old-space-size=512 (see configmap.yaml), 1Gi + # gives ~3x the steady RSS for heap-ceiling growth + off-heap FTS5 + # + ephemeral request work, and hands the ~3.9Gi node ~1.5Gi back + # vs the old 2.5Gi limit. + memory: 1Gi securityContext: runAsNonRoot: true runAsUser: 1000