LoginSignup
0
0

Vegetaで負荷テストをする方法

Last updated at Posted at 2023-01-25

はじめに

備忘録
Vegetaで負荷テストをする方法のメモです。
どなたかのお役に立てれば幸いです。

Vegetaで負荷テスト

次に示すコマンドのようにして、負荷テストをすることができます。
-rateは1秒間のリクエスト数
-durationはどれだけの時間実行するか
-bodyはPOSTのBodyを書いたファイル名(同じディレクトリに指定した名前のファイルを置く)
-headerはヘッダー(今回はJSON形式なのでContent-Type: application/json
> test.binで結果をtest.binというファイルに保存

echo 'POST http://localhost/main.php' | vegeta attack -rate=10 -duration=5s -body=body.json -header='Content-Type: application/json' > test.bin

負荷テストの結果を確認

次のコマンドにより、結果をターミナル上で確認することができます。

cat test.bin | vegeta report

次のコマンドにより、結果をグラフにして確認することができます。

cat test.bin | vegeta plot > test.html

ブログもあります

0
0
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
0
0