<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>8.1.2. grntest — groonga v3.0.5 documentation</title> <link rel="stylesheet" href="../../_static/groonga.css" type="text/css" /> <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../../', VERSION: '3.0.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../../_static/jquery.js"></script> <script type="text/javascript" src="../../_static/underscore.js"></script> <script type="text/javascript" src="../../_static/doctools.js"></script> <link rel="shortcut icon" href="../../_static/favicon.ico"/> <link rel="top" title="groonga v3.0.5 documentation" href="../../index.html" /> <link rel="up" title="8.1. 実行ファイル" href="../executables.html" /> <link rel="next" title="8.1.3. groonga command" href="groonga.html" /> <link rel="prev" title="8.1.1. grnslap" href="grnslap.html" /> </head> <body> <div class="header"> <h1 class="title"> <a id="top-link" href="../../index.html"> <span class="project">groonga</span> <span class="separator">-</span> <span class="description">An open-source fulltext search engine and column store.</span> </a> </h1> <div class="other-language-links"> <ul> <li><a href="../../../../ja/html/reference/executables/grntest.html"><img src="../../_static/jp.png" alt="日本語">日本語版はこちら</a></li> </ul> </div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="groonga.html" title="8.1.3. groonga command" accesskey="N">next</a> |</li> <li class="right" > <a href="grnslap.html" title="8.1.1. grnslap" accesskey="P">previous</a> |</li> <li><a href="../../index.html">groonga v3.0.5 documentation</a> »</li> <li><a href="../../reference.html" >8. リファレンスマニュアル</a> »</li> <li><a href="../executables.html" accesskey="U">8.1. 実行ファイル</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="grntest"> <h1>8.1.2. grntest<a class="headerlink" href="#grntest" title="Permalink to this headline">¶</a></h1> <div class="section" id="id1"> <h2>8.1.2.1. 名前<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2> <p>grntest - groongaテストプログラム</p> </div> <div class="section" id="id2"> <h2>8.1.2.2. 書式<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2> <div class="highlight-none"><div class="highlight"><pre>grntest [options...] [script] [db] </pre></div> </div> </div> <div class="section" id="id3"> <h2>8.1.2.3. 説明<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h2> <p>grntestは、groonga汎用テストツールです。</p> <p>groongaを単独のプロセスとして利用する場合はもちろん、サーバプログラムとして利用する場合の動作確認や実行速度測定が可能です。</p> <p>grntest用のデータファイルは自分で作成することも既存のものを利用することもできます。既存のデータファイルは、ftp.groonga.orgから必要に応じダウンロードします。そのため、groonga及びgrntestが動作し、インターネットに接続できる環境であればgroongaコマンドの知識がなくてもgroongaの動作を確認できます。</p> <p>現在は、Linux 及びWindows上で動作します。make installしてもインストールは行われません。</p> </div> <div class="section" id="id4"> <h2>8.1.2.4. オプション<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h2> <dl class="cmdoption"> <dt id="cmdoption-i"> <tt class="descname">-i</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--host</tt><tt class="descclassname"> <ip/hostname></tt><a class="headerlink" href="#cmdoption-i" title="Permalink to this definition">¶</a></dt> <dd><p>接続するgroongaサーバを、ipアドレスまたはホスト名で指定します。指定先にgroongaサーバが立ち上がっていない場合、接続不能となることに注意してください。このオプションを指定しない場合、grntestは自動的にlocalhostのgroongaサーバを起動して接続します。</p> </dd></dl> <dl class="cmdoption"> <dt id="cmdoption-p"> <tt class="descname">-p</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--port</tt><tt class="descclassname"> <port number></tt><a class="headerlink" href="#cmdoption-p" title="Permalink to this definition">¶</a></dt> <dd><p>自動的に起動するgroongaサーバ、または明示的に指定した接続先のgroonga サーバが利用するポート番号を指定します。接続先のgroongaサーバが利用しているポートと、このオプションで指定したポート番号が異なる場合、接続不能となることに注意してください。</p> </dd></dl> <dl class="cmdoption"> <dt id="cmdoption--dir"> <tt class="descname">--dir</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption--dir" title="Permalink to this definition">¶</a></dt> <dd><p>ftp.groonga.org に用意されているスクリプトファイルを表示します。</p> </dd></dl> <dl class="cmdoption"> <dt id="cmdoption--ftp"> <tt class="descname">--ftp</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption--ftp" title="Permalink to this definition">¶</a></dt> <dd><p>ftp.groonga.orgとFTP通信を行い、scriptファイルの同期やログファイルの送信を行います。</p> </dd></dl> <dl class="cmdoption"> <dt id="cmdoption--log-output-dir"> <tt class="descname">--log-output-dir</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption--log-output-dir" title="Permalink to this definition">¶</a></dt> <dd><p>デフォルトでは、grntest終了後のログファイルの出力先ははカレントディレクトリです。このオプションを利用すると、任意のディレクトリに出力先を変更することができます。</p> </dd></dl> <dl class="cmdoption"> <dt id="cmdoption--groonga"> <tt class="descname">--groonga</tt><tt class="descclassname"> <groonga_path></tt><a class="headerlink" href="#cmdoption--groonga" title="Permalink to this definition">¶</a></dt> <dd><p>groongaコマンドのパスを指定します。デフォルトでは、PATHの中からgroongaコマンドを探します。</p> </dd></dl> <dl class="cmdoption"> <dt id="cmdoption--protocol"> <tt class="descname">--protocol</tt><tt class="descclassname"> <gqtp|http></tt><a class="headerlink" href="#cmdoption--protocol" title="Permalink to this definition">¶</a></dt> <dd><p>groongaコマンドが使うプロトコルとして <cite>gqtp</cite> または <cite>http</cite> を指定します。</p> </dd></dl> </div> <div class="section" id="id5"> <h2>8.1.2.5. 引数<a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h2> <dl class="cmdoption"> <dt> <tt class="descname">script</tt></dt> <dd><p>grntestの動作方法(以下、grntest命令と呼びます)を記述したテキストファイルです。拡張子は.scrです。</p> </dd></dl> <dl class="cmdoption"> <dt> <tt class="descname">db</tt></dt> <dd><p>grntestが利用するgroonga データベースです。指定されたデータベースが存在しない場合、grntestが新規に作成します。またgroonga サーバを自動的に起動する場合もこの引数で指定したデータベースが利用されます。接続するgroonga サーバを明示的に指定した場合に利用するデータベースは、接続先サーバが使用中のデータベースになることに注意してください。</p> </dd></dl> </div> <div class="section" id="id6"> <h2>8.1.2.6. 使い方<a class="headerlink" href="#id6" title="Permalink to this headline">¶</a></h2> <p>まず、シェル上(Windowsならコマンドプロンプト上)で:</p> <div class="highlight-none"><div class="highlight"><pre>grntest test.scr 任意のDB名 </pre></div> </div> <p>とタイプしてください。もしgrntestが正常に動作すれば、:</p> <div class="highlight-none"><div class="highlight"><pre>test-ユーザ名-数字.log </pre></div> </div> <p>というファイルが作成されるはずです。作成されない場合、このドキュメントの「トラブルシューティング」の章を参照してください。</p> </div> <div class="section" id="id7"> <h2>8.1.2.7. スクリプトファイル<a class="headerlink" href="#id7" title="Permalink to this headline">¶</a></h2> <p>スクリプトファイルは、grntest命令を記述したテキストファイルです。 ";"セミコロンを利用して、一行に複数のgrntest命令を記述することができます。一行に複数のgrntest命令がある場合、各命令は並列に実行されます。 "#"で始まる行はコメントとして扱われます。</p> <div class="section" id="id8"> <h3>8.1.2.7.1. grntest命令<a class="headerlink" href="#id8" title="Permalink to this headline">¶</a></h3> <p>現在サポートされているgrntest命令は以下の8つです。</p> <blockquote> <div><p>do_local コマンドファイル [スレッド数] [繰り返し数]</p> <blockquote> <div>コマンドファイルをgrntest単体で実行します。スレッド数が指定されている場合、複数のスレッドで同じコマンドファイルを同時に実行します。繰り返し数が指定されてい場合、コマンドファイルの内容を繰り返し実行します。スレッド数、繰り返し数とも省略時は1です。1スレッドで複数回動作させたい場合は、do_local コマンドファイル 1 [繰り返し数]と明示的に指定してください。</div></blockquote> <p>do_gqpt コマンドファイル [スレッド数] [繰り返し数]</p> <blockquote> <div>コマンドファイルをgroongaサーバで実行します。スレッド数や繰り返し数の意味はdo_localの場合と同じです。</div></blockquote> <p>rep_local コマンドファイル [スレッド数] [繰り返し数]</p> <blockquote> <div>コマンドファイルをgrntest単体で実行し、より詳細な報告を行います。</div></blockquote> <p>rep_gqpt コマンドファイル [スレッド数] [繰り返し数]</p> <blockquote> <div>コマンドファイルをgroongaサーバで実行し、より詳細な報告を行います。 スレッド数や繰り返し数の意味はdo_localと 同じです。</div></blockquote> <p>out_local コマンドファイル 入力ファイル名</p> <blockquote> <div><p>コマンドファイルをgrntest単体で実行し、各コマンドの実行結果をすべて”出力ファイル"に書きだします。この結果は、test_local, test_gqtp命令で利用します。なおこの命令の「出力ファイル」とは、grntest実行時に自動的に作成されるログとは別のものです。grntestではコメントが利用できる以外、:</p> <div class="highlight-none"><div class="highlight"><pre>groonga < コマンドファイル > 出力ファイル </pre></div> </div> <p>とした場合と同じです。</p> </div></blockquote> <p>out_gqtp コマンドファイル 出力ファイル名</p> <blockquote> <div>コマンドファイルをgroongaサーバで実行します。その他はout_local命令と同等です。</div></blockquote> <dl class="docutils"> <dt>test_local コマンドファイル 入力ファイル名</dt> <dd>コマンドファイルをgrntest単体で実行し、各コマンドの実行結果を入力ファイルと比較します。処理時間など本質的要素以外に差分があった場合、差分を、入力ファイル.diffというファイルに書きだします。</dd> </dl> </div></blockquote> </div> <div class="section" id="id9"> <h3>8.1.2.7.2. コマンドファイル<a class="headerlink" href="#id9" title="Permalink to this headline">¶</a></h3> <p>コマンドファイルは、groonga組み込みコマンドを1行に1つずつ記述したテキストファイルです。拡張子に制限はありません。groonga組み込みコマンドに関しては <tt class="xref doc docutils literal"><span class="pre">/reference/commands</span></tt> を参照してください。</p> </div> <div class="section" id="id10"> <h3>8.1.2.7.3. サンプル<a class="headerlink" href="#id10" title="Permalink to this headline">¶</a></h3> <p>スクリプトファイルのサンプルです。:</p> <div class="highlight-none"><div class="highlight"><pre># sample script rep_local test.ddl do_local test.load; do_gqtp test.select 10 10; do_local test.status 10 </pre></div> </div> <p>上記の意味は以下のとおりです。</p> <blockquote> <div><dl class="docutils"> <dt>1行目</dt> <dd>コメント行。</dd> <dt>2行目</dt> <dd>test.dll というコマンドファイルをgroonga単体で実行し、詳細に報告する。</dd> <dt>3行目</dt> <dd>test.load というコマンドファイルをgroonga単体で実行する。(最後の";"セミコロンは複数のgrntest命令を記述する場合に必要ですが、この例のように1つのgrntest命令を実行する場合に付与しても問題ありません。)</dd> <dt>4行目</dt> <dd>test.select というコマンドファイルをgroongaサーバで10個のスレッドで同時に実行する。各スレッドはtest.selectの中身を10回繰り返す。また同時に、groonga単体でtest.statusというコマンドファイルを10個のスレッドで実行する。</dd> </dl> </div></blockquote> </div> <div class="section" id="id11"> <h3>8.1.2.7.4. 特殊命令<a class="headerlink" href="#id11" title="Permalink to this headline">¶</a></h3> <p>スクリプトファイルのコメント行には特殊コマンドを埋め込むことが可能です。現在サポートされている特殊命令は以下の二つです。</p> <blockquote> <div><dl class="docutils"> <dt>#SET_HOST <ip/hostname></dt> <dd>-i, --hostオプションと同等の機能です。コマンドラインオプションに指定したIPアドレス/ホスト名と、SET_HOSTで指定したIPアドレス/ホスト名が異なる場合、またコマンドラインオプションを指定しなかった場合にもSET_HOSTが優先されます。SET_HOSTを利用した場合、サーバが自動的には起動されないのもコマンドラインオプションで指定した場合と同様です。</dd> <dt>#SET_PORT <port number></dt> <dd>-p, --port オプションと同等の機能です。コマンドラインオプションに指定したポート番号とSET_PORTで指定したポート番号が異なる場合、またコマンドラインオプションを指定しなかった場合にもSET_PORTが優先されます。</dd> </dl> </div></blockquote> <p>特殊命令はスクリプトファイルの任意の場所に書き込むことができます。同一ファイル内に複数回特殊命令を記述した場合、「最後の」特殊命令が有効となります。</p> <p>例えば、</p> <div class="highlight-none"><div class="highlight"><pre>$ ./grntest --port 20010 test.scr testdb </pre></div> </div> <p>とコマンド上でポートを指定した場合でも、もしtest.scrの中身が</p> <div class="highlight-none"><div class="highlight"><pre>#SET_PORT 10900 rep_local test.ddl do_local test.load; rep_gqtp test.select 10 10; rep_local test.status 10 #SET_PORT 10400 </pre></div> </div> <p>であれば、自動的に起動されるgroongaサーバはポート番号10400を利用します。</p> </div> </div> <div class="section" id="id12"> <h2>8.1.2.8. grntest実行結果<a class="headerlink" href="#id12" title="Permalink to this headline">¶</a></h2> <p>grntestが正常に終了すると、(拡張子を除いた)スクリプト名-ユーザ名-実行開始時刻.logという形式のログファイルがカレントディレクトリに作られます。ログファイルは自動的にftp.groonga.org に送信されます。ログファイルは以下のようなjson形式のテキストです。</p> <div class="highlight-none"><div class="highlight"><pre>[{"script": "test.scr", "user": "homepage", "date": "2010-04-14 22:47:04", "CPU": Intel(R) Pentium(R) 4 CPU 2.80GHz", "BIT": 32, "CORE": 1, "RAM": "975MBytes", "HDD": "257662232KBytes", "OS": "Linux 2.4.20-24.7-i686", "HOST": "localhost", "PORT": "10041", "VERSION": "0.1.8-100-ga54c5f8" }, {"jobs": "rep_local test.ddl", "detail": [ [0, "table_create res_table --key_type ShortText", 1490, 3086, [0,1271252824.25846,0.00144 7]], [0, "column_create res_table res_column --type Text", 3137, 5956, [0,1271252824.2601,0.002 741]], [0, "column_create res_table user_column --type Text", 6020, 8935, [0,1271252824.26298,0.0 02841]], [0, "column_create res_table mail_column --type Text", 8990, 11925, [0,1271252824.26595,0. 002861]], [0, "column_create res_table time_column --type Time", 12008, 13192, [0,1271252824.26897,0 .001147]], [0, "status", 13214, 13277, [0,1271252824.27018,3.0e-05]], [0, "table_create thread_table --key_type ShortText", 13289, 14541, [0,1271252824.27025,0. 001213]], [0, "column_create thread_table thread_title_column --type ShortText", 14570, 17380, [0,12 71252824.27153,0.002741]], [0, "status", 17435, 17480, [0,1271252824.2744,2.7e-05]], [0, "table_create lexicon_table --flags 129 --key_type ShortText --default_tokenizer Token Bigram", 17491, 18970, [0,1271252824.27446,0.001431]], [0, "column_create lexicon_table inv_res_column 514 res_table res_column ", 18998, 33248, [0,1271252824.27596,0.01418]], [0, "column_create lexicon_table inv_thread_column 514 thread_table thread_title_column ", 33285, 48472, [0,1271252824.29025,0.015119]], [0, "status", 48509, 48554, [0,1271252824.30547,2.7e-05]]], "summary" :[{"job": "rep_local test.ddl", "latency": 48607, "self": 47719, "qps": 272.4281 73, "min": 45, "max": 15187, "queries": 13}]}, {"jobs": "do_local test.load; ", "summary" :[{"job": "do_local test.load", "latency": 68693, "self": 19801, "qps": 1010.049 997, "min": 202, "max": 5453, "queries": 20}]}, {"jobs": "do_gqtp test.select 10 10; do_local test.status 10", "summary" :[{"job": " do_local test.status 10", "latency": 805990, "self": 737014, "qps": 54.273053, "min": 24, "max": 218, "queries": 40},{"job": "do_gqtp test.select 10 10", "lat ency": 831495, "self": 762519, "qps": 1967.164097, "min": 73, "max": 135631, "queries": 15 00}]}, {"total": 915408, "qps": 1718.359464, "queries": 1573}] </pre></div> </div> </div> <div class="section" id="id13"> <h2>8.1.2.9. 制限事項<a class="headerlink" href="#id13" title="Permalink to this headline">¶</a></h2> <ul class="simple"> <li>スクリプトファイルの一行には複数のgrntest命令を記述できますが、すべてのスレッド数の合計は最大64までに制限されます。</li> <li>コマンドファイル中のgroongaコマンドの長さは最長5000000byteです。</li> </ul> </div> <div class="section" id="id14"> <h2>8.1.2.10. トラブルシューティング<a class="headerlink" href="#id14" title="Permalink to this headline">¶</a></h2> <p>もし、grntestが正常に動作しない場合、まず以下を確認してください。</p> <ul class="simple"> <li>インターネットに接続しているか? <cite>--ftp</cite> オプションを指定すると、grntestは動作のたびにftp.groonga.orgと通信します。ftp.groonga.orgと通信可能でない場合、grntestは正常に動作しません。</li> <li>groonga サーバが動作していないか? grntestは、-i, --host オプションで明示的にサーバを指定しないかぎり、自動的にlocalhostのgroongaサーバを立ち上げます。すでにgroongaサーバが動作している場合、grntestは正常に動作しない可能性があります。</li> <li>指定したDBが適切か? grntestは、引数で指定したDBの中身はチェックしません。もし指定されたDBが存在しなければ自動的にDBを作成しますが、もしファイルとして存在する場合は中身に関わらず動作を続けてしまい、結果が異常になる可能性があります。</li> </ul> <p>以上の原因でなければ、問題はgrntestかgroongaにあります。ご報告をお願いします。</p> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="../../index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">8.1.2. grntest</a><ul> <li><a class="reference internal" href="#id1">8.1.2.1. 名前</a></li> <li><a class="reference internal" href="#id2">8.1.2.2. 書式</a></li> <li><a class="reference internal" href="#id3">8.1.2.3. 説明</a></li> <li><a class="reference internal" href="#id4">8.1.2.4. オプション</a></li> <li><a class="reference internal" href="#id5">8.1.2.5. 引数</a></li> <li><a class="reference internal" href="#id6">8.1.2.6. 使い方</a></li> <li><a class="reference internal" href="#id7">8.1.2.7. スクリプトファイル</a><ul> <li><a class="reference internal" href="#id8">8.1.2.7.1. grntest命令</a></li> <li><a class="reference internal" href="#id9">8.1.2.7.2. コマンドファイル</a></li> <li><a class="reference internal" href="#id10">8.1.2.7.3. サンプル</a></li> <li><a class="reference internal" href="#id11">8.1.2.7.4. 特殊命令</a></li> </ul> </li> <li><a class="reference internal" href="#id12">8.1.2.8. grntest実行結果</a></li> <li><a class="reference internal" href="#id13">8.1.2.9. 制限事項</a></li> <li><a class="reference internal" href="#id14">8.1.2.10. トラブルシューティング</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="grnslap.html" title="previous chapter">8.1.1. grnslap</a></p> <h4>Next topic</h4> <p class="topless"><a href="groonga.html" title="next chapter">8.1.3. groonga command</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../../_sources/reference/executables/grntest.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="groonga.html" title="8.1.3. groonga command" >next</a> |</li> <li class="right" > <a href="grnslap.html" title="8.1.1. grnslap" >previous</a> |</li> <li><a href="../../index.html">groonga v3.0.5 documentation</a> »</li> <li><a href="../../reference.html" >8. リファレンスマニュアル</a> »</li> <li><a href="../executables.html" >8.1. 実行ファイル</a> »</li> </ul> </div> <div class="footer"> © Copyright 2009-2013, Brazil, Inc. </div> </body> </html>