PHP and MySQL
How to size PHP-FPM workers
Estimate how many PHP-FPM requests can run together from measured memory, CPU and response time instead of copying pm.max_children values.
By AppLaunch Editorial · Reviewed 2026-08-25
Direct answer
Worker capacity is limited by both memory and processor time. Divide the memory available to PHP by the memory used by one of the larger busy workers, then run a realistic traffic test. Too many active workers create a queue and can make every request slower even when they fit in RAM.
What this means in plain English
PHP-FPM keeps worker processes ready to answer web requests. More workers can handle more requests at once, but each uses memory and active workers also compete for CPU time. Too many can make the whole server slower or run it out of memory.
Measure worker memory during real endpoints, reserve room for MySQL and the operating system, then load-test. Watch the request queue as well as CPU and memory. A queue may mean too few workers, but it can also mean slow code or database work.
How many PHP requests can run safely?
| Memory ceiling | Available PHP RAM ÷ memory used by a larger busy worker |
|---|---|
| Processor reality | How many requests the processor can complete together |
| Queue signal | Waiting requests and response time during peak traffic |
A simple example
Workers reach about 120 MB during busy requests and 2 GB is safely available to PHP. Setting 30 workers could need 3.6 GB and is unsafe. The team starts below the memory ceiling, then improves a slow query before adding concurrency.
What to do, step by step
1. Measure worker memory across several types of request.
Start here before buying anything or changing several settings at once. It gives you a clear starting point based on memory ceiling: available php ram ÷ memory used by a larger busy worker. Write the result down so you can compare it later.
2. Reserve RAM for the database, cache and operating system.
Use the same files, versions and settings that the real project will use. A quick test with an empty or different setup can look successful while completely missing the problem you are trying to solve.
3. Set max_children below the safe memory ceiling.
Try the busiest realistic situation, not the easiest one. Include the people, data, traffic or background work you genuinely expect, then watch for slowdowns and errors rather than relying on a single headline number.
4. Test busy traffic and watch the queue, processor and response time together.
Finish by checking the result against queue signal: waiting requests and response time during peak traffic. Keep the old setting or release available until you know the change works and can be reversed safely.
One more useful tip
Idle workers often use less memory than busy ones. Size from a busy representative period, not from a quiet process list.
Common mistakes and how to avoid them
Sizing from idle workers.
This gives a misleading or unsafe result because it leaves out memory ceiling. A better approach is to measure worker memory across several types of request, then check the result before making the change permanent.
Using every byte of RAM.
This gives a misleading or unsafe result because it leaves out processor reality. A better approach is to reserve ram for the database, cache and operating system, then check the result before making the change permanent.
Increasing workers to hide slow database calls.
This gives a misleading or unsafe result because it leaves out queue signal. A better approach is to set max_children below the safe memory ceiling, then check the result before making the change permanent.
Words explained
- PHP
- The programming language that runs the server-side part of many websites and applications.
- PHP-FPM
- A common service that keeps PHP workers ready to handle web requests.
- worker
- A running process that handles one job or request at a time. More workers allow more work at once but also use more memory.
Quick checklist
- Measure worker memory across several types of request.
- Reserve RAM for the database, cache and operating system.
- Set max_children below the safe memory ceiling.
- Test busy traffic and watch the queue, processor and response time together.
Common questions
What is the simple answer?
Worker capacity is limited by both memory and processor time. Divide the memory available to PHP by the memory used by one of the larger busy workers, then run a realistic traffic test. Too many active workers create a queue and can make every request slower even when they fit in RAM.
What should I check first?
Start with memory ceiling: available php ram ÷ memory used by a larger busy worker. That is usually more useful than choosing from a marketing label or copying somebody else’s setting.
How can I make the change safely?
Measure worker memory across several types of request. Then change one thing at a time, keep a backup or old version, and use the same real-world test after each change.
What is the easiest mistake to avoid?
Sizing from idle workers. Avoiding that one mistake makes the rest of the comparison much more trustworthy.