Welcome! Log In Create A New Profile

Advanced

Measuring nginx Performance Over Apache+mod_php

Posted by zgardner 
Measuring nginx Performance Over Apache+mod_php
August 24, 2012 10:01AM
I'm looking to switch from Apache+mod_php to HAProxy+nginx+PHP-FPM. I've read a lot online about the performance increase this setup will provide, so I decided to put together some experiments to verify the findings.

I'm unable to measure the performance advantage I've read so much about. From 1 to ~200 concurrent connections, my new setup runs slightly slower than the old. Around 250 concurrent connections is when I start getting socket errors.

The program I'm running is a simple login screen. Little querying, simple HTML, and just a little PHP. I've tried both siege and ab, and both show that Apache is slightly out performing the new setup.

I'm on Ubuntu 11.04 server on VirtualBox. Here are my abbreviated configs:



nginx.conf
worker_processes 2;

events {
worker_connections 768;
}


www.conf
pm = dynamic
pm.max_children = 10
pm.min_spare_servers = 2
pm.max_spare_servers = 4
pm.max_requests = 500


apache.conf
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 10
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_worker_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 10
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_event_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 10
MaxRequestsPerChild 0
</IfModule>

(More detailed configs can be found here: http://stackoverflow.com/questions/12056861/configuring-haproxynginxphp-fpm-to-out-perform-apachemod-php)


My thinking is that if Apache and PHP-FPM have the same number of workers (10), that the performance boost should be most visible. When running ab and siege, I've waited until the load was 0.01 to start the tests to make sure both had a level playing field.

Is there some utility I can run, or another part of my config I can post to identify why I'm not seeing the performance boost I've read about?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 66
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready