HTTP/HTTPS(サーバ認証/クライアント認証)の比較
作業中に気になったのでメモ。
環境
CPU | Intel Pentium D 830 |
Mem | 1024MB |
OS | CentOS 5.3 x86 (Kernel 2.6.18) |
HTTPd | Apache 2.2.3 |
httpd.confは基本的にはデフォルトのまま。
測定方法
テストデータを次のようにして作成しておく。
dd if=/dev/urandom of=1kB.dat bs=1 count=1024
このファイルに対して、クライアント側から次のようなスクリプトを使って1000回のリクエストを行う。
#!/bin/bash # execute command # # plain HTTP #exec_cmd="wget http://example.com/1kB.dat -O /dev/null -o /dev/null" # # HTTPS / Server auth #exec_cmd="wget --ca-certificate cacert.pem https://example.com/1kB.dat -O /dev/null -o /dev/null" # # HTTPS / Client-Server auth #exec_cmd="wget --ca-certificate cacert.pem --certificate=client.crt --private-key=client.key https://example.com/1kB.dat -O /dev/null -o /dev/null" # try 1000 times for i in {1000..1} do $exec_cmd done
このファイルを timeコマンドで計測する
$ /usr/bin/time -f %E ./bench_cauth.sh
素のHTTPの場合
1st | 0:06.84 |
2nd | 0:06.81 |
3rd | 0:06.86 |
平均6.84秒なので、0.00684秒/request = 6.84ms/req