Search Knowledge Base Articles
NGINX and PHP-FPM
Test 1: The standard HTML page.
Test 1 300 users in 1min (5 users/sec)
Apache response times: avg 86ms / max 544 ms / min 79 ms
PHP – FPM response times: avg 87 ms / max 467 ms / min 81 ms
Test 2 3000 users in 1 min (50 users/sec)
Apache response times: avg 83ms / max 456 ms / min 79 ms
PHP – FPM response times: avg 83ms / max 544 ms / min 80 ms
Test 3 10.000 users in 1 min (166 users/sec)
Apache response times: avg 82ms / max 373 ms / min 79 ms
PHP – FPM response times: avg 82ms / max 930 ms / min 79 ms
Test 4 20.000 users in 1 min (333 users/sec)
Apache response times: avg 166ms / max 1019 ms / min 157 ms
PHP – FPM response times: avg 165ms / max 514 ms / min 157 ms
From this test, we can’t conclude that much, only some variation in client/server. This is because we select a static page that was handled by Nginx.
Test 2: medium/large PHP/MySQL page
Test 1 300 users in 1min (5 users/sec)
Apache response times: avg 698 ms / max 1059 ms / min 407 ms
PHP – FPM response times: avg 588 ms / max 952 ms / min 454 ms
Test 2 3000 users in 1 min (50 users/sec)
This test failed due to a DOS.
Load Apache server
Test 3 500 users in 1 min (8 users/sec)
Apache with Nginx cache response times: Avg 1082 ms / max 2871 ms / min 339 ms
PHP – FPM response times: Avg 942 ms / max 1856 ms / min 340 ms
Conclusion
We can clearly state that Nginx – PHP-FPM 10 to 20% faster than Apache, even if we use Nginx caching. The test site in phase 2 was maybe a little too heavy for this lightweight server with this traffic. During some tests, more than 5,000 queries were performed within one minute. The website is a copy of a news site (cyclingnieuws.be) white +10.000 news articles and +15.000 races with +250.000 results.
Server upgrade:
After the execution of previous tests, I also wanted to know how this is going, on a slightly better server. I have upgraded the same servers to 8 vCPUs and 16GB of Ram.
Test 1: medium/large PHP/MySQL page
Test 1 300 users in 1min (5 users/sec)
Apache response times: Avg 373 ms / max 733 ms / min 326 ms
PHP – FPM response times: Avg 388 ms / max 791 ms / min 342 ms
Test 2 500 users in 1min (8 users/sec)
Apache response times: Avg 365 ms / max 643 ms / min 280 ms
PHP – FPM response times: Avg 373 ms / max 785 ms / min 260 ms
Test 3 1800 users in 1min (30 users/sec)
Apache response times: Avg 354 ms / max 845 ms / min 205 ms
PHP – FPM response times: Avg 298 ms / max 794 ms / min 193 ms
Test 4 3000 users in 1min (50 users/sec)
Apache response times: Avg 3605 ms / max 10084 ms / min 361 ms
PHP – FPM response times: Avg 338 ms / max 875 ms / min 259 ms
Test 5 6000 users in 1min (100 users/sec)
Apache response times: DOS
PHP – FPM response times: Avg 6448 ms / max 10238 ms / min 500 ms
Conclusion
In the beginning, we see a better working apache server, but because it only goes to a few milliseconds this is negligible. As of 30 users per second we see a difference in favor of PHP-fpm. As of 50 users per second apache can’t get his work done as opposed to PHP-FPM which can work to around 100 users per second.










