Additional worker processes can increase concurrent capacity, but each process consumes memory and may create its own database pool or load a large application model.
IN THIS ARTICLE
Information to have ready
Measure the application’s memory use after startup and during representative requests. Confirm the hosting account memory, CPU and process limits.
01 Choose FastAPI workers within a memory budget
Start with a small supported worker configuration and a repeatable workload. Keep development reload disabled in production.
Measure response latency, CPU saturation, memory peaks and dependency connections. Identify whether slow requests wait on external I/O or consume significant CPU.
Increase workers gradually only when the resource budget and bottleneck justify it. Account for per-process caches, startup objects and connection pools.
Set graceful shutdown and restart behavior through the approved supervisor. Check that deployment briefly running old and new processes together still fits available memory.
Retest after a material code, dependency or traffic change rather than keeping a copied worker formula indefinitely.
02 Example: allow memory for overlapping release workers
Assume an application has a 2,048 MiB budget and reserves 512 MiB for other required processes and operating headroom. Measured peak use is 384 MiB per worker.
Three application workers: 3 x 384 MiB = 1,152 MiB
With reserved capacity: 1,152 + 512 = 1,664 MiB
Three old plus three new workers: 6 x 384 = 2,304 MiB
The example fits in steady state but exceeds the total budget during a full overlapping replacement, even before the reserve is counted. Change the deployment overlap, process count or capacity plan based on a measured test. These are illustrative numbers, not a Nabtech plan limit or a universal worker recommendation.
Also recalculate database pools and startup-loaded objects. Verify tail latency and failure rates under the intended workload before accepting a worker-count change.
Confirm the expected result
Verify the expected load completes without out-of-memory restarts, growing queues or database connection exhaustion. Compare tail latency as well as average response time.
Troubleshoot unexpected results
If more workers make the service less stable, return to the last working configuration and inspect the resource that became constrained. A process killed by the system may not produce a normal Python exception.
A common question
Does an async application need no worker planning?
Async I/O can improve waiting behavior, but CPU work, blocking dependencies and memory limits still matter. Measure the real workload and use the supported deployment model.