| 1 |
.. -*- rst -*- |
| 2 |
|
| 3 |
.. program:: groonga-benchmark |
| 4 |
|
| 5 |
groonga-benchmark |
| 6 |
================= |
| 7 |
|
| 8 |
名前 |
| 9 |
---- |
| 10 |
|
| 11 |
groonga-benchmark - groongaテストプログラム |
| 12 |
|
| 13 |
書式 |
| 14 |
---- |
| 15 |
|
| 16 |
:: |
| 17 |
|
| 18 |
groonga-benchmark [options...] [script] [db] |
| 19 |
|
| 20 |
説明 |
| 21 |
---- |
| 22 |
|
| 23 |
groonga-benchmarkは、groonga汎用ベンチマークツールです。 |
| 24 |
|
| 25 |
groongaを単独のプロセスとして利用する場合はもちろん、サーバプログラムとして利用する場合の動作確認や実行速度測定が可能です。 |
| 26 |
|
| 27 |
groonga-benchmark用のデータファイルは自分で作成することも既存のものを利用することもできます。既存のデータファイルは、ftp.groonga.orgから必要に応じダウンロードします。そのため、groonga及びgroonga-benchmarkが動作し、インターネットに接続できる環境であればgroongaコマンドの知識がなくてもgroongaの動作を確認できます。 |
| 28 |
|
| 29 |
現在は、Linux 及びWindows上で動作します。make installしてもインストールは行われません。 |
| 30 |
|
| 31 |
オプション |
| 32 |
---------- |
| 33 |
.. option:: -i, --host <ip/hostname> |
| 34 |
|
| 35 |
接続するgroongaサーバを、ipアドレスまたはホスト名で指定します。指定先にgroongaサーバが立ち上がっていない場合、接続不能となることに注意してください。このオプションを指定しない場合、groonga-benchmarkは自動的にlocalhostのgroongaサーバを起動して接続します。 |
| 36 |
|
| 37 |
|
| 38 |
.. option:: -p, --port <port number> |
| 39 |
|
| 40 |
自動的に起動するgroongaサーバ、または明示的に指定した接続先のgroonga サーバが利用するポート番号を指定します。接続先のgroongaサーバが利用しているポートと、このオプションで指定したポート番号が異なる場合、接続不能となることに注意してください。 |
| 41 |
|
| 42 |
|
| 43 |
.. option:: --dir |
| 44 |
|
| 45 |
ftp.groonga.org に用意されているスクリプトファイルを表示します。 |
| 46 |
|
| 47 |
.. option:: --ftp |
| 48 |
|
| 49 |
ftp.groonga.orgとFTP通信を行い、scriptファイルの同期やログファイルの送信を行います。 |
| 50 |
|
| 51 |
.. option:: --log-output-dir |
| 52 |
|
| 53 |
デフォルトでは、groonga-benchmark終了後のログファイルの出力先ははカレントディレクトリです。このオプションを利用すると、任意のディレクトリに出力先を変更することができます。 |
| 54 |
|
| 55 |
.. option:: --groonga <groonga_path> |
| 56 |
|
| 57 |
groongaコマンドのパスを指定します。デフォルトでは、PATHの中からgroongaコマンドを探します。 |
| 58 |
|
| 59 |
.. option:: --protocol <gqtp|http> |
| 60 |
|
| 61 |
groongaコマンドが使うプロトコルとして `gqtp` または `http` を指定します。 |
| 62 |
|
| 63 |
引数 |
| 64 |
---- |
| 65 |
|
| 66 |
.. option:: script |
| 67 |
|
| 68 |
groonga-benchmarkの動作方法(以下、groonga-benchmark命令と呼びます)を記述したテキストファイルです。拡張子は.scrです。 |
| 69 |
|
| 70 |
.. option:: db |
| 71 |
|
| 72 |
groonga-benchmarkが利用するgroonga データベースです。指定されたデータベースが存在しない場合、groonga-benchmarkが新規に作成します。またgroonga サーバを自動的に起動する場合もこの引数で指定したデータベースが利用されます。接続するgroonga サーバを明示的に指定した場合に利用するデータベースは、接続先サーバが使用中のデータベースになることに注意してください。 |
| 73 |
|
| 74 |
|
| 75 |
使い方 |
| 76 |
------ |
| 77 |
まず、シェル上(Windowsならコマンドプロンプト上)で:: |
| 78 |
|
| 79 |
groonga-benchmark test.scr 任意のDB名 |
| 80 |
|
| 81 |
とタイプしてください。もしgroonga-benchmarkが正常に動作すれば、:: |
| 82 |
|
| 83 |
test-ユーザ名-数字.log |
| 84 |
|
| 85 |
というファイルが作成されるはずです。作成されない場合、このドキュメントの「トラブルシューティング」の章を参照してください。 |
| 86 |
|
| 87 |
|
| 88 |
スクリプトファイル |
| 89 |
------------------ |
| 90 |
|
| 91 |
スクリプトファイルは、groonga-benchmark命令を記述したテキストファイルです。 |
| 92 |
";"セミコロンを利用して、一行に複数のgroonga-benchmark命令を記述することができます。一行に複数のgroonga-benchmark命令がある場合、各命令は並列に実行されます。 |
| 93 |
"#"で始まる行はコメントとして扱われます。 |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
groonga-benchmark命令 |
| 98 |
^^^^^^^^^^^^^^^^^^^^^ |
| 99 |
|
| 100 |
現在サポートされているgroonga-benchmark命令は以下の11種類です。 |
| 101 |
|
| 102 |
do_local コマンドファイル [スレッド数] [繰り返し数] |
| 103 |
|
| 104 |
コマンドファイルをgroonga-benchmark単体で実行します。スレッド数が指定されている場合、複数のスレッドで同じコマンドファイルを同時に実行します。繰り返し数が指定されてい場合、コマンドファイルの内容を繰り返し実行します。スレッド数、繰り返し数とも省略時は1です。1スレッドで複数回動作させたい場合は、do_local コマンドファイル 1 [繰り返し数]と明示的に指定してください。 |
| 105 |
|
| 106 |
do_gqpt コマンドファイル [スレッド数] [繰り返し数] |
| 107 |
|
| 108 |
コマンドファイルをgroongaサーバでGQTP経由で実行します。スレッド数や繰り返し数の意味はdo_localの場合と同じです。 |
| 109 |
|
| 110 |
do_http コマンドファイル [スレッド数] [繰り返し数] |
| 111 |
|
| 112 |
コマンドファイルをgroongaサーバでHTTP経由で実行します。スレッド数や繰り返し数の意味はdo_localの場合と同じです。 |
| 113 |
|
| 114 |
rep_local コマンドファイル [スレッド数] [繰り返し数] |
| 115 |
|
| 116 |
コマンドファイルをgroonga-benchmark単体で実行し、より詳細な報告を行います。 |
| 117 |
|
| 118 |
rep_gqpt コマンドファイル [スレッド数] [繰り返し数] |
| 119 |
|
| 120 |
コマンドファイルをgroongaサーバでGQTP経由で実行し、より詳細な報告を行います。 スレッド数や繰り返し数の意味はdo_localと 同じです。 |
| 121 |
|
| 122 |
rep_http コマンドファイル [スレッド数] [繰り返し数] |
| 123 |
|
| 124 |
コマンドファイルをgroongaサーバでHTTP経由で実行し、より詳細な報告を行います。 スレッド数や繰り返し数の意味はdo_localと 同じです。 |
| 125 |
|
| 126 |
out_local コマンドファイル 入力ファイル名 |
| 127 |
|
| 128 |
コマンドファイルをgroonga-benchmark単体で実行し、各コマンドの実行結果をすべて”出力ファイル"に書きだします。この結果は、test_local, test_gqtp命令で利用します。なおこの命令の「出力ファイル」とは、groonga-benchmark実行時に自動的に作成されるログとは別のものです。groonga-benchmarkではコメントが利用できる以外、:: |
| 129 |
|
| 130 |
groonga < コマンドファイル > 出力ファイル |
| 131 |
|
| 132 |
とした場合と同じです。 |
| 133 |
|
| 134 |
out_gqtp コマンドファイル 出力ファイル名 |
| 135 |
|
| 136 |
コマンドファイルをgroongaサーバでGQTP経由で実行します。その他はout_local命令と同等です。 |
| 137 |
|
| 138 |
out_http コマンドファイル 出力ファイル名 |
| 139 |
|
| 140 |
コマンドファイルをgroongaサーバでHTTP経由で実行します。その他はout_local命令と同等です。 |
| 141 |
|
| 142 |
test_local コマンドファイル 入力ファイル名 |
| 143 |
コマンドファイルをgroonga-benchmark単体で実行し、各コマンドの実行結果を入力ファイルと比較します。処理時間など本質的要素以外に差分があった場合、差分を、入力ファイル.diffというファイルに書きだします。 |
| 144 |
|
| 145 |
|
| 146 |
コマンドファイル |
| 147 |
^^^^^^^^^^^^^^^^ |
| 148 |
|
| 149 |
コマンドファイルは、groonga組み込みコマンドを1行に1つずつ記述したテキストファイルです。拡張子に制限はありません。groonga組み込みコマンドに関しては :doc:`/reference/command` を参照してください。 |
| 150 |
|
| 151 |
サンプル |
| 152 |
^^^^^^^^ |
| 153 |
|
| 154 |
スクリプトファイルのサンプルです。:: |
| 155 |
|
| 156 |
# sample script |
| 157 |
rep_local test.ddl |
| 158 |
do_local test.load; |
| 159 |
do_gqtp test.select 10 10; do_local test.status 10 |
| 160 |
|
| 161 |
|
| 162 |
上記の意味は以下のとおりです。 |
| 163 |
|
| 164 |
1行目 |
| 165 |
コメント行。 |
| 166 |
2行目 |
| 167 |
test.ddl というコマンドファイルをgroonga単体で実行し、詳細に報告する。 |
| 168 |
3行目 |
| 169 |
test.load というコマンドファイルをgroonga単体で実行する。(最後の";"セミコロンは複数のgroonga-benchmark命令を記述する場合に必要ですが、この例のように1つのgroonga-benchmark命令を実行する場合に付与しても問題ありません。) |
| 170 |
4行目 |
| 171 |
test.select というコマンドファイルをgroongaサーバで10個のスレッドで同時に実行する。各スレッドはtest.selectの中身を10回繰り返す。また同時に、groonga単体でtest.statusというコマンドファイルを10個のスレッドで実行する。 |
| 172 |
|
| 173 |
特殊命令 |
| 174 |
^^^^^^^^ |
| 175 |
|
| 176 |
スクリプトファイルのコメント行には特殊コマンドを埋め込むことが可能です。現在サポートされている特殊命令は以下の二つです。 |
| 177 |
|
| 178 |
#SET_HOST <ip/hostname> |
| 179 |
-i, --hostオプションと同等の機能です。コマンドラインオプションに指定したIPアドレス/ホスト名と、SET_HOSTで指定したIPアドレス/ホスト名が異なる場合、またコマンドラインオプションを指定しなかった場合にもSET_HOSTが優先されます。SET_HOSTを利用した場合、サーバが自動的には起動されないのもコマンドラインオプションで指定した場合と同様です。 |
| 180 |
|
| 181 |
#SET_PORT <port number> |
| 182 |
-p, --port オプションと同等の機能です。コマンドラインオプションに指定したポート番号とSET_PORTで指定したポート番号が異なる場合、またコマンドラインオプションを指定しなかった場合にもSET_PORTが優先されます。 |
| 183 |
|
| 184 |
|
| 185 |
特殊命令はスクリプトファイルの任意の場所に書き込むことができます。同一ファイル内に複数回特殊命令を記述した場合、「最後の」特殊命令が有効となります。 |
| 186 |
|
| 187 |
例えば、 |
| 188 |
|
| 189 |
:: |
| 190 |
|
| 191 |
$ ./groonga-benchmark --port 20010 test.scr testdb |
| 192 |
|
| 193 |
とコマンド上でポートを指定した場合でも、もしtest.scrの中身が |
| 194 |
|
| 195 |
:: |
| 196 |
|
| 197 |
#SET_PORT 10900 |
| 198 |
rep_local test.ddl |
| 199 |
do_local test.load; |
| 200 |
rep_gqtp test.select 10 10; rep_local test.status 10 |
| 201 |
#SET_PORT 10400 |
| 202 |
|
| 203 |
であれば、自動的に起動されるgroongaサーバはポート番号10400を利用します。 |
| 204 |
|
| 205 |
|
| 206 |
groonga-benchmark実行結果 |
| 207 |
------------------------- |
| 208 |
|
| 209 |
groonga-benchmarkが正常に終了すると、(拡張子を除いた)スクリプト名-ユーザ名-実行開始時刻.logという形式のログファイルがカレントディレクトリに作られます。ログファイルは自動的にftp.groonga.org |
| 210 |
に送信されます。ログファイルは以下のようなjson形式のテキストです。 |
| 211 |
|
| 212 |
:: |
| 213 |
|
| 214 |
[{"script": "test.scr", |
| 215 |
"user": "homepage", |
| 216 |
"date": "2010-04-14 22:47:04", |
| 217 |
"CPU": Intel(R) Pentium(R) 4 CPU 2.80GHz", |
| 218 |
"BIT": 32, |
| 219 |
"CORE": 1, |
| 220 |
"RAM": "975MBytes", |
| 221 |
"HDD": "257662232KBytes", |
| 222 |
"OS": "Linux 2.4.20-24.7-i686", |
| 223 |
"HOST": "localhost", |
| 224 |
"PORT": "10041", |
| 225 |
"VERSION": "0.1.8-100-ga54c5f8" |
| 226 |
}, |
| 227 |
{"jobs": "rep_local test.ddl", |
| 228 |
"detail": [ |
| 229 |
[0, "table_create res_table --key_type ShortText", 1490, 3086, [0,1271252824.25846,0.00144 |
| 230 |
7]], |
| 231 |
[0, "column_create res_table res_column --type Text", 3137, 5956, [0,1271252824.2601,0.002 |
| 232 |
741]], |
| 233 |
[0, "column_create res_table user_column --type Text", 6020, 8935, [0,1271252824.26298,0.0 |
| 234 |
02841]], |
| 235 |
[0, "column_create res_table mail_column --type Text", 8990, 11925, [0,1271252824.26595,0. |
| 236 |
002861]], |
| 237 |
[0, "column_create res_table time_column --type Time", 12008, 13192, [0,1271252824.26897,0 |
| 238 |
.001147]], |
| 239 |
[0, "status", 13214, 13277, [0,1271252824.27018,3.0e-05]], |
| 240 |
[0, "table_create thread_table --key_type ShortText", 13289, 14541, [0,1271252824.27025,0. |
| 241 |
001213]], |
| 242 |
[0, "column_create thread_table thread_title_column --type ShortText", 14570, 17380, [0,12 |
| 243 |
71252824.27153,0.002741]], |
| 244 |
[0, "status", 17435, 17480, [0,1271252824.2744,2.7e-05]], |
| 245 |
[0, "table_create lexicon_table --flags 129 --key_type ShortText --default_tokenizer Token |
| 246 |
Bigram", 17491, 18970, [0,1271252824.27446,0.001431]], |
| 247 |
[0, "column_create lexicon_table inv_res_column 514 res_table res_column ", 18998, 33248, |
| 248 |
[0,1271252824.27596,0.01418]], |
| 249 |
[0, "column_create lexicon_table inv_thread_column 514 thread_table thread_title_column ", |
| 250 |
33285, 48472, [0,1271252824.29025,0.015119]], |
| 251 |
[0, "status", 48509, 48554, [0,1271252824.30547,2.7e-05]]], |
| 252 |
"summary" :[{"job": "rep_local test.ddl", "latency": 48607, "self": 47719, "qps": 272.4281 |
| 253 |
73, "min": 45, "max": 15187, "queries": 13}]}, |
| 254 |
{"jobs": "do_local test.load; ", |
| 255 |
"summary" :[{"job": "do_local test.load", "latency": 68693, "self": 19801, "qps": 1010.049 |
| 256 |
997, "min": 202, "max": 5453, "queries": 20}]}, |
| 257 |
{"jobs": "do_gqtp test.select 10 10; do_local test.status 10", |
| 258 |
"summary" :[{"job": " do_local test.status 10", "latency": 805990, "self": 737014, "qps": |
| 259 |
54.273053, "min": 24, "max": 218, "queries": 40},{"job": "do_gqtp test.select 10 10", "lat |
| 260 |
ency": 831495, "self": 762519, "qps": 1967.164097, "min": 73, "max": 135631, "queries": 15 |
| 261 |
00}]}, |
| 262 |
{"total": 915408, "qps": 1718.359464, "queries": 1573}] |
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
制限事項 |
| 267 |
-------- |
| 268 |
|
| 269 |
* スクリプトファイルの一行には複数のgroonga-benchmark命令を記述できますが、すべてのスレッド数の合計は最大64までに制限されます。 |
| 270 |
|
| 271 |
* コマンドファイル中のgroongaコマンドの長さは最長5000000byteです。 |
| 272 |
|
| 273 |
|
| 274 |
トラブルシューティング |
| 275 |
---------------------- |
| 276 |
|
| 277 |
もし、groonga-benchmarkが正常に動作しない場合、まず以下を確認してください。 |
| 278 |
|
| 279 |
* インターネットに接続しているか? `--ftp` オプションを指定すると、groonga-benchmarkは動作のたびにftp.groonga.orgと通信します。ftp.groonga.orgと通信可能でない場合、groonga-benchmarkは正常に動作しません。 |
| 280 |
|
| 281 |
* groonga サーバが動作していないか? groonga-benchmarkは、-i, --host オプションで明示的にサーバを指定しないかぎり、自動的にlocalhostのgroongaサーバを立ち上げます。すでにgroongaサーバが動作している場合、groonga-benchmarkは正常に動作しない可能性があります。 |
| 282 |
|
| 283 |
* 指定したDBが適切か? groonga-benchmarkは、引数で指定したDBの中身はチェックしません。もし指定されたDBが存在しなければ自動的にDBを作成しますが、もしファイルとして存在する場合は中身に関わらず動作を続けてしまい、結果が異常になる可能性があります。 |
| 284 |
|
| 285 |
以上の原因でなければ、問題はgroonga-benchmarkかgroongaにあります。ご報告をお願いします。 |