From f20baa6ebd75e5a55ec1d3755ef4c61b83fd5924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Zavam?= Date: Sun, 20 Jan 2019 12:54:30 +0000 Subject: [NEW] benchmarks/py-locust: Python utility for doing distributed load tests Locust is an easy-to-use, distributed, user load testing tool. It is intended for load-testing web sites (or other systems) and figuring out how many concurrent users a system can handle. The behavior of each locust (or test user if you will) is defined by you and the swarming process is monitored from a web UI in real-time. This will help you battle test and identify bottlenecks in your code before letting real users in. WWW: https://locust.io/ Approved by: araujo (mentor), rene (mentor) Sponsored by: cleverbridge AG Differential Revision: https://reviews.freebsd.org/D18895 --- benchmarks/py-locust/files/extra-EXAMPLES-basic.py | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 benchmarks/py-locust/files/extra-EXAMPLES-basic.py (limited to 'benchmarks/py-locust/files/extra-EXAMPLES-basic.py') diff --git a/benchmarks/py-locust/files/extra-EXAMPLES-basic.py b/benchmarks/py-locust/files/extra-EXAMPLES-basic.py new file mode 100644 index 000000000000..c34610e8df8e --- /dev/null +++ b/benchmarks/py-locust/files/extra-EXAMPLES-basic.py @@ -0,0 +1,26 @@ +from locust import HttpLocust, TaskSet, task + + +def index(l): + l.client.get("/") + +def stats(l): + l.client.get("/stats/requests") + +class UserTasks(TaskSet): + # one can specify tasks like this + tasks = [index, stats] + + # but it might be convenient to use the @task decorator + @task + def page404(self): + self.client.get("/does_not_exist") + +class WebsiteUser(HttpLocust): + """ + Locust user class that does requests to the locust web server running on localhost + """ + host = "http://127.0.0.1:8089" + min_wait = 2000 + max_wait = 5000 + task_set = UserTasks -- cgit v1.2.3