Load Testing

Benchmarking and Load Testing a PHP Application

ApacheBench (ab, in apache2-utils) is everywhere; wrk 40,414 (github.com/wg/wrk (https://github.com/wg/wrk 40,414 ), sudo apt install wrk) is multi-threaded and reports latency percentiles; h2load 5,056 (in nghttp2-client) speaks HTTP/2 (MPMs and Workers). Warm the server with one discarded run, then measure:

Output of 248
$ wrk -t4 -c16 -d10s --latency http://localhost/
  Latency Distribution
     50%   11.05ms
     75%   11.51ms
     90%   12.28ms
     99%   14.20ms
  14166 requests in 10.01s, 0.94GB read
Requests/sec:   1415.15

ab -n 5000 -c 16 gave 1,447 requests per second and a 99th percentile of 13 ms, the same within noise. Claim no more than you measured: the load generator shared the CPUs with Apache 129 and FPM, with no TLS or database, so these runs rank settings and say little about real capacity. For that, load a staging copy from another machine, and watch p99 rather than the mean. The realpath cache, which saves stat() calls when PHP resolves include paths, rarely needs tuning: after one Laravel 2,157 request, realpath_cache_get() held 778 entries in 148.7 KB, far inside the 4096K default of realpath_cache_size.