Performance monitoring
PHP performance monitoring
PHP handles each request in a fresh worker, so performance depends on worker capacity, OPcache and how long each request waits on the database.
3 min read10 sectionsUpdated
On this page
; www.conf
pm = dynamic
pm.max_children = 20
pm.status_path = /fpm-status
request_slowlog_timeout = 5s
slowlog = /var/log/php-fpm/slow.log| Field | Watch for |
|---|---|
| active processes vs max children | Close to max for minutes: requests queue |
| listen queue | Above zero: requests waiting for a worker |
| max children reached | Increasing: raise max_children if memory allows, or make requests faster |
| slow requests | Entries in the slowlog with stack traces |
Typical PHP bottlenecks
- Too few FPM workers, or too many for the memory available (each worker uses tens of MB).
- N+1 queries in Eloquent or Doctrine; eager-load relations.
- External API calls without timeouts blocking a worker for 30 seconds.
- Sessions in files with locking, serializing concurrent requests from one user.
- Autoloader and config not cached in Laravel (
php artisan config:cache,route:cache).
Tracing
Install the opentelemetry PHP extension and the auto-instrumentation packages, then configure with environment variables, including in the FPM pool. The full setup is in OpenTelemetry for Laravel.
| Signal | Source | Why |
|---|---|---|
| Request latency per route | OpenTelemetry traces | Find the slow endpoints |
| PHP-FPM active processes and listen queue | FPM status page (pm.status_path) | A full pool means 502s and queued requests |
| max_children reached | FPM log and status | The pool is too small or requests are too slow |
| Slow requests | request_slowlog_timeout and slowlog | Stack traces of requests over the limit |
| OPcache hit rate and memory | opcache_get_status() | A full OPcache recompiles scripts on every request |
| Database time per request | Database spans in traces | Most PHP slowness is queries |
; php-fpm pool config: status page and slow log
pm.status_path = /fpm-status
request_slowlog_timeout = 5s
slowlog = /var/log/php-fpm/slow.logInstrumenting PHP
The OpenTelemetry PHP extension with auto-instrumentation covers common frameworks and clients; see OpenTelemetry for Laravel for a step-by-step setup. Watch for N+1 queries in ORMs: one page that runs hundreds of small queries shows up clearly as a long list of database spans in a single trace.
How do I size pm.max_children?
Divide the memory you can give PHP by the average worker memory (check RSS of workers under load), leaving headroom for the OS and other services.
Is JIT worth enabling?
For typical web apps waiting on I/O, gains are small. It can help CPU-heavy code. Measure before enabling in production.
Check it now, free
- Response time checker: Measure TTFB with DNS, connect, TLS and server time.
Related reading
- Python performance monitoring: Monitor Python web apps: request latency per route, worker saturation, the GIL and CPU-bound code, database time, Celery queues and memory.
- Java performance monitoring: Monitor Java and Spring applications: JVM heap and GC, thread pools, JDBC connection pools, request latency from traces.
- Best APM tools: Choose an APM tool in 2026: the criteria that matter, from OpenTelemetry support to pricing models, well-known options compared and how to run a fair trial.
- What is APM (application performance monitoring)?: APM explained: what application performance monitoring measures, how traces and spans work, why p95 beats averages, a worked example and how to start.
- IIS monitoring and IIS logs: Monitor Microsoft IIS: performance counters, request queues, application pool health and recycling, W3C log fields such as time-taken.
- OpenTelemetry for Flask: Instrument a Flask app with OpenTelemetry, in code or with zero code: trace routes, SQLAlchemy and outgoing calls, and export to VitalRix.
Watch your own site and services with VitalRix
Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.