Comparing Nginx+PHP-FPM to Apache-mod_php

Posted by Rushi on Server Fault See other posts from Server Fault or by Rushi
Published on 2010-08-24T18:00:41Z Indexed on 2010/12/30 12:55 UTC
Read the original article Hit count: 430

Filed under:
|
|
|
|

I'm running Drupal and trying to figure out the best stack to serve it. Apache + mod_php or Nginx + PHP-FPM

I used ApacheBench (ab) and Siege to test both setups and I'm seeing Apache performing better. This surprises me a little bit since I've heard a lot of good things about Nginx + PHP-FPM. My current Nginx setup is something that is a bit out of the box, and the same goes for PHP-FPM

What optimizations I can make to speed up the Nginx + PHP-FPM combo over Apache and mo_php ? In my tests using ab, Apache is outperforming Nginx significantly (higher requets/second and finishing tests much faster)

I've googled around a bit, but since I've never using Nginx, PHP-FPM or FastCGI, I don't exactly know where to start

PHP v5.2.13, Drupal v6, latest PHP-FPM and Nginx compiled from source. Apache v2.0.63

ApacheBench Nginx + PHP-FPM

Server Software:        nginx/0.7.67
Server Hostname:        test2.com
Server Port:            80

Concurrency Level:      25
---> Time taken for tests:   158.510008 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
---> Requests per second:    6.31 [#/sec] (mean)
Time per request:       3962.750 [ms] (mean)
Time per request:       158.510 [ms] (mean, across all concurrent requests)
Transfer rate:          181.38 [Kbytes/sec] received

ApacheBench Apache using mod_php

Server Software:        Apache/2.0.63
Server Hostname:        test1.com
Server Port:            80

Concurrency Level:      25
--> Time taken for tests:   63.556663 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
--> Requests per second:    15.73 [#/sec] (mean)
Time per request:       1588.917 [ms] (mean)
Time per request:       63.557 [ms] (mean, across all concurrent requests)
Transfer rate:          103.94 [Kbytes/sec] received

© Server Fault or respective owner

Related posts about apache

Related posts about php