まず、「apache(素) vs mod_proxy vs squid」と大げさなのですが、リバースプロキシをつかって、単純に静的コンテンツ(画像)を返すのは、どれが速い?また、そのついでにapache(素)も測定しました。
測定内容
2台しかマシンの調達ができなかったので・・・
apche(素)として、1台にApache2.0をインストール、
mod_proxy(Apache2.0)、squid2.6は、Xen上にゲストOSを2ついれてそれぞれにインストールしました。OSは、すべてCentOS5.0です。(Xenは簡単に導入できました。)
そして、apache(素)の、有るディレクトリに画像(約3K)を 15,000個配置しました。
また、 mod_proxy、squidは、すべてapache(素)にリクエストを飛ばすように設定しました。
測定方法ですが、 「Web Application Stress Tool」を使用して、以下のパターンで
5,000のユニークなリクエストに対する計測を2回づつ行いました。
- apache(素)
- mod_proxy(ディスクキャッシュ)
- mod_proxy(メモリキャッシュ)
- squid(デフォルト ストアタイプufs)
- squid(ストアタイプcoss)
測定結果
まず、「Number of hits」に着目して下さい。
TOOLのテスト時間を1秒としたので、各リクエストの内、1秒以内で返ってきたものが、この項目にカウントされています。(たぶん)
当たり前ですが、 mod_proxy、squidは、2回目は、キャッシュされたものを表示しているため数値が増えています。
mod_proxyに関しては、ディスク、メモリキャッシュともあまり変わりません。これは画像が、キャッシュされているためです。(メモリ、ディスクのキャッシュの比較はこちら)
squidは、cossは速いです。ページキャッシュに乗っかっているのでメモリキャッシュよりも良い結果が出ています。
また、デフォルトのストアタイプは、mod_proxyのディスクキャッシュとかわりません。 キャッシュが、1オブジェクトが1ファイルという事からくるのでしょう。
今回、apche(素)そのなのとおり、素なのですが、「mod_cache」をつかえばmod_proxy程度の結果は出るでしょう。互いの用途は違ってくるとは思いますが。
負荷をもっとかければ、差が顕著に現れると思います。
●1 – 1回目
Web Application Stress Tool Version:1.1.293.1
Number of test clients: 1
Number of hits: 3069
Requests per Second: 51.15
Socket Statistics
——————————————————————————–
Socket Connects: 3070
Total Bytes Sent (in KB): 709.51
Bytes Sent Rate (in KB/s): 11.83
Total Bytes Recv (in KB): 10505.62
Bytes Recv Rate (in KB/s): 175.09
●1 – 2回目
=======================================================
Web Application Stress Tool Version:1.1.293.1
Number of test clients: 1
Number of hits: 3018
Requests per Second: 50.30
Socket Statistics
——————————————————————————–
Socket Connects: 3019
Total Bytes Sent (in KB): 697.70
Bytes Sent Rate (in KB/s): 11.63
Total Bytes Recv (in KB): 10332.77
Bytes Recv Rate (in KB/s): 172.22
●2 – 1回目
=======================================================
Web Application Stress Tool Version:1.1.293.1
Number of test clients: 1
Number of hits: 2936
Requests per Second: 48.94
Socket Statistics
——————————————————————————–
Socket Connects: 2937
Total Bytes Sent (in KB): 678.73
Bytes Sent Rate (in KB/s): 11.31
Total Bytes Recv (in KB): 10169.93
Bytes Recv Rate (in KB/s): 169.53
●2 – 2回目
=======================================================
Web Application Stress Tool Version:1.1.293.1
Number of test clients: 1
Number of hits: 3283
Requests per Second: 54.72
Socket Statistics
——————————————————————————–
Socket Connects: 3284
Total Bytes Sent (in KB): 759.04
Bytes Sent Rate (in KB/s): 12.65
Total Bytes Recv (in KB): 11429.63
Bytes Recv Rate (in KB/s): 190.51
●3 – 1回目
=======================================================
Web Application Stress Tool Version:1.1.293.1
Number of test clients: 1
Number of hits: 3022
Requests per Second: 50.38
Socket Statistics
——————————————————————————–
Socket Connects: 3023
Total Bytes Sent (in KB): 698.63
Bytes Sent Rate (in KB/s): 11.65
Total Bytes Recv (in KB): 10464.28
Bytes Recv Rate (in KB/s): 174.44
●3 – 2回目
=======================================================
Web Application Stress Tool Version:1.1.293.1
Number of test clients: 1
Number of hits: 3273
Requests per Second: 54.56
Socket Statistics
——————————————————————————–
Socket Connects: 3274
Total Bytes Sent (in KB): 756.72
Bytes Sent Rate (in KB/s): 12.62
Total Bytes Recv (in KB): 11543.46
Bytes Recv Rate (in KB/s): 192.44
●4 – 1回目
=======================================================
Web Application Stress Tool Version:1.1.293.1
Number of test clients: 1
Number of hits: 2997
Requests per Second: 49.96
Socket Statistics
——————————————————————————–
Socket Connects: 2998
Total Bytes Sent (in KB): 692.84
Bytes Sent Rate (in KB/s): 11.55
Total Bytes Recv (in KB): 10627.54
Bytes Recv Rate (in KB/s): 177.17
●4 – 2回目
=======================================================
Web Application Stress Tool Version:1.1.293.1
Number of test clients: 1
Number of hits: 3294
Requests per Second: 54.90
Socket Statistics
——————————————————————————–
Socket Connects: 3295
Total Bytes Sent (in KB): 761.58
Bytes Sent Rate (in KB/s): 12.69
Total Bytes Recv (in KB): 11692.82
Bytes Recv Rate (in KB/s): 194.89
●5 – 1回目
=======================================================
Web Application Stress Tool Version:1.1.293.1
Number of test clients: 1
Number of hits: 3043
Requests per Second: 50.72
Socket Statistics
——————————————————————————–
Socket Connects: 3044
Total Bytes Sent (in KB): 703.49
Bytes Sent Rate (in KB/s): 11.73
Total Bytes Recv (in KB): 10788.85[/JAVA][/CODE][/XML]
Bytes Recv Rate (in KB/s): 179.84
●5 – 2回目 =======================================================
Web Application Stress Tool Version:1.1.293.1
Number of test clients: 1
Number of hits: 3410
Requests per Second: 56.85
Socket Statistics
——————————————————————————–
Socket Connects: 3411
Total Bytes Sent (in KB): 788.43
Bytes Sent Rate (in KB/s): 13.14
Total Bytes Recv (in KB): 12099.63
Bytes Recv Rate (in KB/s): 201.71




