This directory contains a Locust script for load testing.
│ locustfile.py # gRPC locust client
│ load_test.conf # load test configs
│ test_grpc_api.py # test script to call gRPC server
│ cat_224x224.jpeg # resized test image
- Install Locust with
pip
. You have to open up a new terminal session (or sourcing the~/.bashrc
) to enablelocust
CLI.
pip install locust
-
Replace placeholderes. In
load_test.conf
andlocustfile.py
, there are three placeholders of<<EXTERNAL-CLUSTER-IP>>
. You have to replace those with the actual endpoint that your TFServing is deployed on. Also you need to replace<<WHERE-TO-STORE-RESPORT>>
placeholders inload_test.conf
with where you want to save the final report. -
locust
theload_test.conf
. Every bits of configurations are defined inload_test.conf
, so you only need to specify it in--config
option.
$ locust --config=load_test.conf
locustfile = locustfile.py
headless = true
users = 150
spawn-rate = 1
run-time = 5m
host = http://<<EXTERNAL-CLUSTER-IP>>
html = <<WHERE-TO-STORE-REPORT>>.html
csv = <<WHERE-TO-STORE-REPORT>>
More complete descriptions for each configuration can be found in the official doc, but here we provide a brief summary.
- locustfile: the python script file which implements the client behaviour.
- headless: whether not to use UI or not. If you set this
True
, no UI is involved, and the load test runs right away. - users: the maximum number of users(requests).
- spawn-rate: how many users should be added at a time. You can decide the time interval between spawns in the
locustfile.py
. - run-time: how much time the load test should be conducted. Here,
m
means minutes. - host: endpoint
- html: path where the HTML based report should be stored.
- csv: path where the CSV based report should be stored. Notice that we don't set file extension
.csv
here because multiple csv files for each circumstances would be generated.