実行

JBento2の実行には、driver.shを使用します。

driver.sh

sh driver.sh JBento-TestRepo

driver.shは測定用ディレクトリの作成、設定ファイルの書き換え、テストの実行を 行います。

  • 測定用ディレクトリの作成

    スクリプトはworkディレクトリを作成し、その下にloop.confで指定した パラメータ毎のディレクトリを作成します。

    APNUMS="1 2" CLIENT="10 20"の場合、以下のようなディレクトリ構造になります。

    APNUMS_1/CLIENT_10
    APNUMS_1/CLIENT_20
    APNUMS_2/CLIENT_10
    APNUMS_2/CLIENT_20
    
  • 設定ファイルの書き換え

    スクリプトはJBento-TestRepo内のファイルをworkディレクトリ配下にコピーし、 sedによるパラメータ書き換えを実施します。 前の例だと、%APNUMS%と書かれた箇所に 1 または 2 が、 %CLIENT%と書かれた箇所に 10 または 20が置き換わります。

  • テストの実行

    スクリプトはworkディレクトリの最下層の一つに移動し、run.shを実行します。 一つの測定が終わると、次のディレクトリに移動し、設定した繰り返しが終了 するまで、テストを実行します。

個々の機能の実行

Analyzer

以下のクラスがあります。

jp.osdl.jbento2.analyzer.AnalyzerCli

JMeterのログ、JBento独自ログを解析し、スループット、応答時間を集計し、 csvファイルに出力します。

usage: AnalyzerCli [-D ramp-down seconds] [-d dest dir] [-U ramp-up seconds] [-h]
       [-R duration seconds] [-p parser name] [-f source file]
 -D,--ramp-down <ramp-down seconds>   seconds to ignore ramp-down.
 -U,--ramp-up <ramp-up seconds>       seconds to ignore ramp-up.
 -R,--duration <duration seconds>     seconds to duration.
 -d,--dest <dest dir>                 dest directory.
 -f,--source <source file>            source file.
 -h,--help                            display help
 -p,--parser <parser name>            parser name. available value is 'jbento'.    
  • ramp-up、ramp-down、durationは記録されたログのうち、どの範囲を有効とするかを指定します。
  • ramp-upは測定開始時からの除外時間、durationはramp-up後の有効時間を指定します。
  • ramp-downは測定終了時からの除外時間です。durationに値が設定されている場合、ramp-downは無視されます。
  • destは、出力先のディレクトリです。以下のファイルが出力されます。
    • summary.txt 測定のサマリとして、開始時間、終了時間等を記録します
    • throughput.txt スループットを集計したものです
    • responseTime.txt 応答時間を集計したものです
    • throughputTimeLine.txt 1秒毎のスループットの遷移です
  • sourceは、ログファイル名を指定します。現在のところ複数ファイルには対応していません。
    • access.log JBentoGohanを利用する場合
  • parserはログファイルの種類によって選択します。現在のところ、以下のparserが存在します。
    • jbento jbento1で測定したサーバ内部処理時間を含むログを解析します。普段はあまり使わないでしょう・・・
    • jmeter jmeterのログ(XML形式)を解析します
    • gohan JBentoGohanのログを解析します
    • csv csvファイルのログを解析します。デフォルトではJMeter2.2のログ出力に合わせてあります。以下の順にデータが並んでいる必要があります
      startTime,responseTime,requestType,responseCode,clientId
      

      クラスパス上にjp.osdl.zibento2.analyzer.csv.propertiesファイルを置いて以下のように指定すれば、 カラムの場所は変更することもできます。

      startTime=0
      responseTime=1
      requestType=2
      responseCode=3
      clientId=4
      

jp.osdl.jbento2.analyzer.SarAllCli

sarのログファイルを解析し、csvファイルに変換します。 また、平均を計算します。

