【激速】mod_perl SpeedyCGI FastCGI【激速】
■ このスレッドは過去ログ倉庫に格納されています
0001nobodyさん
2006/06/05(月) 20:01:09ID:+YcYjDiDhttp://perl.apache.org/
SpeedyCGI
http://perldoc.jp/docs/modules/CGI-SpeedyCGI-2.21/SpeedyCGI.pod
前スレ
mod_perlを使おう!
http://pc8.2ch.net/test/read.cgi/php/1005122528/
ー二三ヘ( ゚∀゚)ノ
0331nobodyさん
2006/06/29(木) 15:00:33ID:???0332nobodyさん
2006/06/29(木) 15:11:40ID:???http://perldoc.jp/docs/modules/CGI.pm-2.89/CGI/Fast.pod
1.まずはここのサンプルCGIがFastCGIで動くようする。(手順通りにインスコすれば動くはず)
2.自分のスクリプトを動かす。
このような手順でやらないと何が間違いかエラーログだけではわからないと思う。
0333nobodyさん
NGNG0334nobodyさん
2006/06/29(木) 15:20:52ID:???FastCGIの場合、CGI::FastまたはFCGIの無限ループを実行させるので、
use CGI::Fast;
か
use FCGI;
は必須です。
0335nobodyさん
2006/06/29(木) 15:32:42ID:???FastCGIはいい情報あまりありませんが、
CGI::Fastなら
http://perldoc.jp/docs/modules/CGI.pm-2.89/CGI/Fast.pod
や
http://www.drk7.jp/MT/archives/000917.html
の下の方にあるFastCGI サンプル CGI のソースが参考になると思います。
FCGIなら本家の
http://www.fastcgi.com/devkit/doc/fastcgi-prog-guide/ch3perl.htm#5002
(特にサンプルプログラム)
ここが参考になると思います。
手取り足取りのようなマニュアルはおそらく無いと思います。
0337335
2006/06/29(木) 15:50:27ID:???ここには短いソースで取ったFastCGI VS mod_perl のベンチが最後の方に載っています。
(ab -n 100 -c 10)
結果はやはり小差でFastCGIの勝ちです。
0338nobodyさん
2006/06/29(木) 16:33:16ID:???この比較は、
lighttpd + FastCGI vs mod_perl + Apache1.3
で、httpd自体が違うんで、単純なmod_perl対FastCGIでは無いんです。
ただ、この lighttpd + FastCGI という組み合わせも面白そうですよね。
これなら、dagでrpmから入れられるし。
0339335
2006/06/29(木) 17:01:24ID:???確かにその通りのようですね。
しかし、この結果を見るとlighttpd + FastCGIはApache + FastCGIより速いのかな?
と思います。
単体で圧勝するのは周知の事実のようですが。
0340nobodyさん
2006/06/29(木) 18:24:12ID:???> しかし、この結果を見るとlighttpd + FastCGIはApache + FastCGIより速いのかな?
> と思います。
この点は、微妙ですね。
同じ-c 10 で比較すると、274の結果では大差が付いているものの、337のサイトでは小差。
mod_perlの処理結果を元に比較すれば、Apache + FastCGIの方が速い様に見えます。
しかし、274のベンチは、かなりサイズの大きなソースを実行した結果ですが、337にある
サイトの結果は、Hello Worldの世界。
>>298の言う原因で-c が増えると mod_perl が遅くなるというのであれば、むしろ274のベンチ
の -c 1 あたりと比較する方が妥当とも考えられます。
と言うことで、やってみないと何とも言えない様に思います。
ただ、静的コンテンツについては lighttpd の方が速いそうなので、僅かに lighttpd の勝ち
かなという気もしています。
まあ、差が出たとしても、意味のある差は出ない様に思いますが。
0341nobodyさん
2006/06/29(木) 21:19:22ID:???ということで、速度に関して議論することは不毛であるという結論になりました。
0342nobodyさん
2006/06/29(木) 21:33:27ID:???0343nobodyさん
2006/06/29(木) 21:50:21ID:???0344nobodyさん
2006/06/29(木) 21:57:00ID:???0345nobodyさん
2006/06/29(木) 21:59:44ID:???0347nobodyさん
2006/06/30(金) 00:40:29ID:???その変わりに、純国産言語Rubyがあちらで盛り上がって逆輸入されている模様。
RubyのFastCGI対応は容易だそうです。
0349nobodyさん
NGNG0351nobodyさん
2006/06/30(金) 19:15:37ID:???0352nobodyさん
2006/06/30(金) 21:21:51ID:???0353nobodyさん
2006/06/30(金) 22:24:25ID:???0355310
2006/06/30(金) 23:06:24ID:???512MB
Vine3.2最小インストール+コンパイル環境
+Apache2.0.58ソース(preforkでコンパイル)+mod_perl-2.0.2ソース+PersistentPerl-2.22ソース+fcgi-2.4.0ソース+mod_fastcgi-2.4.2ソース
テストソースnicky.cgi改(約160KB)
1パラメータセット終わる度に、
SpeedyCGI、mod_speedycgiはテストソースをtouch、
fastcgi、Registry、PerlRunはhttpdを再起動してキャッシュをリセット。
Registryは-c 40以降、PerlRunは-c 100以降でswapが発生したため、1パラメータ終わる度にPCを再起動。
以下、結果報告。
0356310
2006/06/30(金) 23:10:19ID:???CGI perlcc -B SpeedyCGI mod_speedycgi fastcgi Registry PerlRun html
1回目 0.45 1.24 2.60 2.51 2.13 0.44 0.31 191.98
2回目 0.45 1.25 7.15 8.39 7.57 8.17 0.36 232.50
3回目 0.45 1.24 7.05 8.40 7.57 8.15 0.37 244.87
4回目 0.45 1.24 7.01 8.39 7.70 8.06 0.37 245.72
5回目 0.45 1.24 7.04 8.54 7.70 8.04 0.36 241.94
平均 0.45 1.24 6.17 7.25 6.53 6.57 0.35 231.40
Requests per second
ab -n 100 -c 10
CGI perlcc -B SpeedyCGI mod_speedycgi fastcgi Registry PerlRun html
1回目 0.45 1.21 5.59 7.94 6.41 1.36 0.34 248.19
2回目 0.44 1.22 6.52 8.21 7.61 4.10 ABORT 259.18
3回目 0.45 1.22 6.62 8.03 7.60 5.99 0.34 256.66
4回目 0.45 1.22 6.61 8.03 7.60 4.18 0.33 253.06
5回目 0.45 1.23 6.63 7.82 7.63 7.26 0.34 250.21
平均 0.45 1.22 6.39 8.01 7.37 4.58 0.34 253.46
Requests per second
0357310
2006/06/30(金) 23:20:33ID:???CGI perlcc -B SpeedyCGI mod_speedycgi fastcgi Registry PerlRun html
1回目 ABORT 1.19 5.39 7.72 6.90 ABORT ABORT 258.46
2回目 ABORT 1.18 6.48 7.93 7.60 2.36 ABORT 258.21
3回目 ABORT 1.19 6.60 8.04 7.61 5.50 ABORT 264.66
4回目 ABORT 1.20 6.55 7.92 7.58 2.72 ABORT 255.30
5回目 ABORT 1.18 6.59 7.89 7.58 3.45 ABORT 263.01
平均 #DIV/0! 1.19 6.32 7.90 7.45 3.51 #DIV/0! 259.93
Requests per second
ab -n 400 -c 40
CGI perlcc -B SpeedyCGI mod_speedycgi fastcgi Registry PerlRun html
1回目 ABORT 1.17 5.46 7.57 5.11 ABORT ABORT 255.63
2回目 ABORT 1.21 6.39 7.77 7.44 ABORT ABORT 257.08
3回目 ABORT 1.17 6.50 7.79 7.43 ABORT ABORT 258.36
4回目 ABORT 1.17 6.47 7.77 7.45 1.11 ABORT 260.97
5回目 ABORT 1.17 6.53 7.92 7.10 ABORT ABORT 257.69
平均 #DIV/0! 1.18 6.27 7.76 6.91 1.11 #DIV/0! 257.95
0358310
2006/06/30(金) 23:29:44ID:???フライングしました。
後はもう少し待ってください。
0359310
2006/06/30(金) 23:40:39ID:???CGI perlcc -B SpeedyCGI mod_speedycgi fastcgi Registry PerlRun html
1回目 ABORT 1.16 5.51 7.48 6.14 ABORT ABORT 242.47
2回目 ABORT ABORT 6.33 7.66 7.19 ABORT ABORT 244.29
3回目 ABORT ABORT 6.50 7.71 7.22 ABORT ABORT 249.26
4回目 ABORT ABORT 6.47 7.72 7.10 ABORT ABORT 246.59
5回目 ABORT ABORT 6.45 7.82 7.25 3.05 ABORT 241.51
平均 #DIV/0! 1.16 6.25 7.68 6.98 3.05 #DIV/0! 244.82
Requests per second
ab -n 1500 -c 150
CGI perlcc -B SpeedyCGI mod_speedycgi fastcgi Registry PerlRun html
1回目 ABORT ABORT 5.39 7.49 6.35 ABORT ABORT 235.70
2回目 ABORT ABORT 6.26 7.70 6.89 ABORT ABORT 237.14
3回目 ABORT ABORT 6.46 7.63 6.82 ABORT ABORT 232.74
4回目 ABORT ABORT 6.39 7.66 6.83 ABORT ABORT 225.48
5回目 ABORT ABORT 6.40 7.67 7.11 3.75 ABORT 226.65
平均 #DIV/0! #DIV/0! 6.18 7.63 6.80 3.75 #DIV/0! 231.54
Requests per second
0360nobodyさん
NGNG0361310
2006/07/01(土) 00:14:11ID:???CGI perlcc -B SpeedyCGI mod_speedycgi fastcgi Registry PerlRun html
1回目 ABORT 1.17 ABORT 7.56 6.44 ABORT ABORT 228.41
2回目 ABORT ABORT 6.25 7.79 6.96 ABORT ABORT 230.36
3回目 ABORT ABORT 6.36 7.77 6.73 ABORT ABORT 225.48
4回目 ABORT ABORT 6.38 7.74 6.93 ABORT ABORT 234.54
5回目 ABORT ABORT 6.30 7.63 6.98 6.48 ABORT 233.99
平均 #DIV/0! 1.17 6.32 7.70 6.81 6.48 #DIV/0! 230.56
Requests per second
以上、報告終わり。
0362nobodyさん
2006/07/01(土) 03:18:50ID:???ご苦労様でした。
http://www.drk7.jp/MT/archives/000863.html
あたりを見て、SpeedyCGIより、FastCGIの方が速いのかと思っていたんですが、
mod_speedycgiを入れると、
mod_speedycgi > FastCGI > SpeedyCGI
という順番の様ですね。
perlだけ使うんであれば、導入の手間、速度の両面で、FastCGIを使うメリットは
無いのかな。
0363nobodyさん
2006/07/01(土) 04:59:21ID:???0364nobodyさん
2006/07/01(土) 10:53:26ID:???lighttpd用のmod_s;peedycgiみたいなのは無いよね?
0365nobodyさん
2006/07/01(土) 11:12:27ID:???0366nobodyさん
2006/07/01(土) 12:00:43ID:???512MB
Vine3.2最小インストール+コンパイル環境
+Apache2.0.58ソース(preforkでコンパイル)+mod_perl-2.0.2ソース+PersistentPerl-2.22ソース+fcgi-2.4.0ソース+mod_fastcgi-2.4.2ソース
1パラメータセット終わる度に、
SpeedyCGI、mod_speedycgiはテストソースをtouch、
fastcgi、Registry、PerlRunはhttpdを再起動してキャッシュをリセット。
テストソース hello world
ごく小さなソースでのベンチも必要だと感じたので測定。
workerはとるつもりはありません。
その暇があれば、lighttpdを測定する方が有益と思います。
Cのcgiと以前話が出た、fastcgi c VS fastcgi perl を入れました。
またこのソースではRegistry、PerlRunのswapは発生せず。
0367355
2006/07/01(土) 12:03:41ID:???hello.html
<HTML>
Hello, world!
</HTML>
hello.pl
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<HTML>\n";
print "Hello, world!\n";
print "</HTML>";
hello.c
#include <stdio.h>
void main(void)
{
printf("Content-type: text/html\n\n");
printf("<HTML>\n");
printf("Hello, world!\n");
printf("</HTML>");
}
0368355
2006/07/01(土) 12:05:28ID:???#!/usr/bin/perl
use FCGI;
while (FCGI::accept >= 0)
{
print "Content-type: text/html\n\n";
print "<HTML>\n";
print "Hello, world!\n";
print "</HTML>";
}
fast_hello.c
#include "fcgi_stdio.h"
#include <stdio.h>
void main(void)
{
while (FCGI_Accept() >= 0)
{
printf("Content-type: text/html\n\n");
printf("<HTML>\n");
printf("Hello, world!\n");
printf("</HTML>");
}
}
0369355
2006/07/01(土) 12:07:54ID:???0370355
2006/07/01(土) 12:14:24ID:???CGI c CGI perl perlcc -B SpeedyCGI mod_speedycgi fastcgi c fastcgi perl Registry PerlRun html
1回目 80.62 26.17 13.50 20.71 16.41 16.34 9.77 1.65 2.41 270.10
2回目 81.39 26.74 13.84 35.79 123.85 185.42 121.37 94.43 54.39 277.01
3回目 82.48 26.91 13.86 36.50 123.57 178.26 121.73 95.35 12.15 268.12
4回目 81.96 27.03 13.90 36.66 123.49 182.54 122.29 96.74 57.00 267.32
5回目 81.82 26.66 13.87 36.59 109.58 181.85 122.36 97.30 57.03 272.57
平均 81.65 26.70 13.79 33.25 99.38 148.88 99.50 77.09 36.60 271.02
Requests per second
0371355
2006/07/01(土) 12:15:04ID:???CGI c CGI perl perlcc -B SpeedyCGI mod_speedycgi fastcgi c fastcgi perl Registry PerlRun html
1回目 80.35 24.59 12.53 32.28 112.21 181.51 79.98 7.38 7.14 287.30
2回目 76.72 24.56 12.80 34.48 121.06 182.21 121.81 74.02 44.14 278.04
3回目 79.79 24.38 12.74 33.25 119.92 181.57 120.37 85.51 42.99 280.69
4回目 76.24 24.42 13.22 33.15 122.28 179.48 121.18 85.56 30.75 287.75
5回目 76.19 24.48 12.75 33.24 116.35 182.61 118.93 87.59 48.18 288.21
平均 77.86 24.49 12.81 33.28 118.36 181.48 112.45 68.01 34.64 284.40
Requests per second
0372355
2006/07/01(土) 12:17:41ID:???CGI c CGI perl perlcc -B SpeedyCGI mod_speedycgi fastcgi c fastcgi perl Registry PerlRun html
1回目 80.35 24.59 12.53 32.28 112.21 181.51 79.98 7.38 7.14 287.30
2回目 76.72 24.56 12.80 34.48 121.06 182.21 121.81 74.02 44.14 278.04
3回目 79.79 24.38 12.74 33.25 119.92 181.57 120.37 85.51 42.99 280.69
4回目 76.24 24.42 13.22 33.15 122.28 179.48 121.18 85.56 30.75 287.75
5回目 76.19 24.48 12.75 33.24 116.35 182.61 118.93 87.59 48.18 288.21
平均 77.86 24.49 12.81 33.28 118.36 181.48 112.45 68.01 34.64 284.40
Requests per second
0373355
2006/07/01(土) 12:18:55ID:???>371と>372は同じものです。
0374355
2006/07/01(土) 12:31:33ID:???CGI c CGI perl perlcc -B SpeedyCGI mod_speedycgi fastcgi c fastcgi perl Registry PerlRun html
1回目 78.10 24.62 12.69 31.51 114.04 184.03 95.03 10.00 8.64 292.87
2回目 81.17 24.66 12.73 33.03 119.16 185.93 118.80 90.98 55.16 293.11
3回目 77.62 24.74 13.25 32.99 114.92 192.23 119.23 79.47 44.99 280.26
4回目 78.70 24.81 12.88 32.10 118.08 188.86 119.64 77.49 48.46 286.11
5回目 79.50 24.73 12.98 33.11 115.42 182.41 117.86 62.33 46.55 284.11
平均 79.02 24.71 12.91 32.55 116.32 186.69 114.11 64.05 40.76 287.29
Requests per second
0375355
2006/07/01(土) 12:33:33ID:???CGI c CGI perl perlcc -B SpeedyCGI mod_speedycgi fastcgi c fastcgi perl Registry PerlRun html
1回目 80.57 24.42 12.50 31.78 110.56 176.86 100.96 16.91 12.96 293.94
2回目 80.33 24.47 12.56 33.84 118.34 180.34 113.21 21.93 23.52 287.48
3回目 78.31 25.03 12.71 32.34 116.58 183.24 110.40 81.42 55.92 300.39
4回目 79.41 25.16 12.49 33.90 124.34 183.00 106.40 75.04 56.51 293.20
5回目 77.44 24.50 12.55 32.24 120.68 183.12 109.45 81.47 46.63 300.58
平均 79.21 24.72 12.56 32.82 118.10 181.31 108.08 55.35 39.11 295.12
Requests per second
0376355
2006/07/01(土) 12:38:01ID:???CGI c CGI perl perlcc -B SpeedyCGI mod_speedycgi fastcgi c fastcgi perl Registry PerlRun html
1回目 78.12 24.91 12.97 30.99 91.33 174.89 92.12 20.86 16.17 287.40
2回目 80.17 25.31 12.80 32.12 109.90 174.87 94.91 25.45 18.14 281.79
3回目 78.44 24.65 12.57 32.41 112.69 170.94 101.65 46.86 54.87 274.96
4回目 78.01 23.84 12.96 32.05 113.81 166.39 102.72 95.56 46.12 283.29
5回目 78.69 24.87 12.52 32.35 113.24 166.31 101.21 74.98 34.28 283.35
平均 78.69 24.72 12.76 31.98 108.19 170.68 98.52 52.74 33.92 282.16
Requests per second
0377355
2006/07/01(土) 12:40:23ID:???CGI c CGI perl perlcc -B SpeedyCGI mod_speedycgi fastcgi c fastcgi perl Registry PerlRun html
1回目 76.39 24.19 12.50 31.27 99.27 172.32 88.22 18.96 17.69 275.84
2回目 72.94 24.22 12.56 31.99 112.01 166.82 96.86 27.05 21.28 277.10
3回目 73.62 24.78 12.62 32.71 114.98 163.69 97.89 71.29 40.18 273.88
4回目 73.88 23.90 12.61 32.49 112.21 164.86 98.73 75.77 21.71 256.73
5回目 74.24 24.13 12.69 33.07 114.19 167.17 98.56 75.81 40.84 255.67
平均 74.21 24.24 12.60 32.31 110.53 166.97 96.05 53.78 28.34 267.84
Requests per second
0378355
2006/07/01(土) 12:42:34ID:???CGI c CGI perl perlcc -B SpeedyCGI mod_speedycgi fastcgi c fastcgi perl Registry PerlRun html
1回目 75.00 24.42 12.59 31.47 109.51 170.30 87.57 21.46 17.50 250.27
2回目 75.09 24.05 12.51 31.69 116.31 169.27 91.84 37.49 32.77 261.21
3回目 73.87 24.67 12.60 32.76 113.69 164.81 92.60 74.82 46.47 260.43
4回目 73.51 24.43 12.59 32.68 113.51 170.00 92.98 74.82 45.72 260.72
5回目 73.26 24.08 12.88 32.72 112.25 165.43 93.40 71.43 43.67 261.65
平均 74.15 24.33 12.63 32.26 113.05 167.96 91.68 56.00 37.23 258.86
Requests per second
0379355
2006/07/01(土) 12:43:06ID:???0380nobodyさん
2006/07/01(土) 12:44:06ID:???0382355
2006/07/01(土) 13:07:11ID:???CGI c CGI perl perlcc -B SpeedyCGI mod_speedycgi fastcgi c fastcgi perl Registry PerlRun html
ab -n 10 -c 1 81.72 26.77 13.86 36.29 118.88 180.88 121.80 95.51 41.18 270.26
ab -n 100 -c 10 77.58 24.49 12.76 33.21 119.11 181.76 120.16 81.70 39.29 285.25
ab -n 200 -c 20 78.77 24.71 12.86 32.71 116.14 186.27 118.63 73.10 46.67 287.70
ab -n 400 -c 40 79.35 24.67 12.54 32.81 118.53 182.15 108.75 59.46 42.02 295.84
ab -n 1000 -c 100 78.42 24.81 12.78 32.17 111.94 170.73 99.26 49.10 32.85 282.81
ab -n 1500 -c 150 73.91 24.18 12.60 32.40 112.80 166.28 97.77 58.04 27.72 268.82
ab -n 2000 -c 200 74.13 24.31 12.59 32.36 113.15 168.23 92.47 61.25 40.72 260.79
Requests per second
0383nobodyさん
2006/07/01(土) 13:13:38ID:???やっぱり不安定なやつの救済にはならなかったかorz
0384355
2006/07/01(土) 13:29:33ID:???prefork
nicky.cgi改
CGI perlcc -B SpeedyCGI mod_speedycgi fastcgi Registry PerlRun html
ab -n 10 -c 1 0.45 1.24 7.03 8.39 7.61 8.08 0.36 239.77
ab -n 100 -c 10 0.45 1.22 6.58 8.00 7.60 4.76 0.23 253.31
ab -n 200 -c 20 abort all 1.19 6.54 7.91 7.59 2.06 abort all 259.89
ab -n 400 -c 40 abort all 1.17 6.45 7.78 7.32 1.11 abort all 257.71
ab -n 1000 -c 100 abort all 1.16 6.42 7.70 7.17 3.05 abort all 244.45
ab -n 1500 -c 150 abort all abort all 6.35 7.65 6.85 3.75 abort all 231.70
ab -n 2000 -c 200 abort all 1.17 4.22 7.71 6.87 6.48 abort all 230.92
Requests per second
0385355
2006/07/01(土) 13:38:10ID:???worker
nicky.cgi改
CGI perlcc -B SpeedyCGI fastcgi Registry PerlRun html
ab -n 10 -c 1 0.45 1.24 6.91 7.50 7.88 0.34 221.72
ab -n 100 -c 10 0.45 1.21 6.44 7.49 4.14 0.33 242.03
ab -n 200 -c 20 abort all 1.19 6.37 7.37 3.69 0.22 239.23
ab -n 400 -c 40 abort all 1.17 6.36 7.24 1.39 0.12 233.45
ab -n 1000 -c 100 abort all 1.17 6.50 7.08 3.16 abort all 214.85
ab -n 1500 -c 150 abort all 1.18 6.50 6.75 3.70 abort all 217.76
ab -n 2000 -c 200 abort all 1.19 6.29 6.89 3.85 abort all 219.70
Requests per second
0386nobodyさん
2006/07/01(土) 13:40:29ID:???またまた、ご苦労様です。
これだけあると、見るのも大変だけど、作る方は、もっと大変なんでしょうね。(^^;
これを見ると、mod_perl,fastcgiは、同時接続数が増えた際のレスポンスの落ち込みが
他と比べて大きいですね。
fastcgiでは、大きなソースだと、その差が見えずらくなりますが。
この中では、fastcgi cが一番速いですが、cで書くんだったら、fastcgiを使わずに
module作った方が良いかなと言う気もします。
開発・導入コスト、スピード、メンテナンス性を考えると、Apache API 使いたいとか
言うのでなければ、mod_speedycgiって、とても良い選択肢ですね。
0387nobodyさん
NGNGmod_speedycgiとspeedy(perperl)って何が違うんですか?
0388355
2006/07/01(土) 14:00:16ID:???mod_speedycgiは1つだけ欠点が。
worker環境では動きませんでした。
運用可能なのは、Apache1(確認)とApache2のprefork(確認)のみと思われます。
0389nobodyさん
2006/07/01(土) 14:12:54ID:???SpeedyCGIは
httpd→SpeedyCGIフロントエンド起動→SpeedyCGIバックエンド呼び出し
こういう感じになります。
mod_speedycgiはSpeedyCGIフロントエンドがアパッチプロセスに埋め込まれて常駐します。
httpd内でSpeedyCGIフロントエンド呼び出し→SpeedyCGIバックエンド呼び出し
こういう感じかな。
小さいソースでSpeedyCGIが伸びないところをみると、SpeedyCGIフロントエンド起動はコストが高いのかも(インタープリタ起動のコストの2/3ぐらい?)。
0390nobodyさん
2006/07/01(土) 20:49:09ID:???0391nobodyさん
2006/07/01(土) 21:20:12ID:???0393nobodyさん
2006/07/01(土) 21:47:44ID:???Hello Worldで、SpeedyCGIが伸びないのは、mod_cgi経由だからかなという気がしています。
perlを使うと言う前提で考えれば、通常のcgiと比較して、何が省略できて、逆に何が余分に
掛かるのかと言う話なんですよね、多分。
mod_cgiを通すから、コストが掛かるのか、純粋にspeedyの起動に時間が掛かるのかは分か
らないのですが。
mod_perlが同時接続数が増えると成績悪くなるのは、余分に掛かるものが、無視できなくなっ
たためなのかな。
ちなみに、両方のテストと共、PerlRunには酷なテストでしたね。
大元のスクリプトのは毎回呼び出すけど、useしたものはメモリーに置くという方式なので、
速度的にメリットを出せる部分が全然使われてません。
意味がなくても、use CGI;use DBI;use Templateあたりを追加したHelloWorldなソースで比
べると、CGIよりも良い成績が出るのではないかと思っています。
大きなソースの場合、アプリの機能を、ほとんどモジュール側に持って行けば、それなりに
速くなる筈です。殆どの機能をモジュール側に持って行ったら、PerlRun使わずに、Registry
使えよという話になるんですが。
まあ、このPerlRunとCGIの差が、mod_perlを使った際に、余分に掛かる物の量なんでしょうね。
0394355
2006/07/01(土) 22:37:21ID:???> 意味がなくても、use CGI;use DBI;use Templateあたりを追加したHelloWorldなソースで比
> べると、CGIよりも良い成績が出るのではないかと思っています。
useしたものはメモリーに置くということは知りませんでした。
基本的にできるだけ同じ条件で取る方向で測定したので、知っていても同じ条件で取ったと思います。
インタープリタをプロセス内にあることのアドバンテージは起動コストの高い>382で出ていると思います。(hello world)
0395355
2006/07/01(土) 22:40:01ID:???○インタープリタが
0396nobodyさん
2006/07/01(土) 23:38:12ID:???0397393
2006/07/02(日) 00:05:08ID:???> useしたものはメモリーに置くということは知りませんでした。
出鱈目な事を言っているといけないので、資料を当たってみました。
下記の "Apache::PerlRun--a closer look" が参考になると思います。
http://perl.apache.org/docs/1.0/guide/porting.html#Apache__PerlRun__a_closer_look
という事で、スクリプトの書き方によって、PerlRunもRegistryに近い速度を出せるそうです。
まあ、ベンチを取る時に、全体のコード量と、useする比率をどの程度にするのが妥当かと
いうのは、非常に難しい問題なのですが。
0398355
2006/07/02(日) 00:14:54ID:???>mod_perlではスワップ発生してたりしないかな?
一応ベンチ取ったときに書き込みましたが、長すぎて読みにくかったかな。
>384の場合のみ発生しています。
Registryは-c 40からPerlRunは-c 100からです。
0399355
2006/07/02(日) 01:06:21ID:???一部訂正。
エクセルを使ったMAX、MINを除外した平均値の算出に誤り。
=IF(COUNT(B3:B7)>2,(SUM(B3:B7)-MAX(B3:B7)-MIN(B3:B7))/3,AVERAGE(B3:B7))
データが4点の場合2で割らないといけませんが、3の決めうちで割ってしまっています。
=IF(COUNT(B3:B7)>2,(SUM(B3:B7)-MAX(B3:B7)-MIN(B3:B7))/(COUNT(B3:B7)-2),AVERAGE(B3:B7))
でデータ数-2で割るように修正したデータを載せます。
>382、>384、>385のうち>382だけはこの影響は受けません。
ABORTがないため3の決めうちで問題ないからです。
不注意申し訳ないです。
0400355
2006/07/02(日) 01:18:46ID:???prefork
nicky.cgi改
CGI perlcc -B SpeedyCGI mod_speedycgi fastcgi Registry PerlRun html
ab -n 10 -c 1 0.45 1.24 7.03 8.39 7.61 8.08 0.36 239.77
ab -n 100 -c 10 0.45 1.22 6.58 8.00 7.60 4.76 0.34 253.31
ab -n 200 -c 20 abort all 1.19 6.54 7.91 7.59 3.09 abort all 259.89
ab -n 400 -c 40 abort all 1.17 6.45 7.78 7.32 1.11 abort all 257.71
ab -n 1000 -c 100 abort all 1.16 6.42 7.70 7.17 3.05 abort all 244.45
ab -n 1500 -c 150 abort all abort all 6.35 7.65 6.85 3.75 abort all 231.70
ab -n 2000 -c 200 abort all 1.17 6.33 7.71 6.87 6.48 abort all 230.92
Requests per second
0401355
2006/07/02(日) 01:27:29ID:???worker
nicky.cgi改
CGI perlcc -B SpeedyCGI fastcgi Registry PerlRun html
ab -n 10 -c 1 0.45 1.24 6.91 7.50 7.88 0.34 221.72
ab -n 100 -c 10 0.45 1.21 6.44 7.49 4.14 0.33 242.03
ab -n 200 -c 20 abort all 1.19 6.37 7.37 5.54 0.33 239.23
ab -n 400 -c 40 abort all 1.17 6.36 7.24 4.17 0.35 233.45
ab -n 1000 -c 100 abort all 1.17 6.50 7.08 4.75 abort all 214.85
ab -n 1500 -c 150 abort all 1.18 6.50 6.75 5.55 abort all 217.76
ab -n 2000 -c 200 abort all 1.19 6.29 6.89 5.78 abort all 219.70
Requests per second
0402nobodyさん
2006/07/02(日) 03:23:34ID:???K6-2 475MHz
512MB
Vine3.2最小インストール+コンパイル環境
+lighttpd-1.4.11ソース+fcgi-2.4.0ソース
テストソース hello world(>367-368)
fast_hello.pl、nicky.cgi改はFastCGIソース
hello.html、nicky.htmlは同等のhtml
以下、結果報告。
0403nobodyさん
2006/07/02(日) 03:24:37ID:???fast_hello.pl nicky.cgi改 hello.html nicky.html
1回目 80.17 7.43 404.65 294.84
2回目 80.22 7.50 438.85 290.78
3回目 81.09 7.50 433.39 294.58
4回目 82.52 7.59 403.80 284.79
5回目 82.24 7.60 443.26 299.15
3点平均 81.18 7.53 425.63 293.40
Requests per second
ab -n 100 -c 10
fast_hello.pl nicky.cgi改 hello.html nicky.html
1回目 82.15 7.37 545.05 419.07
2回目 81.17 7.45 581.38 362.70
3回目 81.97 7.40 558.21 375.57
4回目 78.28 7.44 577.86 394.92
5回目 80.37 7.47 548.81 422.58
3点平均 81.17 7.43 561.63 396.52
Requests per second
ab -n 200 -c 20
fast_hello.pl nicky.cgi改 hello.html nicky.html
1回目 79.99 7.50 554.36 399.54
2回目 79.05 7.47 530.38 394.03
3回目 79.49 7.44 540.64 391.67
4回目 81.20 7.48 488.14 410.85
5回目 80.41 7.42 532.57 371.96
3点平均 79.96 7.46 534.53 395.08
Requests per second
0404402
2006/07/02(日) 03:27:00ID:???fast_hello.pl nicky.cgi改 hello.html nicky.html
1回目 80.74 7.38 501.38 385.98
2回目 80.67 7.38 538.61 389.09
3回目 81.04 7.38 524.94 388.81
4回目 81.28 7.39 530.10 364.66
5回目 81.20 7.39 547.67 386.51
3点平均 80.99 7.38 531.22 387.10
Requests per second
ab -n 1000 -c 100
fast_hello.pl nicky.cgi改 hello.html nicky.html
1回目 79.60 7.16 523.19 386.82
2回目 80.89 6.91 532.83 394.17
3回目 80.15 6.83 559.98 403.73
4回目 81.76 6.95 527.91 386.09
5回目 80.55 7.17 548.08 387.12
3点平均 80.53 7.01 536.27 389.37
Requests per second
ab -n 1500 -c 150
fast_hello.pl nicky.cgi改 hello.html nicky.html
1回目 73.97 6.97 531.91 390.80
2回目 74.34 6.50 546.51 392.37
3回目 74.77 6.94 528.98 393.63
4回目 73.94 6.52 520.37 392.40
5回目 73.49 6.96 541.37 387.22
3点平均 74.08 6.81 534.09 391.86
Requests per second
0405402
2006/07/02(日) 03:33:58ID:???fast_hello.pl nicky.cgi改 hello.html nicky.html
1回目 72.94 6.76 508.09 387.18
2回目 72.54 6.75 519.62 387.63
3回目 72.72 6.77 517.59 383.83
4回目 72.96 6.43 528.62 381.39
5回目 72.59 6.27 509.80 388.59
3点平均 72.75 6.65 515.67 386.21
Requests per second
0406402
2006/07/02(日) 03:38:35ID:???lighttpd
hell world、nicky.cgi改
fast_hello.pl nicky.cgi改 hello.html nicky.html
ab -n 10 -c 1 81.18 7.53 425.63 293.40
ab -n 100 -c 10 81.17 7.43 561.63 396.52
ab -n 200 -c 20 79.96 7.46 534.53 395.08
ab -n 400 -c 40 80.99 7.38 531.22 387.10
ab -n 1000 -c 100 80.53 7.01 536.27 389.37
ab -n 1500 -c 150 74.08 6.81 534.09 391.86
ab -n 2000 -c 200 72.75 6.65 515.67 386.21
Requests per second
0407402
2006/07/02(日) 03:39:08ID:???0408nobodyさん
2006/07/02(日) 03:41:42ID:???メモリ食うからpreforkだと起動コストが高くなるってだけ。workerにすればmod_perlが最速。
・・・だといいな。
0409nobodyさん
2006/07/02(日) 06:47:26ID:rDIMAYNl0410nobodyさん
2006/07/02(日) 06:48:00ID:rDIMAYNl禿げ上がるほど乙です!!! >>407
0411nobodyさん
2006/07/02(日) 10:25:42ID:???お疲れ様でした。
lighttpdの静的コンテンツの出力は、噂通りに速いですね。
ただ、FastCGIのhelloWorldな動的コンテンツでは、Apacheの方が速い。
でも、この差はソースが大きくなると見えなくなるので、実質問題にならない
差ですね。
RoR界隈では、lighttpd+FastCGIが流行っている様ですが、動的コンテンツ
の速度はApacheとほとんど同じだけど、静的コンテンツの速度が速いので
トータルで速くなると言う事なのか、インストールが簡単なのか、それとも他
の理由があるのか、どうなんでしょう。
ところで、lighttpdは、普通のcgiは出来ないんでしょうか?
0412402
2006/07/02(日) 11:51:36ID:???lighttpdは普通のcgiもできます。
測定しなかったのは興味がなかったのと、遅いので時間がかかるのがいやというだけです。
ちょっとワガママが入ってます。
0415nobodyさん
2006/07/02(日) 15:51:41ID:???0416nobodyさん
2006/07/02(日) 16:01:25ID:???0417nobodyさん
NGNG0418nobodyさん
2006/07/02(日) 16:46:53ID:???0419nobodyさん
2006/07/02(日) 18:19:12ID:???クライアントの差が出るとすると、-c 1 より -c 10 の方が高い成績を出している
l静的コンテンツ取得の所位じゃない?
リクエストの応答を受けてから、次のリクエストまでの時間を多少稼げる。
ただ、動的コンテンツ取得については、さほど意味のある値ではないと思う。
0420402
2006/07/02(日) 20:18:01ID:???すいません。
急用で外出していました。
測定条件の記入漏れです。
localhostで測定しています。
つまり、サーバーマシン=クライアントマシンです。
0421nobodyさん
2006/07/02(日) 20:37:17ID:???まあ、簡易に測定する場合は同一マシンでやっちゃうこともあるけど。
0422nobodyさん
2006/07/02(日) 21:00:23ID:???0423402
2006/07/02(日) 21:05:35ID:???まずかったかな。
0424402
2006/07/02(日) 21:18:01ID:???どのみちベンチは個々の環境に左右されるので。
後、もう少し待ってください。
lighttpdのSpeedyCGIとCGIのベンチ終わります。
0425nobodyさん
2006/07/02(日) 21:32:03ID:???マシンの性能計ってるわけじゃないし
0426nobodyさん
2006/07/02(日) 22:04:59ID:???0427nobodyさん
2006/07/02(日) 22:13:04ID:???0428nobodyさん
2006/07/02(日) 22:15:55ID:???0429nobodyさん
2006/07/02(日) 22:20:09ID:???512MB
Vine3.2最小インストール+コンパイル環境
+lighttpd-1.4.11ソース+fcgi-2.4.0ソース
テストソース
S hello world(>367-368)
L nicky.cgi改
以下、結果報告。
0430429
2006/07/02(日) 22:23:16ID:???CGI S CGI L SpeedyCGI S SpeedyCGI L
1回目 29.65 0.46 34.28 2.37
2回目 29.65 0.46 40.63 7.34
3回目 29.64 0.46 42.76 7.34
4回目 29.64 0.46 42.71 7.35
5回目 29.49 0.46 42.47 7.36
3点平均 29.64 0.46 41.94 7.34
Requests per second
ab -n 100 -c 10
CGI S CGI L SpeedyCGI S SpeedyCGI L
1回目 27.93 0.45 39.92 5.53
2回目 28.49 ABORT 40.25 6.87
3回目 27.07 0.45 38.74 6.85
4回目 27.88 0.45 41.55 6.76
5回目 27.55 0.45 39.25 6.72
3点平均 27.79 0.45 39.81 6.78
Requests per second
ab -n 200 -c 20
CGI S CGI L SpeedyCGI S SpeedyCGI L
1回目 27.83 ABORT 38.94 5.63
2回目 29.22 ABORT 40.63 6.58
3回目 27.79 ABORT 39.02 6.82
4回目 28.04 ABORT 40.86 6.96
5回目 28.65 ABORT 37.50 6.69
3点平均 28.17 #DIV/0! 39.53 6.70
Requests per second
■ このスレッドは過去ログ倉庫に格納されています