0
0

Locustで負荷テストを行った

Posted at

Locustで負荷テストを行った

postmanでは複数同時テストができないためLocustを使用した

install

pip install locust

App内にfileを設置

App/Web/views/locust.py

locust.pyでテストコードを作成

毎秒の時間を出力するコード

from locust import HttpUser, TaskSet, task
import datetime

class Test(TaskSet):
    @task
    def load(self):
        print(datetime.datetime.now())

class Test2(HttpUser):
    tasks = {Test:1}

出力コマンド

App/Web/views/の階層まで移動し

$locust

を叩くと出力されます。

こちらを流用し個々のテストの出力を行えます。
人数や何秒ごとかなどの詳細な設定も行えますので便利です。

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