usage: SarAllCli [-s source dir] [-d dest dir] [-k skip time[s]] [-t term time[s]]
 -d,--dest <dest dir>       destination directory.
 -k,--skip <skip time[s]>   skip seconds after starting measurement.
 -s,--source <source dir>   source directory.
 -t,--term <term time[s]>   seconds of term for analyzing.
  • source ログファイルの格納されているディレクトリを指定します。 ログファイルは、*.(option).sar というファイル名になっている必要があります。 ログファイルはディレクトリ内を再帰的に検索されるため、サブディレクトリにあっても構いません。 optionには、sarのオプションが含まれます。以下に例を示します。
    • host1.u.sar host1上のsar -u の結果
    • machine1.nDEV.sar machine1上のsar -n DEVの結果
  • dest 出力先のディレクトリです。 csvファイルは、source配下のディレクトリ構造と同じものをdest配下に作成し、配置されます。
  • skip ログの開始時間からの除外時間を秒数で指定します。
  • term ログの集計対象とする時間を秒数で指定します。

    --skip 30 --term 120 と指定した場合、ログ開始時間から30秒?150秒の範囲を解析範囲とします。

jp.osdl.jbento2.analyzer.MultiResultCollectorCli

スループット、応答時間のcsvファイルを集めて、一つのcsvファイルにします。

usage: MultiResultCollectorCli [-s source dir] [-d dest dir]
 -d,--dest <dest dir>          destination directory.
 -s,--sourcedir <source dir>   source directory.

jp.osdl.jbento2.analyzer.MultiResultCollectorAllCli

設定ファイルを使用して、jp.osdl.jbento2.analyzer.MultiResultCollectorCli を一括呼び出しします。

usage: MultiResultCollectorAllCli [-s source dir] [-f config file]
 -f,--conf <config file>    config file
 -s,--source <source dir>   source directory.

jp.osdl.jbento2.analyzer.MultiSarResultCollectorAllCli

設定ファイルを使用して、複数のsarの平均ファイルを一つのcsvファイルにします。

usage: MultiResultCollectorAllCli [-s source dir] [-f config file]
 -f,--conf <config file>    config file
 -s,--source <source dir>   source directory.

jp.osdl.jbento2.analyzer.GCAnalyzerCli

"-XX:+PrintGCDetails -XX:+PrintGCTimeStamps" オプションを付けたGCのログを解析し、csvファイルを出力します。

usage: GCAnalyzerCli [-s start time] [-d dest file] [-h] [-f source file]
 -d,--dest <dest file>       dest file.
 -f,--source <source file>   source file.
 -h,--help                   display help
 -k,--skip <skip time>       skip time[sec]
 -m,--mean <mean time>       mean time[sec]
 -s,--start <start time>     start time[HH:mm:ss]
  • source 解析対象のGCログファイルを指定します。
  • dest 出力するcsvファイル名を指定します。
  • start 解析開始の時間を指定します。GCログのタイムスタンプはJava VM開始時からの相対時間になっているため、時間の指定が必要です。 時間指定が無い場合、ファイルの更新日時からの逆算によって時間を取得します。
  • skip ログファイルの先頭から、指定した時間を除きます。
  • mean ログファイルの先頭もしくはskipで指定した有効なログから、指定した時間のみを集計範囲として扱います。

jp.osdl.jbento2.analyzer.GCAllCli

指定したディレクトリ内を再帰的に辿り、".*\.gc\.log"という名前のログファイルに対し、csvファイルを出力します。 解析できるのは"-XX:+PrintGCDetails -XX:+PrintGCTimeStamps" オプションを付けたGCのログです。

usage: GCAllCli [-s source dir] [-d dest dir] [-k skip time] [-m mean
       time] [-t start time]
 -d,--dest <dest dir>       destination directory.
 -h,--help                  display help
 -k,--skip <skip time>      skip time[sec]
 -m,--mean <mean time>      mean time[sec]
 -s,--source <source dir>   source directory.
 -t,--start <start time>    start time[HH:mm:ss]

  • source 解析対象のGCログファイルが含まれるディレクトリを指定します。
  • dest csvファイルを出力するディレクトリ名を指定します。
  • start 解析開始の時間を指定します。GCログのタイムスタンプはJava VM開始時からの相対時間になっているため、時間の指定が必要です。 時間指定が無い場合、ファイルの更新日時からの逆算によって時間を取得します。skipによりログが除外されている場合、有効なログの先頭がstartで指定した時間になります。
  • skip ログファイルの先頭から、指定した時間を除きます。
  • mean ログファイルの先頭もしくはskipで指定した有効なログから、指定した時間のみを集計範囲として扱います。

