2006年04月03日 - mod_perl
mod_perl
しばらく追いかけるのをやめているうちにmod_perlはどんどん安定化し、かなり使えるものとなってしまっているようなので(おそい!)使ってみる。- BOX: AMD Opteron 1.6GHz x 2, 1GB RAM
- OS: FreeBSD 7.0-CURRENT #2: Thu Mar 23 12:41:17 JST 2006
- Apache httpd: 半年ぐらい前のHEADなやつかもしくは2.0.55などのGA、MPMはworker
- perl: perl 5.8.8
$ svn checkout https://svn.apache.org/repos/asf/perl/modperl/trunk/ mod_perl-2.0
$ cd mod_perl-2.0
$ perl Makefile.PL MP_APXS=/home/apache/bin/apxs
Reading Makefile.PL args from @ARGV
MP_APXS = /home/apache/bin/apxs
no conflicting prior mod_perl version found - good.
Configuring Apache/2.3.0-dev mod_perl/2.0.3-dev Perl/v5.8.8
・・・・・
・・・・・
$ make && make test
$ sudo make install
httpd.confに
LoadModule perl_module modules/mod_perl.so
と書いて基本的な設定はおわり。
いきなりモジュールを書くのもアレなので、とりあえずApache httpdに付属のprintenvをModPerl::Registryで動かしてみる。
PerlModule ModPerl::Registry
Alias /perl /home/apache/perl
<Location /perl>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
Options +ExecCGI
</Location>
と書いてhttpdをrestartして、/home/apache/perlにprintenvを置いてアクセス。をを!動いている(あたりまえ)。
mod_perlなので速いはず、ということで、フツーのCGIとして動くprintenvと比べてみると・・・
いい加減な計測だけど相対的な違いは明らか。かなり速い。安定して動くのならいいなあ。
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
Benchmarking foo.imgsrc.co.jp (be patient).....done
Server Software: Apache/2.3.0-dev
Server Hostname: foo.imgsrc.co.jp
Server Port: 80
Document Path: /perl/printenv
Document Length: 1115 bytes
Concurrency Level: 1
Time taken for tests: 0.166764 seconds
Complete requests: 50
Failed requests: 0
Write errors: 0
Total transferred: 65250 bytes
HTML transferred: 55750 bytes
Requests per second: 299.82 [#/sec] (mean)
Time per request: 3.335 [ms] (mean)
Time per request: 3.335 [ms] (mean, across all concurrent requests)
Transfer rate: 377.78 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 3 3 0.0 3 3
Waiting: 2 2 0.7 2 3
Total: 3 3 0.0 3 3
Percentage of the requests served within a certain time (ms)
50% 3
66% 3
75% 3
80% 3
90% 3
95% 3
98% 3
99% 3
100% 3 (longest request)
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
Benchmarking foo.imgsrc.co.jp (be patient).....done
Server Software: Apache/2.3.0-dev
Server Hostname: foo.imgsrc.co.jp
Server Port: 80
Document Path: /cgi-bin/printenv
Document Length: 1044 bytes
Concurrency Level: 1
Time taken for tests: 3.622623 seconds
Complete requests: 50
Failed requests: 0
Write errors: 0
Total transferred: 61700 bytes
HTML transferred: 52200 bytes
Requests per second: 13.80 [#/sec] (mean)
Time per request: 72.452 [ms] (mean)
Time per request: 72.452 [ms] (mean, across all concurrent requests)
Transfer rate: 16.56 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 1.5 0 8
Processing: 69 71 1.3 71 76
Waiting: 68 70 1.4 70 76
Total: 69 71 2.2 71 81
Percentage of the requests served within a certain time (ms)
50% 71
66% 72
75% 72
80% 72
90% 74
95% 76
98% 81
99% 81
100% 81 (longest request)