locustio / locust

Write scalable load tests in plain Python 🚗💨
https://locust.cloud
MIT License
25.1k stars 3k forks source link

Download speed throttling for HttpClient/FastHttpClient? #2973

Open flbraun opened 2 weeks ago

flbraun commented 2 weeks ago

Prerequisites

Description

I'm currently building a test suite where Locust emulates a bunch of low-powered IoT devices that won't reach high download speeds (<2MB/s).
The problem here is that Locust will happily use all of the worker host's available bandwidth. This implicates that - from my service's perspective - the requests finish a lot faster than they realistically would, and thus the connections won't need to be held as long. This is probably a very niche issue, but for my case it's quite essential.

There are a couple of throttling implementations around for requests. Most of them work around response streaming. I'm sure there are solutions for geventhttpclient as well.

Would this be a welcome addition to Locust or do you consider it too niche? If not I'll see if I can fit a contributioninto my employer's budget.

cyberw commented 2 weeks ago

That would be super useful and a welcome contribution!