Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Taurusでお手軽に負荷試験を初めてみる with InfluxDB reporter/Grafana

sasa
March 18, 2023
1k

Taurusでお手軽に負荷試験を初めてみる with InfluxDB reporter/Grafana

負荷試験ツールTaurusのチュートリアル
ついでに、InfluxDB reporterとGrafanaを使ってみる

Tutorial of load test tool "Taurus", and tried InfluxDB reporter with Grafana.

sasa

March 18, 2023
Tweet

Transcript

  1. やってみよう
 時間があったらお手元の環境でも動かしてみてね!
 https://gettaurus.org/docs/Installation/
 
 
 brew install bzt Mac
 Linux


    sudo apt-get update sudo apt-get install python3 default-jre-headless python3-tk python3-pip python3-dev libxml2-dev libxslt-dev zlib1g-dev net-tools sudo python3 -m pip install bzt docker run -it --rm -v /tmp/my-test:/bzt-configs blazemeter/taurus my-config.yml Docker
 \お手軽/
 7
  2. YAMLファイルの用意
 Taurusのドキュメントをもとに作成
 - concurrency
 - 同時ユーザ数
 - ramp-up
 - 同時ユーザ数に到達するまでの時間

    
 - hold-for
 - 同時ユーザ数を保持する実行時間 
 
 execution: - concurrency: 2 ramp-up: 2s hold-for: 20s scenario: Sample scenarios: Sample: default-address: https://blazedemo.com requests: - / example.yml
 デフォルトで、JMeterのExecuterが利用されます 
 8
  3. reporting: - module: influxdb-reporter modules: influxdb-reporter: host: localhost # influxdb

    address (default: localhost) port: 8086 # port (default: 8086) database: jmeter # the datasource name measurement: taurus # the measurement name username: taurus # username if influxdb authentication enabled password: password # password if influxdb authentication enabled application: hogehoge 結論: 正しく動く設定
 16
  4. Influxdbの設定
 InfluxdbとGrafanaをdocker-composeでざっと立てる
 version: "3" services: influxdb: image: influxdb:1.2 platform: linux/x86_64

    ports: - 8086:8086 - 8083:8083 environment: - INFLUXDB_ADMIN_ENABLED=true networks: - influxdb-networks grafana: image: grafana/grafana platform: linux/arm64/v8 # M1 Macの場合付ける ports: - 3000:3000 depends_on: - influxdb networks: - influxdb-networks networks: influxdb-networks: 組み込み管理UIを利用したいため1.2を指定 
 8086: InfluxDBのポート 
 8083: 管理UIのポート 
 17
  5. Influxdbの設定
 DBとユーザーの作成
 # on influxdb ui(access to http://localhost:8083/) CREATE DATABASE

    "jmeter" CREATE USER "taurus" WITH PASSWORD 'password' WITH ALL PRIVILEGES 18
  6. java が入っていないことで怒られます
 `brew install` 経由でインストールしたtaurus実行時に Child Process Error: JavaVM isn't

    found, automatic installation isn't implemented エラーが出た時
 For the system Java wrappers to find this JDK, symlink it with 
 sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk 
 
 openjdk is keg-only, which means it was not symlinked into /opt/homebrew, 
 because macOS provides similar software and installing this software in 
 parallel can cause all kinds of trouble. 
 
 If you need to have openjdk first in your PATH, run: 
 echo 'export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"' >> ~/.zshrc 
 
 For compilers to find openjdk you may need to set: 
 export CPPFLAGS="-I/opt/homebrew/opt/openjdk/include" 
 
 $ brew install java
 # bew した結果に表示された通りコマンドを実行してみる 
 $ sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk 
 $echo 'export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"' >> ~/.zshrc 
 
 
 26 `brew install java` 実行時に出てくる文章

  7. 今回できたtaurusの設定ファイル全体(example.yml)
 execution: - concurrency: 2 ramp-up: 2s hold-for: 120s scenario:

    Sample scenarios: Sample: default-address: https://blazedemo.com requests: - / - /vacation.html reporting: - module: final-stats # テスト後の要約統計量を提供します summary: true # 全体的なサンプル数と失敗の割合 percentiles: true # 平均時間と割合を表示 summary-labels: true # サンプルラベル、ステータス、完了率、平均時間、エラーのリストを提供 failed-labels: false # 失敗したサンプルラベルのリストを提供 test-duration: true # テスト期間を提供します dump-csv: ./perf_result_csv.csv - module: console - module: blazemeter - module: influxdb-reporter modules: influxdb-reporter: host: localhost # influxdb address (default: localhost) port: 8086 # port (default: 8086) database: jmeter # the datasource name measurement: taurus # the measurement name username: taurus # username if influxdb authentication enabled password: password # password if influxdb authentication enabled application: hogehoge 27