
First time using Solid Queue, Rails 8 defaults on a 512 MB Render box were running 7 processes
I usually run Sidekiq on a separate instance, but for a small Rails 8 API I tried Solid Queue for the first time, with the default setup running inside Puma.
On Render's 1 CPU with 512 MB it kept getting OOM-restarted. It looked like a leak, but the container was actually running 7 processes, each holding its own copy of the app.
Eventually found 2 things were multiplying them:
- Render sets
WEB_CONCURRENCY=1, which puts Puma in cluster mode: a master plus a worker, two copies of the app for no gain on a single core. - With
SOLID_QUEUE_IN_PUMA, Solid Queue's supervisor forks separate processes for its dispatcher, worker and scheduler. "In Puma" still means more processes.
Switching Puma to single mode and Solid Queue to async mode (threads instead of forks) took it from 7 processes to 2.
I added a record of the fix here https://englog.dev/u/ndbaba1/cutting-rails-prod-memory-by-killing-hidden-fork
but curious how others run Solid Queue on small instances, async mode in the web process, or a separate worker service from the start?