Cost Models & Sizing
Sizing DocuSeal Ruby/Puma Workers & libvips PDF Raster Memory
Map monthly envelope concurrency to exact WEB_CONCURRENCY, RAILS_MAX_THREADS, and container memory limits between 750 MB and 3.8 GB.
750 MB Idle Floor -> 2.1 GB Native PDF -> 3.8 GB LibreOffice Peak
How Puma Process Forking & Thread Pools Consume RAM
Each forked Ruby Puma worker (WEB_CONCURRENCY) holds its own copy-on-write heap (~320–480 MB RSS under active request load). Pairing 2 workers with RAILS_MAX_THREADS=8 serves up to ~7,500 monthly envelopes cleanly on an 8 GB KVM 2 host.
libvips Thumbnailing vs LibreOffice Headless Bursts
Native PDF uploads rasterize page previews through libvips in low-overhead streaming buffers. Converting DOCX or XLSX files triggers headless LibreOffice subprocesses that spike memory by 900–1,400 MB, warranting KVM 4 (16 GB RAM) for busy templates.
36-Month Cost & Capacity Breakdown
| Workload Tier | WEB_CONCURRENCY / Threads | Observed Peak RSS | Target Host |
|---|---|---|---|
| 100–1,000 env/mo (Native PDF) | 1 worker / 5 threads | 750 MB | KVM 2 (8 GB) |
| 1,000–7,500 env/mo (Native PDF) | 2 workers / 8 threads | 1.4 – 2.1 GB | KVM 2 (8 GB) |
| 7,500–25,000 env/mo + DOCX | 4 workers / 8-10 threads | 2.6 – 3.8 GB | KVM 4 (16 GB) |