Comparing Apache mod_php, fcgid, proxy_fcgi + php-fpm with different MPMs for a WordPress blog.


Wordpress platform is very popular for personal sites and blogs. In this article I will stress-test my own site in order find best performance CGI and MPM.

All test was performed on low-end droplet from DigitalOcean:
1 CPU, 512 MB RAM, 20 GB SSD

Apache 2.4.10, PHP 5.6.20, MySQL 14.14 Distrib 5.5.49 was installed.
Opcache was enabled and tuned.
MySQL was tuned too. Used engine – InnoDB.
Apache mod_disk_cache is enabled, which is must-have for sites like mine.

Tests was performed by JMeter, installed on the same droplet in the same data center. Number of threads was gradually increased until the maximum stable values. All site pages was involved.
Apache was tested with classical mod_php and prefork MPM only(mod_php is not multithread-ready). fcgid and proxy_fcgi + php-fpm was tested with all of MPMs(prefork, worker, event). libapache2-mod-fastcgi was not tested, because of caching issues.

As a control test, Nginx was tested too with php-fpm and enabled fastcgi_cache.


HTTPD PHP MPM Queries per second
Apache mod_php prefork 2610
Apache fcgid prefork 2400
Apache fcgid worker 2460
Apache fcgid event 2520
Apache proxy_fcgi + php-fpm prefork 2670
Apache proxy_fcgi + php-fpm worker 2700
Apache proxy_fcgi + php-fpm event 2850
Nginx php-fpm 2600

1) All queries was cached(100% HIT).
2) As JMeter was in the same data center, bandwidth was huge. This is not how real world client apps works – just keep it in mind.
3) In spite of the fact that Apache showed the best throughput, about 2% of requests was closed with an error 403 Forbidden.
4) Despite the average throughput in the tests, Nginx proved to be the best – no errors, and the request processing time did not exceed 10 seconds.

1) If you are tied to Apache for some reason, the proxy_fcgi + php-fpm + MPM will provide maximum performance on a similar site.
2) If you are not tied to a specific HTTPD, use Ngnix. In addition to stability, it has advantages over Apache in terms of processing requests from the real world.

1 Comment

Leave a Reply

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