VestaCP PHP-FPM VS Apache

With the introduction of vestaCP 15, there is also a new installation wizard. It is now possible to set up a Nginx with PHP-fpm server. But why should we upgrade? The current setups still work? I tested a few setups. To see if an update is necessary. I set up two identical VPS systems, one using PHP-fpm another Apache.

Server info

Location: Amsterdam (NL)
CPU: 1
RAM: 765MB
OS: CentOS 7

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:

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.

PHP-FPM Static file 20000 users
PHP_FPM Static 10000
PHP-FPM PHP file 500 users
PHP-FPM PHP file 400 users
PHP FPM PHP file 300 users
Apache static 20000 users
Apache static 300 users
Apache PHP 3000 users
Apache PHP 500 users
Apache PHP file 400 users
Apache PHP File 300 users

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.

PHP-FPM 6000 users
PHP-FPM 1800 users
PHP-FPM 3000 users
PHP-FPM 300 users
PHP-FPM 500 users
Apache 1800 users
Apache 3000 users
Apache 300 users
Apache 500 users

 

 

7 thoughts on “VestaCP PHP-FPM VS Apache

  1. Hello very nice website!! Man .. Beautiful .. Wonderful .. I will bookmark your web site and take the feeds additionallyKI’m happy to search out so many helpful info here within the put up, we’d like work out extra techniques in this regard, thank you for sharing. . . . . .

  2. I understand it s a year too late, but there s a bit on information lacking from the article. Have you been connecting nginx and php-fpm through unix socket or tcp one?

Leave a Reply

Your email address will not be published. Required fields are marked *