ERPNextCalc sets gunicorn_workers = (2 * vCPU) + 1 as the baseline ceiling for Frappe v15 web nodes serving concurrent Desk, REST API, and POS requests.
In our audit of Python 3.11 + Werkzeug deployments, enabling --preload shares read-only Frappe and ERPNext bytecode pages across forked workers, holding per-worker RSS near 260 MB instead of 420 MB on 16 GB servers.
Over-allocating Gunicorn workers beyond 2x physical cores forces the Linux CFS scheduler to thrash CPU caches during Python GIL-bound Jinja rendering and JSON serialization. On a dedicated 8 vCPU node, 17 workers saturate I/O wait windows without starving MariaDB.
We recommend keeping Gunicorn worker counts tied strictly to physical or dedicated VDS vCPUs while offloading PDF generation and bulk ledger submits to Redis RQ workers.
ERPNextCalc Memory Ceiling & Timeout Guardrails
Each Gunicorn process reserves 260 MB of active heap when ERPNext, HRMS, and India/EU compliance apps are installed. Seventeen workers therefore consume roughly 4,420 MB (27% of a 16 GB RAM server), leaving ample headroom for InnoDB.
We advise setting --timeout 120 for standard accounting benches and raising it to 300 seconds only when custom Print Formats compile large WeasyPrint invoices synchronously.
ERPNextCalc Gunicorn Supervisor Unit (8 vCPU / 16 GB)
Applying the ERPNextCalc Gunicorn sizing formula prevents web workers from starving MariaDB buffer memory during peak invoicing hours.
Review the live Gunicorn parameter ribbon on ERPNextCalc to generate a matching common_site_config.json and Supervisor unit for your exact vCPU budget.
ERPNextCalc FAQ: Does --max-requests prevent Gunicorn memory leaks in Frappe v15?
Yes. Rotating each Gunicorn worker after 2,500 requests with a 250-request jitter recycles fragmented Python allocations before RSS swells past 350 MB.
ERPNextCalc FAQ: Should I switch Frappe Gunicorn to gevent async workers?
No. Standard synchronous sync workers remain the safest default for Frappe v15 because PyMySQL and synchronous doc-event hooks do not patch cleanly under gevent.