wersja ze squeeze'a:
ii libapache2-mod-fcgid 1:2.3.6-1+squeeze1 an alternative module compat with mod_fastcgi
ab uruchamiam tak:
ab -n 100 -c 10 http://69.202.230.62/test.php
caly error.log po uruchomieniu ab, loglevel debug - w access nic specjalnego nie ma:
root@user:/var/log/apache2# cat error.log
[sat Nov 03 20:22:17 2012] [info] Init: Seeding PRNG with 648 bytes of entropy
[sat Nov 03 20:22:17 2012] [info] Init: Generating temporary RSA private keys (512/1024 bits)
[sat Nov 03 20:22:17 2012] [info] Init: Generating temporary DH parameters (512/1024 bits)
[sat Nov 03 20:22:17 2012] [info] Init: Initializing (virtual) servers for SSL
[sat Nov 03 20:22:17 2012] [info] mod_ssl/2.2.16 compiled against Server: Apache/2.2.16, Library: OpenSSL/0.9.8o
[sat Nov 03 20:22:17 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[sat Nov 03 20:22:17 2012] [info] Init: Seeding PRNG with 648 bytes of entropy
[sat Nov 03 20:22:17 2012] [info] Init: Generating temporary RSA private keys (512/1024 bits)
[sat Nov 03 20:22:17 2012] [info] mod_fcgid: Process manager 1190 started
[sat Nov 03 20:22:17 2012] [info] Init: Generating temporary DH parameters (512/1024 bits)
[sat Nov 03 20:22:17 2012] [debug] ssl_scache_shmcb.c(253): shmcb_init allocated 512000 bytes of shared memory
[sat Nov 03 20:22:17 2012] [debug] ssl_scache_shmcb.c(272): for 511952 bytes (512000 including header), recommending 32 subcaches, 133 indexes each
[sat Nov 03 20:22:17 2012] [debug] ssl_scache_shmcb.c(306): shmcb_init_memory choices follow
[sat Nov 03 20:22:17 2012] [debug] ssl_scache_shmcb.c(308): subcache_num = 32
[sat Nov 03 20:22:17 2012] [debug] ssl_scache_shmcb.c(310): subcache_size = 15996
[sat Nov 03 20:22:17 2012] [debug] ssl_scache_shmcb.c(312): subcache_data_offset = 2144
[sat Nov 03 20:22:17 2012] [debug] ssl_scache_shmcb.c(314): subcache_data_size = 13852
[sat Nov 03 20:22:17 2012] [debug] ssl_scache_shmcb.c(316): index_num = 133
[sat Nov 03 20:22:17 2012] [info] Shared memory session cache initialised
[sat Nov 03 20:22:17 2012] [info] Init: Initializing (virtual) servers for SSL
[sat Nov 03 20:22:17 2012] [info] mod_ssl/2.2.16 compiled against Server: Apache/2.2.16, Library: OpenSSL/0.9.8o
[sat Nov 03 20:22:17 2012] [notice] Apache/2.2.16 (Debian) mod_fcgid/2.3.6 mod_ssl/2.2.16 OpenSSL/0.9.8o configured -- resuming normal operations
[sat Nov 03 20:22:17 2012] [info] Server built: Sep 9 2012 21:17:33
[sat Nov 03 20:22:17 2012] [debug] prefork.c(1013): AcceptMutex: sysvsem (default: sysvsem)
[sat Nov 03 20:22:27 2012] [info] mod_fcgid: server 69.202.230.62:/var/www/php/user/php5(1199) started
[sat Nov 03 20:22:28 2012] [info] mod_fcgid: server 69.202.230.62:/var/www/php/user/php5(1202) started
configi:
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
ServerTokens Prod
ServerSignature Off
TraceEnable Off
HostnameLookups Off
LogLevel debug
<IfModule mpm_prefork_module>
StartServers 3
MinSpareServers 3
MaxSpareServers 10
MaxClients 256
MaxRequestsPerChild 0
</IfModule>
<IfModule mod_fcgid.c>
FcgidConnectTimeout 30
FcgidMaxRequestLen 11485760
PHP_Fix_Pathinfo_Enable 1
FcgidMaxRequestsPerProcess 500
FcgidMaxProcessesPerClass 200
</IfModule>
# wrapper php
#!/bin/bash
PHP_FCGI_CHILDREN=0
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=10000
export PHP_FCGI_MAX_REQUESTS
exec /usr/bin/php5-cgi -c /var/www/php/user/php.ini
Dodam ze nie ma roznicy czy prefork czy worker, zmiana parametrow MPMow tez nic nie daje, z kolei jak odpale to samo pod mod_php to nawet nie ma co porownywac.
Teraz pod tym konfigiem, taki wynik:
Server Software: Apache
Server Port: 80
Document Path: /test.php
Document Length: 625 bytes
Concurrency Level: 10
Time taken for tests: 1.069 seconds
Complete requests: 100
Failed requests: 12
(Connect: 0, Receive: 0, Length: 12, Exceptions: 0)
Write errors: 0
Total transferred: 74086 bytes
HTML transferred: 62486 bytes
Requests per second: 93.53 [#/sec] (mean)
Time per request: 106.923 [ms] (mean)
Time per request: 10.692 [ms] (mean, across all concurrent requests)
Transfer rate: 67.67 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.4 0 2
Processing: 1 64 248.9 1 1068
Waiting: 1 61 239.6 1 1019
Total: 1 64 249.1 1 1069
Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 3
95% 1004
98% 1066
99% 1069
100% 1069 (longest request)
a skrypt jaki przepalam:
<?
echo "some php stuff" . "<br>";
for ($i = 1; $i <= 100; $i++) {
echo $i . "<br>";
}
echo microtime(true);
?>
Czasem, dzieje sie tak ze ten config dziala, ale np po dwoch razach ab juz zdycha i jest ~100 r/s z kolei mod_php moglby leciec z ab w petli cala noc i caly czas trzymie przeszlo 3000 r/s.
Dzieki za zainteresownie.