PHP-FPM is the PHP processing manager: it takes dynamic requests from the web server, distributes them among the workers, and controls the processing life cycle. If all the workers are busy, the new request stays in the queue; if their number increases regardless of RAM, a swap or OOM can destabilize the entire service.
Short answer:PHP-FPM does not speed up code or slow query, but it determines the synchronous execution capacity and how requests are sorted. The correct setup starts with measuring the request time, the actual memory of each worker, synchronous traffic, and the secure edge of the system; not copying the value.pm.max_childrenAnother server.
Where does the WordPress request go?
The web server sends static files directly and delivers the PHP request from FastCGI to the respective pool. The worker bootstraps WordPress, accesses the database and external services, and returns the response. So TTFB can include waiting in the FPM queue, running PHP, database query, and external API. Seeing the TTFB above alone does not specify the location of the problem.
What do you mean, Pool and Worker?
Each pool has a set of PHP settings, sockets, users, and processes. Separating pools can create access and capacity limits, but the total number of workers in all pools must be in the RAM budget. A portraic site can deprive other site workers of resources; a separate pool is only useful when the restrictions and monitoring are also separate.
Process manager modes
| You are. | The general behavior. | Use and Consideration |
|---|---|---|
static | Fixed number of workers | Predictable behavior, more memory reserves. |
dynamic | Increase and decrease in the defined range | Common equilibrium for variable load; idle/start parameters are important |
ondemand | Making a worker when needed. | Less idle memory; spawn costs and burst behavior should be measured |
No single mode is superior to all servers. Traffic pattern, processing start latency, memory, and number of pools determine the decision.
Signs of Worker Deficiency
- Growing request queue at the same time as traffic
- Record the message reaching the children's roof in the log.
- Slowing down dynamic requests while static files are fast
- Temporary recovery after job or burst
- Fully busy workers with CPU still free, especially when waiting for I/O
If the CPU is saturated, MySQL locks or the external API is slow, increasing the worker can increase the number of requests waiting for that bottleneck.
Worker's signs are over the top.
- Decline in available memory and continued use of swap
- OOM event and closure of PHP-FPM or MySQL
- Increase load and context switch without increasing throughput
- Extreme latency when burst or running cron
- PHP competes with database and cache for RAM
To separate the actual memory from the system cache,The WordPress RAM usage guideLook at that.
How do we estimate capacity?
RSS multiple workers in real-world scenarios - public pages without caching, wp-admin, checkout, and heavy job - is not enough. The average worker in import or page builder may have a higher peak. Set the allowable budget for PHP after reserving RAM for the operating system, MySQL, Redis, web server, and spikes.
Divide the PHP budget into the conservative memory of each worker starting at a point, not a final value. Then measure the load test with validity, queue, error rate, p95 latency, swap, and throughput.memory_limitPHP ceiling is every request and is not the worker's constant RSS equivalent.
What are we monitoring?
- Number of active, idle and total processes
- Longest queue and accepted connections
- Get to the children's roof.
- Time of request and slow request
- RSS processing and memory available system
- Restart, unusual exit and OOM
- CPU, I/O and latency of associated services
The status page should be accessible only to the network or endpoint of an authorized administration; its publication on the Internet discloses operational information.
What's Slow Log doing?
FPM can track long requests beyond a specified threshold. This is useful for finding stuck stacks, but logs can reveal the file path and details of the program and generate significant output over multiple loads. Use it with limited, appropriate permission and retention and for detection gaps.
pm.max_requestsWhat for?
Recovering worker after a certain number of requests can limit the effect of library memory growth or extension, but memory leak or faulty code treatment is not. Very low amounts increase spawn and cold state costs; very high amounts may slow processing growth. Compare RSS trends and recycle rates before and after change.
Don't confuse timeout with timeout.
Timeout for browsers, proxies, web servers, FastCGI and PHP each have different layers. Upgrading all timeout does not fix the broken job and takes the worker longer. For long operations such as export or sync, queue/CLI and batch processing are usually more appropriate than interactive request. Before terminating a request, check its effect on the transaction and payment operation.
How does Page Cache change the equation?
In the actual hit cache, PHP-FPM may not be involved at all. This is why the public page benchmark does not show the cache capacity of the wp-admin or checkout. Test the cacheable and dynamic scenarios separately and record the hit rate.
A low-risk runbook
- Record the configuration and rollback path.
- Baseline the actual load, queue, RAM and latency.
- Separate the endpoint or slow job profile.
- Calculate the RAM budget for all services and all pools.
- Just change one parameter in the staging or low risk range.
- Configure the syntax using the same controlled version checking and reload tool.
- After the change, measure throughput, tail latency, error, swap and OOM.
The file path and the reload command depend on the distribution, version, and container; do not run a sample directly from another system.
Common Mistakes
- Multiplied increase.
pm.max_childrenWithout the RAM. - Increased concurrent worker and
memory_limit - Restart a period instead of finding the request
- One knew the process timeout and the query problem.
- The test only cached the page.
- Public status or slow log
- Ignoring CLI and cron workers
When is PHP-FPM not a problem?
If the queue is zero but a full CPU worker is consuming, profile the code.Find the slow query.If DNS or external HTTP is waiting, check the API's timeout and behavior.The WordPress TTFB reduction guideIt's useful.
When do you need special assistance?
If the pool is constantly on the ceiling, swaps with increasing server worker or checkout under timeout load, there is a greater change in production risk.WordPress speed boost serviceIt can analyze queue, slow log, worker memory and bottleneck databases with a fixed workload.
Common Questions
Does the number of workers always make the site faster?
No; after CPU capacity, RAM or dependencies, more worker can increase competition and swap.
Why is the wp-admin slow but the homepage fast?
The homepage is likely to be cached, but it runs PHP management and dynamic queries.
Is PHP-FPM used for Apache?
It can be used; the exact architecture depends on the handler and host configuration.