Puma memory bloat in single-process multi-threaded configurations
20K reputation · 08 May 2020, 22:52 UTC
To minimize infrastructure costs for low-traffic workloads, Ruby on Rails applications often utilize a single-process, multi-threaded Puma configuration. This approach aims to reduce the total RAM footprint by avoiding the overhead of multiple worker processes.
However, there is uncertainty regarding the relationship between thread count and memory bloat when the application relies on memory-intensive gems. While increasing threads can improve concurrency, it may lead to unpredictable memory growth that offsets the savings of a single-process setup.
- What is the impact of increasing thread counts on memory bloat when using memory-heavy dependencies in a single-process Puma environment?
- Is there a documented threshold where adding threads triggers disproportionate RAM consumption compared to adding a worker process?