Commit 8899422
authored
Run Puma in single mode on Render free tier (#22)
WEB_CONCURRENCY=1 was set with the comment "Single worker to fit
in 512MB", but that's the opposite of what it does: WEB_CONCURRENCY
is the *worker* count Puma forks *in addition to* the master, so
=1 actually means master + 1 worker = 2 Puma processes in cluster
mode.
Adding SOLID_QUEUE_IN_PUMA on top spawns four more subprocesses
(supervisor, dispatcher, worker, scheduler). That's six Ruby
processes in one 512MB container:
master (~150MB) + worker (~150MB) + 4 SQ procs (~80MB each)
≈ 620MB → exceeds 512MB → OOM-loop
Setting WEB_CONCURRENCY=0 drops Puma into single mode (master
serves HTTP directly, no fork). That saves the ~150MB worker
process and brings steady-state RSS under the cap. With only one
Puma process there's no throughput benefit from cluster mode
anyway — the worker is pure overhead.
Hit by:
- raghubetina/aplace running an identical config (Puma cluster +
SOLID_QUEUE_IN_PUMA on Render Starter, also 512MB). The deploy
appeared green but the container OOM-restarted every ~90s,
serving HTTP 502 most of the time. Fixed by the same change.
Any student project on this template that adds memory-hungry
gems (image_processing, ML/embedding clients, etc.) will hit
the same wall — best to fix it in the template before more
forks inherit the bug.1 parent e5532fc commit 8899422
1 file changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
15 | 20 | | |
16 | 21 | | |
17 | 22 | | |
| |||
0 commit comments