You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi guys, a while ago, I wrote two utitlities - ping.py and benchmark.py - on top of locustio==0.7.1.
ping.py - this one works much like regular ICMP ping but pings http or tcp services as defined in locustio. So it takes a locust and then runs as 1 concurrent user making 1s spaced requests, dumping some stats at the end. This is useful to verify HA when testing various failover scenarios.
Example:
$ ping.py example.com
PING https://example.com
11921 bytes from `GET /beta/login': seq=0 time=1016ms2693 bytes from `GET /beta/static/index.html': seq=1 time=275ms42 bytes from `GET /beta/userkeys': seq=2 time=290ms16544 bytes from `GET /beta/p/api/v2/deployments/thisoneworks/battery/historical/soc': seq=3 time=931ms
14069 bytes from `GET /beta/p/api/v2/deployments/thisoneworks/generation/historical/p': seq=4 time=776ms19417 bytes from `GET /beta/p/api/v2/deployments/thisoneworks/house/historical': seq=5 time=1211ms15927 bytes from `GET /beta/p/api/v2/deployments/thisoneworks/battery/historical/soc': seq=6 time=1003ms^C------- Statistics -------7 requests sent, 7 received, 0% requests failed$
benchmark.py - this one tries to estimate spare resource capacity. It basically starts by simulating a certain number of concurrent users and then works its way up (by small increments) until it hits a threshold. The threshold is defined by failing requests. Any failure stops the benchmark so that services don’t get totally hammered. I intentionally set short timeouts and stop on the first failure so that as soon as a benchmarked service gets busy, the benchmark stops. This is a way to automate running locust with different levels of concurrency.
Example:
$ benchmark.py example.com 7
STARTING BENCHMARK AGAINST https://example.com
Low: 7, Num_clients: 7, Num_requests: 662
339 INFO locust.runners: Hatching and swarming 7 clients at the rate 2
clients/s...
3846 INFO locust.runners: All locusts hatched: BenchmarkUILocust: 7
3846 INFO locust.runners: Resetting stats
Request failure: (), {'request_type': 'GET', 'exception': HTTPError('500 Server Error: INTERNAL SERVER ERROR',), 'response_time': 1322, 'name': '/beta/p/api/v2/deployments/thisoneworks/cost/historical'}
Request failure: (), {'request_type': 'GET', 'exception': HTTPError('500 Server Error: INTERNAL SERVER ERROR',), 'response_time': 807, 'name': '/beta/p/api/v2/deployments/thisoneworks/cost/historical'}
...
Aggregated 80% Median 563 1300
Aggregated avg response time 1048
Aggregated # Failures 99
(sub)Benchmark ran for 415s
====== FINISHED Benchmark against https://example.com =======
Stats: 3 iterations, total time 418s, low threshold 18 clients
We use these scripts internally on top of locust.io and are happy to work with the community on incorporating them into locust.io. Is this something that you would be interested in doing/having part of locust.io?
maintenance and development of Locust is currently in a bit of flux, so new code has not been merged recently. However, the situation should hopefully get fixed up soon.
We use these scripts internally on top of locust.io
and are happy to work with the community on incorporating
them into locust.io. Is this something that you would be
interested in doing/having part of locust.io?
so, In the meantime, I would just go ahead and create the Pull Request with your proposed changes. (pasting code here in the issue tracker isn't really helpful) Once your changes are pushed to your repo and things are in a PR format, the code can be discussed and reviewed. Once contributions get flowing again, maintainers can triage all the open PR's and decide what to merge. You can link to your PR from this issue and remove the code snippets you pasted to make things more clear.
(if you do decide to craft a PR, feel free to tag me on it for code review)
Hi guys, a while ago, I wrote two utitlities - ping.py and benchmark.py - on top of locustio==0.7.1.
Example:
Example:
We use these scripts internally on top of locust.io and are happy to work with the community on incorporating them into locust.io. Is this something that you would be interested in doing/having part of locust.io?
Cheers,
Tomas
ping.py:
benchmark.py:
The text was updated successfully, but these errors were encountered: