Repository navigation
Commit 46a2f50
committed
Fixed heap not being released after load on Node 24+
ref https://issues.chromium.org/issues/570738027
ref nodejs/node#66564
V8 13+ (Node 24 and 26) only takes the memory reducer's normal
low-allocation path when the young, old and embedder (cppgc) allocation
rates are all low, and it treats a sampled cppgc throughput of exactly zero
as high allocation. Ghost's workload leaves that throughput at zero, so after
a burst of traffic the reducer waits for its 100s watchdog instead of
releasing heap within seconds as it does on Node 22. While full GCs keep
resetting the watchdog, it may not run at all.
vm.Script is cppgc-backed in Node 24+, so allocating one at boot and every
30s keeps the sampled throughput non-zero and restores the normal path. On
one Ghost(Pro) performance benchmark run, Node 24 settled at 205MB RSS 60s
after load with this in place, versus 519MB without it and 202MB on Node 22,
with no load CPU or latency regression observed. Forced idle GCs (188-270ms
pauses on the same benchmark) and --memory-saver-mode (60-75% more CPU under
load) were rejected as alternatives.
The keepalive only runs on V8 13+, so Node 22 is unaffected, stops with the
server's cleanup tasks, and should be removed once the V8 fix lands in our
supported Node versions.1 parent 82d2b08 commit 46a2f50
2 files changed
Lines changed: 34 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
677 | 677 | | |
678 | 678 | | |
679 | 679 | | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
680 | 684 | | |
681 | 685 | | |
682 | 686 | | |
| |||
714 | 718 | | |
715 | 719 | | |
716 | 720 | | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
717 | 725 | | |
718 | 726 | | |
719 | 727 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
0 commit comments