diff --git a/scripts/detect-memory-litespeed.sh b/scripts/detect-memory-litespeed.sh index f59d5b8..f75274a 100644 --- a/scripts/detect-memory-litespeed.sh +++ b/scripts/detect-memory-litespeed.sh @@ -49,14 +49,22 @@ fi ## ---- LSAPI children (analogous to PHP_FPM_MAX_CHILDREN) ---- ## Per the 2026-06-02 cac-litespeed memory-sizing finding (vantagehealth ## OOM-spawn loop at 512 MB cap): each lsphp worker carries ~115 MB -## shmem-rss which is RSS-accounted per worker (vs cac-fpm's COW-shared -## fork model). Real-world worker budget ≈ 115 MB shmem + ~50-100 MB anon -## that scales with workload. 115 MB is the safe per-worker estimate for -## the divisor; floor at 2, cap at 50. +## shmem-rss + ~25 MB anon + ~10 MB file ≈ 130-150 MB real cgroup cost +## per worker on heavy WP workloads. shmem is RSS-accounted per worker +## (vs cac-fpm's COW-shared fork model) so the cost is real per cgroup, +## not just per process. ## -## Sub-512 MB containers are unsafe for dynamic WP on OLS per the memory -## note — the floor of 2 workers still applies but it'll be cap-marginal. -LSPHP_WORKER_ESTIMATE_MB=${LSPHP_WORKER_ESTIMATE_MB:-115} +## 115 (the previous default) was set from idle-state measurements and +## ran brain-jar.com into 142 OOM-kills at 1 GiB on 2026-06-02 night — +## the formula computed CHILDREN=8, which left zero headroom once Divi +## page renders started growing worker anon. Bumped to 130 to track the +## active per-worker cost; gives slightly fewer workers but real headroom. +## +## Sub-512 MB containers remain unsafe for dynamic WP on OLS — the floor +## of 2 workers still applies but it'll be cap-marginal. Per-site override +## via FPM_MAX_CHILDREN env var (panel edit-site UI) overrides this for +## sites where the default isn't right for their workload. +LSPHP_WORKER_ESTIMATE_MB=${LSPHP_WORKER_ESTIMATE_MB:-130} calc_lsapi_children=$((AVAILABLE_MB / LSPHP_WORKER_ESTIMATE_MB)) if [ "$calc_lsapi_children" -lt 2 ]; then