php-fast-profile
See on GitHubProfiling PHP in production usually means a bad trade. Instrumenting extensions slow the process to a crawl, and existing sampling profilers start dropping samples the moment you push the rate up. pfp was built to remove that trade.
It attaches to a running PHP process and walks the Zend VM call stack by reading the target's memory directly, so the process being measured never pauses. That design is what keeps it accurate at high sample rates where other profilers fall behind.
The result
Measured against phpspy, the other Linux sampling profiler for PHP, on identical workloads over 5 second windows:
| Workload | Rate | pfp | phpspy |
|---|---|---|---|
| framework | 999 Hz | 4996 / 5000 (99.9%) | 2794 / 5000 (56%) |
| wordpress | 999 Hz | 4996 / 5000 (99.9%) | 2766 / 5000 (55%) |
| multi-pid, 4 workers | 999 Hz | 19976 | 0 |
pfp holds 99.9% sample accuracy at 999 Hz where phpspy captures barely half, uses around 30% less memory (3.1 MB against 4.5 MB), and profiles a whole php-fpm fleet at once with 8 to 10 times lower CPU overhead. (phpspy's multi-PID mode hit a discovery race that captured no samples on this run.)
Why it stays cheap
Two syscalls per stack frame, and every function and file name is interned the first time it is seen, so repeated frames cost almost nothing. Output drops straight into a continuous-profiling backend as gzipped pprof with no intermediate collapse step, so a production fleet can be profiled continuously rather than in one-off snapshots.
The offsets are verified across PHP 8.0 through 8.5, on x86_64 and aarch64, in both threaded and non-threaded builds.