http://webmemo.uzuralife.com/article/2768
<?php
print str_repeat("=", mt_rand(0, 31));
$ ab -n 2000 -c 1000 "http://192.168.0.110:8081/phpinfo.php" 2>&1 | grep -iP "^((Non-2xx responses)|(Failed requests)|( \\(Connect)|(Complete requests)|(Requests per second)):"
Complete requests: 2000
Failed requests: 1932
(Connect: 0, Receive: 0, Length: 1932, Exceptions: 0)
Requests per second: 5085.11 [#/sec] (mean)
<?php
header("HTTP", true, 567);
$ ab -n 2000 -c 1000 "http://192.168.0.110:8081/phpinfo.php" 2>&1 | grep -iP "^((Non-2xx responses)|(Failed requests)|( \\(Connect)|(Complete requests)|(Requests per second)):"
Complete requests: 2000
Failed requests: 0
Non-2xx responses: 2000
Requests per second: 5221.43 [#/sec] (mean)
<?php
print date("Y-m-d");
$ ab -n 2000 -c 1000 "http://192.168.0.110:8081/phpinfo.php" 2>&1 | grep -iP "^((Non-2xx responses)|(Failed requests)|( \\(Connect)|(Complete requests)|(Requests per second)):"
Complete requests: 2000
Failed requests: 0
Requests per second: 5161.09 [#/sec] (mean)
<?php phpinfo(); $ ab -n 2000 -c 1000 "http://192.168.0.110:8081/phpinfo.php" 2>&1 | grep -iP "^((Non-2xx responses)|(Failed requests)|( \\(Connect)|(Complete requests)|(Requests per second)):" Complete requests: 2000 Failed requests: 194 (Connect: 0, Receive: 0, Length: 194, Exceptions: 0) Requests per second: 1773.90 [#/sec] (mean)
fastcgiの場合php-fpmがある、が一応オプションが違う。(gentooの/etc/init.d/spawn-fcgiの場合)
$ spawn-fcgi -h|grep "\-C" -C(PHP only) numbers of childs to spawn (default: not setting $ sudo cp -i /etc/init.d/spawn-fcgi /etc/init.d/spawn-fcgi.php $ diff -u /etc/init.d/spawn-fcgi{,.php} --- /etc/init.d/spawn-fcgi 2013-08-07 19:41:12.088306975 +0900 +++ /etc/init.d/spawn-fcgi.php 2013-08-07 20:23:38.082024559 +0900 @@ -96,8 +96,9 @@ env -i ${E} /sbin/start-stop-daemon --start --pidfile ${P} --exec ${SPAWNFCGI} \ --name ${FCGI_PROGRAM_EXEC} -- ${SOCKET_OPTION} ${INET_OPTION} \ - -P ${P} ${OPTIONS} -- ${FCGI_PROGRAM} + -P ${P} ${OPTIONS} -C ${FCGI_CHILDREN} -- ${FCGI_PROGRAM} RETVAL=$? + break # Stop on error. Don't want to spawn a mess! [ "${RETVAL}" != "0" ] && break $ diff /etc/conf.d/spawn-fcgi{,.php} 28c28 < FCGI_PORT=1234 --- > FCGI_PORT=9000 35c35 < FCGI_PROGRAM= --- > FCGI_PROGRAM=/usr/bin/php-cgi 39c39 < FCGI_CHILDREN=1 --- > FCGI_CHILDREN=10 $ rcsdiff /etc/config-archive/etc/nginx/nginx.conf,v /etc/nginx/nginx.conf =================================================================== RCS file: /etc/config-archive/etc/nginx/nginx.conf,v retrieving revision 1.1 diff -r1.1 /etc/nginx/nginx.conf 7c7 < worker_connections 1024; --- > worker_connections 8192; 49c49 < listen 127.0.0.1; --- > listen 192.168.0.110:8081 backlog=8192; 55a56,61 > > location ~ \.php($|/) { > include fastcgi_params; > fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; > fastcgi_pass 127.0.0.1:9000; > }
$ sudo /etc/init.d/spawn-fcgi.php restart
* Caching service dependencies ... [ ok ]
* Stopping FastCGI application php ... [ ok ]
* Starting FastCGI application php ...
spawn-fcgi: child spawned successfully: PID: 23935
spawn-fcgi: child spawned successfully: PID: 23938
spawn-fcgi: child spawned successfully: PID: 23941
spawn-fcgi: child spawned successfully: PID: 23944
spawn-fcgi: child spawned successfully: PID: 23947
spawn-fcgi: child spawned successfully: PID: 23950
spawn-fcgi: child spawned successfully: PID: 23953
spawn-fcgi: child spawned successfully: PID: 23956
spawn-fcgi: child spawned successfully: PID: 23959
spawn-fcgi: child spawned successfully: PID: 23962 [ ok ]
$ pstree |grep php-cgi
|-10*[php-cgi]
$ sudo /etc/init.d/spawn-fcgi.php restart
* Caching service dependencies ... [ ok ]
* Stopping FastCGI application php ... [ ok ]
* Starting FastCGI application php ...
spawn-fcgi: child spawned successfully: PID: 24168 [ ok ]
$ pstree |grep php-cgi
|-php-cgi---10*[php-cgi]
0 件のコメント:
コメントを投稿