Expression engine + fast-cgi + nginx

hi,

I tried the installing fast-cgi on a very busy expression engine blog
installation (100,000+ hits/day) and I would end up with way too many
cgi processes??? However when I tried reverse nginx as reverse proxy
over apache running php, I get amazing results. Almost all the load
(http requests) stay on nginx which is amazing to watch :slight_smile:

I used standard configurations found on wiki.nginx.org

any experiences or ideas?

yes, just now i found that nginx was not better than apache… >_<

Apache2 vs Nginx fair’er test!

The same: Using spawn-fcgi 1.6.2-2 spawning 4 child + v8cgi 20091117,
query from 4 tables in postgresql, real development example coding
script
The diff: apache2-mpm-prefork 2.2.12-1ubuntu2 + libapache2-mod-fastcgi
2.4.6-1 VS nginx 0.8.24-0~ppa1

Apache2 First, Nginx Last, -c 4 -n 300

sudo /etc/init.d/nginx stop ; sudo /etc/init.d/apache2 start ; ab -c 4
-n 300 http://127.1/uphs-cms/index.sjs ; sudo /etc/init.d/apache2 stop
; sudo /etc/init.d/nginx start ; ab -c 4 -n 300
http://127.1/uphs-cms/index.sjs ;

Time taken for tests: 74.771 seconds 85.420 seconds
Requests per second: 4.01 [#/sec] (mean) 3.51 [#/sec] (mean)
Time per request: 996.953 [ms] (mean) 1138.930 [ms] (mean)
Time per request: 249.238 [ms] 284.733 [ms] (mean,
across all concurrent requests)
Transfer rate: 3827.96 [Kbytes/sec] 3350.71 [Kbytes/sec]
received

APACHE +11…

Nginx First, Apache2 Last, -c 4 -n 300

sudo /etc/init.d/apache2 stop ; sudo /etc/init.d/nginx start ; ab -c 4
-n 300 http://127.1/uphs-cms/index.sjs ; sudo /etc/init.d/nginx stop ;
sudo /etc/init.d/apache2 start ; ab -c 4 -n 300
http://127.1/uphs-cms/index.sjs ;

Time taken for tests: 87.097 seconds 91.375 seconds
Requests per second: 3.44 [#/sec] (mean) 3.28 [#/sec] (mean)
Time per request: 1161.296 [ms] (mean) 1218.328 [ms] (mean)
Time per request: 290.324 [ms] 304.582 [ms] (mean,
across all concurrent requests)
Transfer rate: 3286.18 [Kbytes/sec] 3132.40 [Kbytes/sec]
received

NGINX +5…

Apache2 First, Nginx Last, -c 16 -n 64

sudo /etc/init.d/nginx stop ; sudo /etc/init.d/apache2 start ; ab -c
16 -n 64 http://127.1/uphs-cms/index.sjs ; sudo /etc/init.d/apache2
stop ; sudo /etc/init.d/nginx start ; ab -c 16 -n 64
http://127.1/uphs-cms/index.sjs ;

Time taken for tests: 20.376 seconds 21.050 seconds
Requests per second: 3.14 [#/sec] (mean) 3.04 [#/sec] (mean)
Time per request: 5093.951 [ms] (mean) 5262.544 [ms] (mean)
Time per request: 318.372 [ms] 328.909 [ms] (mean,
across all concurrent requests)
Transfer rate: 2996.73 [Kbytes/sec] 2900.67 [Kbytes/sec]
received

APACHE +1…

Nginx First, Apache2 Last, -c 16 -n 64

sudo /etc/init.d/apache2 stop ; sudo /etc/init.d/nginx start ; ab -c
16 -n 64 http://127.1/uphs-cms/index.sjs ; sudo /etc/init.d/nginx stop
; sudo /etc/init.d/apache2 start ; ab -c 16 -n 64
http://127.1/uphs-cms/index.sjs ;

Time taken for tests: 20.643 seconds 21.055 seconds
Requests per second: 3.10 [#/sec] (mean) 3.04 [#/sec] (mean)
Time per request: 5160.739 [ms] (mean) 5263.868 [ms] (mean)
Time per request: 322.546 [ms] 328.992 [ms] (mean,
across all concurrent requests)
Transfer rate: 2957.89 [Kbytes/sec] 2899.99 [Kbytes/sec]
received

NGINX +1…

Apache2 First, Nginx Last, -c 2 -n 50

sudo /etc/init.d/nginx stop ; sudo /etc/init.d/apache2 start ; ab -c 2
-n 50 http://127.1/uphs-cms/index.sjs ; sudo /etc/init.d/apache2 stop
; sudo /etc/init.d/nginx start ; ab -c 2 -n 50
http://127.1/uphs-cms/index.sjs ;

Time taken for tests: 13.526 seconds 12.732 seconds
Requests per second: 3.70 [#/sec] (mean) 3.93 [#/sec] (mean)
Time per request: 541.050 [ms] (mean) 509.290 [ms] (mean)
Time per request: 270.525 [ms] 254.645 [ms] (mean,
across all concurrent requests)
Transfer rate: 3526.75 [Kbytes/sec] 3746.62 [Kbytes/sec]
received

NGINX +1…

Nginx First, Apache2 Last, -c 2 -n 50

sudo /etc/init.d/apache2 stop ; sudo /etc/init.d/nginx start ; ab -c 2
-n 50 http://127.1/uphs-cms/index.sjs ; sudo /etc/init.d/nginx stop ;
sudo /etc/init.d/apache2 start ; ab -c 2 -n 50
http://127.1/uphs-cms/index.sjs ;

Time taken for tests: 14.858 seconds 14.600 seconds
Requests per second: 3.37 [#/sec] (mean) 3.42 [#/sec] (mean)
Time per request: 594.316 [ms] (mean) 584.007 [ms] (mean)
Time per request: 297.158 [ms] 292.003 [ms] (mean,
across all concurrent requests)
Transfer rate: 3210.61 [Kbytes/sec] 3267.34 [Kbytes/sec]
received

APACHE +0…

i guess there are no real winner? >_<

On 11/17/09, sinarababni [email protected] wrote:

any experiences or ideas?

–

Regards,
Kiswono P
GB

On Tue, Nov 17, 2009 at 07:11:19PM +0700, Kiswono P. wrote:

yes, just now i found that nginx was not better than apache… >_<

Apache2 vs Nginx fair’er test!

nginx is not faster than Apache2, nginx is more scalable:
it requires less memory (and probably less CPU) to handle tens thousands
connections.

yes, just now i found that nginx was not better than apache… >_<

Apache2 vs Nginx fair’er test!

What kind of performance test (except you measure cpu and memory
consumption) is it if you spend 5 seconds on a request resulting in
comparing 3.44 vs 3.14 requests per second?

Try to test something synthetic like ‘Hello world!’ which doesnt involve
other services like DB backends (which based on different
circumstances (like warm/cold cache etc) can act differently) and
whatnotelse…

rr

I tried the installing fast-cgi on a very busy expression engine blog installation (100,000+ hits/day) and I would end up with
way too many cgi

The usual setups with nginx+php involve static number of spawned php
processes (I haven’t seen any usefull adaptive spawning case).
You can use the ‘spawn-fcgi’ (which came with lighthttpd and afaik is
now also a seperate project) or my choice would be to use
php-fpm http://php-fpm.org

rr

yes, it’s a bad case… ^^ but doesn’t back end people do actually do it
too,
they didn’t use dynamic programming (they recalculate things that not
yet
changed) so it doesn’t really matter how fast web server they use, if
they
won’t generate the static content, it always gonna be slow… >_<

2009/11/17 Roast [email protected]

This test case is a bad case. very bad.

–

Regards,
Kiswono P
GB

caching has played such an important role in the speed and performance
of the site.
nginx does a great job serving cached content. I am very new to nginx
and I already feel so empowered running nginx as reverse proxy in front
of all my web servers.

I am getting best results with wordpress. From what I understand
(correct me if i’m wrong) nginx responds to caching headers coming from
the application server so unless you have the right headers sent caching
will not work well.

This test case is a bad case. very bad.