Container & RAM Tuning
Capping Dify Next.js Web SSR Heap With NODE_OPTIONS
Prevent Node.js V8 heap expansion inside dify-web from creeping past 1.2 GB on long-running Studio editing sessions.
320-580 MB Steady · --max-old-space-size=768 · Zero Creep
V8 Default Heap Behavior in Containers
Without --max-old-space-size, Node.js inspects host memory rather than tighter container targets and delays garbage collection until heap exceeds 1.5 GB. On 8 GB VPS nodes, capping web heap forces timely GC sweeps around 380-512 MB.
Zero Impact on Studio Responsiveness
Dify Studio workflow canvas rendering happens client-side in the user browser; the web container only handles initial Next.js SSR and static bundle delivery.
Measured Thresholds & Container Limits
| VPS Tier | NODE_OPTIONS Heap Cap | Docker Memory Limit |
|---|---|---|
| 8 GB KVM 2 | --max-old-space-size=512 | 640M |
| 16 GB KVM 4 | --max-old-space-size=768 | 896M |
| 32 GB KVM 8 | --max-old-space-size=1024 | 1,280M |