php vs php-fpm benchmarks |
Hi, just to test I created two Centos 8 with apache and php, clean nothing more than update the kernel to 5.6.12
By default, on Centos 8, php is installed with php-fpm enable and configured. To make Benchmark test I disable php-fpm on Server 1 Server 2 has enable php-fpm Both servers show which version of php are using: Server 1: Server API Apache 2.0 Handler Server 2: Server API FPM/FastCGI when I ran a simple ab test (ab -n 5000 -c 100 http://localhost:80/) I got the next results: Server 1: Requests per second: 1887.44 [#/sec] (mean) Time per request: 52.982 [ms] (mean) Time per request: 0.530 [ms] (mean, across all concurrent requests) Transfer rate: 117308.73 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.8 0 9 Processing: 12 51 4.6 50 86 Waiting: 8 50 4.6 50 68 Total: 21 51 4.2 50 86 Percentage of the requests served within a certain time (ms) 50% 50 66% 52 75% 53 80% 54 90% 56 95% 59 98% 62 99% 63 100% 86 (longest request) Server 2: Requests per second: 1383.05 [#/sec] (mean) Time per request: 72.304 [ms] (mean) Time per request: 0.723 [ms] (mean, across all concurrent requests) Transfer rate: 80832.62 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 1 1.6 0 14 Processing: 26 68 8.2 67 135 Waiting: 26 68 8.2 67 116 Total: 39 69 8.2 68 135 Percentage of the requests served within a certain time (ms) 50% 68 66% 70 75% 72 80% 73 90% 79 95% 84 98% 92 99% 99 100% 135 (longest request) As you can see, seems like php has better performance than php-fpm Does anyone knows why? and how to improve better performance on php-fpm?
If the configuration match you will get the same results, so it sounds like you have too few php-fpm pools. Personally I'm using static pools so that they don't shut down. I don't really care about memory consumption, as it's tuned to never bottleneck.
https://tideways.com/profiler/blog/an-in...fpm-tuning Apache with mod_php have a higher amount of processes started (can start) as it needs to both deliver static content as well as PHP. Now with apache + php-fpm, you have the same amount of apache processes but limited php processes instead. So it needs to be tuned. |
Welcome Guest, Not a member yet? Register Sign In |