locust is easy and good. You can measure the performance quickly and check the operation on the WebUI without having to create a graph yourself. But with WebUI, only 95% tiles and median are displayed, which is not enough! Let me check the average! For people who like.
Set the master node options at startup as follows. that's all. Easy!
locust --master --csv=log/test --csv-full-history
Now, the following files will be output under (startup directory) / log.
/locust$ ls log
test_failures.csv test_stats.csv test_stats_history.csv
When the container is running, the log file will be trapped in the container if it is left untouched, so use docker-compose etc.
docker-compose.yml
services:
locust-master:
volumes:
- ./log:/locust/log
Let's define it.
with this
test_stats_history.csv
Timestamp,User Count,Type,Name,Requests/s,Failures/s,50%,66%,75%,80%,90%,95%,98%,99%,99.9%,99.99%,100%,Total Request Count,Total Failure Count,Total Median Response Time,Total Average Response Time,Total Min Response Time,Total Max Response Time,Total Average Content Size
1603540111,17,GET,/xxxxx/,0.000000,0.000000,2,2,3,3,4,28,28,28,28,28,28,11,0,2,4.694659181702511,1.4053259992579115,28.377445999467454,14265.0
1603540111,17,GET,/yyyyy/,0.000000,0.000000,3,3,3,4,9,9,9,9,9,9,9,10,0,3,3.410866200010787,2.1423650005090167,8.981184999356628,93670.0
1603540111,17,GET,/zzzzz/,0.000000,0.000000,2,2,3,3,4,6,19,24,24,24,24,76,0,2,2.9205118157374512,1.2653539997700136,24.40452499922685,4668.0
1603540111,17,,Aggregated,0.000000,0.000000,2,3,3,3,4,8,24,28,28,28,28,97,0,2,3.1722557834523895,1.2653539997700136,28.377445999467454,14931.783505154639
(The following is omitted)
With that feeling, you will be able to aggregate by resource!
It seems that the percentile output to the log is also adjustable.
According to the Official Documentation
import locust.stats
locust.stats.CONSOLE_STATS_INTERVAL_SEC = 15
It seems that you can change `` `PERCENTILES_TO_REPORT``` like this.
The documentation is unfriendly and I don't know how to change it, so take a look at the source
grep PERCENTILES_TO_REPORT /usr/local/lib/python3.9/site-packages/locust/stats.py
PERCENTILES_TO_REPORT = [0.50, 0.66, 0.75, 0.80, 0.90, 0.95, 0.98, 0.99, 0.999, 0.9999, 1.0]
Since it is written like this, in locustfile.py
import locust.stats
locust.stats.PERCENTILES_TO_REPORT = [0.95]
If you add and override
Timestamp,User Count,Type,Name,Requests/s,Failures/s,95%,Total Request Count,Total Failure Count,Total Median Response Time,Total Average Response Time,Total Min Response Time,Total Max Response Time,Total Average Content Size
1603542253,4,GET,/xxxxx/,0.000000,0.000000,22,2,0,2.2806119995948393,12.121530499825894,2.2806119995948393,21.96244900005695,14265.0
1603542253,4,GET,/yyyyy/,0.000000,0.000000,3,2,0,2.666434999810008,2.6112880000255245,2.556141000241041,2.666434999810008,93670.0
1603542253,4,GET,/zzzzz/,0.000000,0.000000,28,4,0,2.067968999654113,8.805921999964994,2.067968999654113,27.854616000695387,4668.0
1603542253,4,,Aggregated,0.000000,0.000000,28,8,0,3,8.086165624945352,2.067968999654113,27.854616000695387,29317.75
Oh, the output was refreshing!