LoginSignup
2
2

More than 5 years have passed since last update.

Tsungを積んだDockerで負荷テストを行う

Posted at

Tsungをローカルに入れるのがめんどくさかったので、有志が作ったTsungのDockerイメージを利用して負荷テストを行う

環境

  • ローカル(Mac)
    • Docker(17.03.1-ce)

Tsungを使ったテストで利用したDockerイメージ

以下で導入

$ docker pull ddragosd/tsung-docker

必要なもの

  • テスト記述ファイル

早速実行

docker run \
   -v テストファイルが置いてあるホストのパス:/usr/local/tsung ddragosd/tsung-docker:latest \
   -f /usr/local/tsung/テストファイル名 \
   start

もっと詳しいことは、Githubページ参照、もしくはDockerHubページを参照

テストを実行するとマウントしたホストのディレクトリに結果が出力される

HTMLファイルも出力されるので、簡単に結果を確認できる

スクリーンショット 2017-04-14 11.06.59.png

(例)テスト記述ファイル

<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/opt/erlang/R16B03-1/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice" version="1.0">
  <clients>
    <client host="localhost" cpu="1" use_controller_vm="true" />
  </clients>
  <servers>
    <server host="テストサーバー" port="80" type="tcp"></server>
  </servers>
  <load>
   <arrivalphase phase="1" duration="180" unit="second">
     <users interarrival="2" unit="second"></users>
   </arrivalphase>
  </load>
  <options>
    <option type="ts_http" name="user_agent" >
      <user_agent probability="100">Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36</user_agent>
   </option>
   <option name="connect_timeout" value="5000" />
  </options>
  <sessions>
    <session name="attack" probability="100" type="ts_http">
      <request>
        <http url="URL(クエリーがある場合は&を変換しておくこと)"
          method="GET" version="1.1" >
        </http>
      </request>
    </session>
  </sessions>
</tsung>

特定のパスに負荷をかけることがしたかったので、とても簡単な記述(割と適当)

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2