feat(perf): swap 4G->8G via second swapfile, applied live [#755]
Applied on my.knownelement.com 2026-09-03 (founder-approved): /apps.swap2 4G, fstab-persisted, no restarts. Verification + closure note: https://projects.knownelement.com/issues/755#note-13
This commit is contained in:
@@ -45,3 +45,4 @@ SSH `root@my.knownelement.com` — routed through the KNEL/PFVCluster
|
|||||||
2026-09-02 (`~/.creds/cloudron.env`, refs only in this repo) — prefer the
|
2026-09-02 (`~/.creds/cloudron.env`, refs only in this repo) — prefer the
|
||||||
API over SSH for reads/limits; base image rebuilds (#710) still need SSH.
|
API over SSH for reads/limits; base image rebuilds (#710) still need SSH.
|
||||||
- **Inotify headroom APPLIED 2026-09-03** (#755, founder-approved): `fs.inotify.max_user_instances` 128→1024 + `max_user_watches` →1048576 in the same sysctl file, after containerd/dockerd died of inotify exhaustion (full fleet resync 09:13–09:51). Runtime-applied, no daemon restarts; error stream dry from 10:08. OOM fail set complete: thefnf/grafana/projects bumped (1G/1G/1.5G), zero OOMs post-recovery.
|
- **Inotify headroom APPLIED 2026-09-03** (#755, founder-approved): `fs.inotify.max_user_instances` 128→1024 + `max_user_watches` →1048576 in the same sysctl file, after containerd/dockerd died of inotify exhaustion (full fleet resync 09:13–09:51). Runtime-applied, no daemon restarts; error stream dry from 10:08. OOM fail set complete: thefnf/grafana/projects bumped (1G/1G/1.5G), zero OOMs post-recovery.
|
||||||
|
- **Swap 4G→8G APPLIED 2026-09-03** (#755, founder-approved): second swapfile `/apps.swap2` (4G, fstab-persisted, same-priority family) alongside the original `/apps.swap` — no swapoff, no restart, live `free -h` shows 8.0Gi. Idempotent applier: `perf/swap/grow-swap2.sh`. Headroom for the Monday app push.
|
||||||
|
|||||||
Executable
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# grow-swap2.sh — add a second 4G swapfile on the Cloudron host [#755]
|
||||||
|
# Founder-approved 2026-09-03. Second-file approach: no swapoff, no restart,
|
||||||
|
# zero risk to the running fleet. Idempotent — safe to re-run.
|
||||||
|
#
|
||||||
|
# Applied live on my.knownelement.com 2026-09-03 (result: /apps.swap +
|
||||||
|
# /apps.swap2 = 8G total, fstab persisted). Re-runnable on any host that
|
||||||
|
# needs the same headroom; set NEW/SIZE_MB to taste.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
NEW=/apps.swap2
|
||||||
|
SIZE_MB=4096
|
||||||
|
|
||||||
|
if swapon --show=NAME --noheadings | grep -qx "$NEW"; then
|
||||||
|
echo "$NEW already active"
|
||||||
|
else
|
||||||
|
if [ -e "$NEW" ]; then
|
||||||
|
echo "ERROR: $NEW exists but is not active — inspect manually" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fallocate -l "${SIZE_MB}M" "$NEW" 2>/dev/null \
|
||||||
|
|| dd if=/dev/zero of="$NEW" bs=1M count="$SIZE_MB" status=none
|
||||||
|
chmod 600 "$NEW"
|
||||||
|
mkswap "$NEW"
|
||||||
|
swapon "$NEW"
|
||||||
|
echo "activated $NEW"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -q "^$NEW " /etc/fstab; then
|
||||||
|
echo "fstab entry already present"
|
||||||
|
else
|
||||||
|
printf '%s none swap sw 0 0\n' "$NEW" >> /etc/fstab
|
||||||
|
echo "fstab entry added"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "--- swapon ---"
|
||||||
|
swapon --show
|
||||||
|
echo "--- free ---"
|
||||||
|
free -h
|
||||||
Reference in New Issue
Block a user