Chart

jp.osdl.jbento2.chart.ChartCli

csvファイルからグラフを生成します。

usage: ChartCli [-X x Max] -s source file [-i title] [-d dest file] -b
       dataset builder [--renew] [-Y y Max] [-c categories] -t chart type [-e end
       of data] [-p dest file postfix] [--xLabel x Label] [--width width]
       [--height height] [--yLabel y Label] [--noshape]
 -X,--xMax <x Max>                  max number of x-axis.
 -Y,--yMax <y Max>                  max number of y-axis.
    --renew                         renew chart
 -b,--builder <dataset builder>     dataset builder name
 -c,--categories <categories>       categories of graph
 -d,--dest <dest file>              dest file.
 -e,--eod <end of data>             string about end of data in csv file
 -i,--title <title>                 title.
 -p,--postfix <dest file postfix>   dest file postfix.
 -s,--source <source file>          source file.
 -t,--type <chart type>             chart type
  • height グラフの高さをピクセル数で指定します
  • widht グラフの横幅をピクセル数で指定します
  • renew デフォルトではcsvファイルとグラフで、csvファイルの方が更新日時が新しい場合にグラフを再生成します。 renewオプションを指定することで、強制的にグラフを再生成させます。
  • builder csvファイルの種類によって、以下の種類のbuilderを指定します。
    • category X軸に文字列を取るようなグラフの場合、categoryを指定します。 X軸の各文字列は、--categoriesオプションで指定できます。
      item, category1, category2, category3
      a, 50, 60, 70
      b, 30, 60, 90
      

      というようなcsvファイルがあった場合、category1-3をX軸に、a,bを線の種類に、30-90をY軸に取るようなグラフを生成できます。

    • xy X軸に数値を取るようなグラフの場合、xyを指定します。 Y軸に取るカラムは、--categoriesオプションで指定できます。
      x,  y1, y2
      10, 30, 40
      20, 50, 60
      

      というようなcsvファイルがあった場合、10,20をX軸に、30-60をY軸に、y1, y2を線の種類に取るようなグラフを生成できます。

    • xydate

      X軸に時間を取るようなグラフの場合、xydateを指定します。

      Y軸に取るカラムは、--categoriesオプションで指定できます。

      time,  y1, y2
      10:00:00, 30, 40
      10:00:01, 50, 60
      

      というようなcsvファイルがあった場合、10:00:00-10:00:01をX軸に、30-60をY軸に、y1, y2を線の種類に取るようなグラフを生成できます。

  • postfix ファイル名を指定しなかった場合、csvファイル名と拡張子以外が同じファイル名でグラフを生成します。さらにこのオプションを指定すると、拡張子を付けたファイル名とすることができます。ChartAllCliを使用してグラフを一括生成する際に、1つのcsvファイルから複数のグラフに分割する際に便利です。
  • type グラフの種類を指定します。以下が指定できます。
    • Line 折れグラフです。
    • XYLine X軸が数値の場合の折れ線グラフです。
    • StackedXYArea X軸が数値の場合の積み上げグラフです。
    • Time X軸を時間とする折れ線グラフです。
    • StackedTime X時間を時間とする積み上げグラフです。

jp.osdl.jbento2.chart.ChartAllCli

設定ファイルを使用して、jp.osdl.jbento2.chart.ChartCliを一括呼び出しします。

usage: ChartAllCli [-s source dir] [-r] [-f config file]
 -f,--conf <config file>    config file
 -r,--renew                 renew charts
 -s,--source <source dir>   source directory.

設定ファイルの例は、scripts/graphs.confを参考にしてください。

Report

jp.osdl.jbento2.report.ReportCli

生成されたグラフを見やすく配置した、HTMLファイルを出力します。

usage: ReportCli [-s summary dir] [-d dest dir] [-h] [-l logs dir]
 -d,--destdir <dest dir>         dest dir.
 -h,--help                       display help
 -l,--logsdir <logs dir>         logs dir.
 -s,--summarydir <summary dir>   summary dir.