| queryperf | ||||
| BINDに付属している、DNSのパフォーマンスを測定するツール | ||||
| 指定のDNSサーバに対して大量のDNS問い合わせを投げて、その応答時間や処理数を測定する | ||||
| (検証環境: CentOS5.4 , bind-9.6-ESV-R4-P1、またはsolaris10、bind-9.4-ESV-R4-P1) | ||||
| queryperfのインストール | ||||
| queryperfは、解凍したbindのcontrib/queryperfディレクトリに用意されている | ||||
| make installはない | ||||
| セキュリティ上、rootだけがqueryperfを使用できるようにする (個人的な考え) | ||||
| /usr/local/bin以下に、シンボリックリンクを作成 (個人的な考え) | ||||
| # cd /usr/local/src/bind-9.6-ESV-R4-P1/contrib/queryperf/ | 解凍したbind内の、contrib/queryperfディレクトリへ移動 | |||
| # ./configure | 一般ユーザで実施するとqueryperfの所有者が一般ユーザに | |||
| checking for gcc... gcc | なるのでrootで実施 | |||
| checking for C compiler default output file name... a.out | ||||
| checking whether the C compiler works... yes | ||||
| checking whether we are cross compiling... no | ||||
| checking for suffix of executables... | ||||
| checking for suffix of object files... o | ||||
| checking whether we are using the GNU C compiler... yes | ||||
| checking whether gcc accepts -g... yes | ||||
| checking for gcc option to accept ISO C89... none needed | ||||
| checking for library containing res_mkquery... -lresolv | ||||
| checking for library containing __res_mkquery... none required | ||||
| checking for socket in -lsocket... no | ||||
| checking for inet_ntoa in -lnsl... yes | ||||
| checking for gethostbyname2... yes | ||||
| checking for getaddrinfo... yes | ||||
| checking for getnameinfo... yes | ||||
| checking for socklen_t... yes | ||||
| checking for sa_len... no | ||||
| configure: creating ./config.status | ||||
| config.status: creating Makefile | ||||
| config.status: creating config.h | ||||
| # make | make 実行 | |||
| gcc -DHAVE_CONFIG_H -c queryperf.c | queryperf実行ファイルが生成される | |||
| gcc -DHAVE_CONFIG_H queryperf.o -lnsl -lresolv -lm -o queryperf | ||||
| # ls -l queryperf | queryperfのアクセス権をrootのみに変更する | |||
| -rwxr-xr-x 1 root root 34131 7月 11 10:16 queryperf | (一般ユーザが使用できないようにする) | |||
| # chmod 500 queryperf | ||||
| # ls -l queryperf | ||||
| -r-x------ 1 root root 34131 7月 11 10:16 queryperf | ||||
| # cd /usr/local/bin | /usr/local/bin配下にシンボリックリンクを作成 | |||
| (コピーだと実体が複数作られて管理しにくいと判断し、 | ||||
| # ln -s /usr/local/src/bind-9.6-ESV-R4-P1/contrib/queryperf/queryperf queryperf | シンボリックリンクとした) | |||
| # ls -l /usr/local/bin/queryperf | ||||
| lrwxrwxrwx 1 root root 80 7月 11 10:24 /usr/local/bin/queryperf -> \ | ||||
| /usr/local/src/bind-9.6-ESV-R4-P1/contrib/queryperf/queryperf | ||||
| # which queryperf | パスが通っていることを確認 | |||
| /usr/local/bin/queryperf | ||||
| queryperfの利用方法 | ||||
| 注意1: 自分が管理していないDNSサーバに対してqueryperfを行わないこと | ||||
| 注意2: 再帰問い合わせを許可している場合は、問い合わせ対象のサーバが保持しているゾーン情報以外の登録はしないこと | ||||
| いずれも、大量のDNS問い合わせが外部のDNSに投げられるため | ||||
| @ 問い合わせ対象を登録したファイルの作成 | ||||
| queryperfコマンド実行時に指定する、問い合わせ対象のレコードを登録したファイルを作成する | ||||
| [ 書式 ] | ||||
| 問い合わせ対象 レコードの種類 | ||||
| [ 設定例 ] | ||||
| # cd /tmp | /tmp内に作成することにした | |||
| # vi queryperf-test-target.txt | とりあえず4つ | |||
| example.co.jp soa | すべてローカルサーバが権威となっているもの | |||
| example.co.jp ns | ||||
| www.example.co.jp a | ||||
| mx1.example.co.jp a | ||||
| A queryperfの実施 | ||||
| queryperfの結果に対するベンチマークは特にないので、何かある度に測定しておくことが望ましい | ||||
| 今回の検証で使用した筐体は、CPUがPentium III 1000MHz、メモリ512MBのノートPC | ||||
| 測定時間が短すぎると信頼性も低いので、1分以上が望ましい できればCPU負荷のある時間帯に行うことが望ましい(個人的な検証結果より) | ||||
| 問い合わせるレコードが多いほど、信頼性は高い | ||||
| [ 書式 ] | ||||
| queryperf オプション [ オプション ] | ||||
| [ オプション ] その他のオプションの確認は、queryperf -h | ||||
| -d 問い合わせ対象を登録したファイル | ||||
| -s 対象のDNSサーバ | 省略時は、127.0.0.1 | |||
| -l 測定時間 | 省略時は、1回 | |||
| -v | 問い合わせ結果を出力 省略時は出力しない | |||
| -e | EDNS0を有効にする 省略時は無効 | |||
| -D | DNSSECによる問い合わせを実施 省略時は実施しない | |||
| [ 設定例 ] | ||||
| # queryperf -d /tmp/queryperf-test-target.txt -s 127.0.0.1 -l 5 | ローカルのDNSサーバを対象に5秒間実施 | |||
| DNS Query Performance Testing Tool | ||||
| Version: $Id: queryperf.c,v 1.12 2007-09-05 07:36:04 marka Exp $ | ||||
| [Status] Processing input data | ||||
| [Status] Sending queries (beginning with 127.0.0.1) | ||||
| [Status] Testing complete | ||||
| Statistics: | ||||
| Parse input file: multiple times | ||||
| Run time limit: 5 seconds | 送信時間 | |||
| Ran through file: 4065 times | ||||
| Queries sent: 16261 queries | クエリーの送信回数 | |||
| Queries completed: 16261 queries | 応答のあったクエリー数 | |||
| Queries lost: 0 queries | 応答が無かったクエリー数 | |||
| Queries delayed(?): 0 queries | 応答に遅延のあったクエリー数 | |||
| RTT max: 2.144678 sec | 応答時間 | |||
| RTT min: 0.001618 sec | ||||
| RTT average: 0.008604 sec | ||||
| RTT std deviation: 0.073983 sec | ||||
| RTT out of range: 0 queries | ||||
| Percentage completed: 100.00% | クエリーに対する応答率 100%でない場合は何らかの問題あり | |||
| Percentage lost: 0.00% | ||||
| Started at: Mon Jul 11 10:30:36 2011 | ||||
| Finished at: Mon Jul 11 10:30:43 2011 | ||||
| Ran for: 7.140166 seconds | 測定にかかった時間 | |||
| Queries per second: 2277.398032 qps | 1秒あたりのクエリー数 | |||
| = クエリーの送信回数 / Ran Forの時間(秒) | ||||
| # queryperf -d /tmp/queryperf-test-target.txt -s 127.0.0.1 -l 10 | 測定時間を10秒に変えた場合 | |||
| (省略) | ||||
| Queries per second: 3165.600567 qps | ||||
| # queryperf -d /tmp/queryperf-test-target.txt -s 127.0.0.1 -l 60 | 測定時間を60秒に変えた場合 | |||
| (省略) | ||||
| Queries per second: 3724.763111 qps | ||||
| # queryperf -d /tmp/queryperf-test-target.txt -s 127.0.0.1 -l 600 | 測定時間を600秒に変えた場合 | |||
| (省略) | ||||
| Queries per second: 3317.599231 qps | ||||
| # queryperf -d /tmp/test.txt -s 192.168.24.60 -l 60 | ローカルネット上にあるSunFireV120サーバ(solaris10) | |||
| (省略) | からこのPCに対してqueryperfを実施した場合 | |||
| Queries per second: 3730.917999 qps | ||||
| # queryperf -d /tmp/queryperf-test-target.txt -s 127.0.0.1 -l 10 -v | -vオプションをつけた場合 | |||
| DNS Query Performance Testing Tool | ||||
| Version: $Id: queryperf.c,v 1.12 2007-09-05 07:36:04 marka Exp $ | ||||
| [Status] Processing input data | ||||
| [Status] Sending queries (beginning with 127.0.0.1) | ||||
| > NOERROR example.co.jp soa | -vオプションをつけると、問い合わせ結果が大量に出力されるので注意 | |||
| > NOERROR example.co.jp ns | ||||
| > NOERROR www.example.co.jp a | ||||
| > NOERROR mx1.example.co.jp a | ||||
| > NOERROR example.co.jp soa | ||||
| > NOERROR example.co.jp ns | ||||
| > NOERROR www.example.co.jp a | ||||
| (省略) | ||||