Reputation: 1174
I am doing research on how to load test a video streaming player using Locust, but haven't been able to make it work. Basically, I have a playback URL that loads a player and I can pass parameters to the player, including autoPlay=true
.
So, I tried to hit that playback URL passing the autoplay parameter, but that does not seem to be sufficient. If you are familiar with video streaming, the video is divided into chunks of usually 2 to 10 seconds; each chunk has a unique URI where the player fetches the next segment.
Is this something currently possible with Locust?
Here's my code for completness:
from locust import HttpUser, task, between
class GenerateViewers(HttpUser):
wait_time = between(1, 5)
@task
def index(self):
self.client.get("/")
Then I am able to open Locust UI and enter the parameters for my test, including the player URL. I assume what's happening is that Locust is hitting the URL I pass on the UI and immediately exiting (i.e., it just sends a GET request).
Upvotes: 0
Views: 1405
Reputation: 2866
It’s possible with Locust but not with the simple built-in user. You’re correct that Locust will only do a simple GET
at the endpoint you give it. I use Locust for video streaming load testing but I’ve had to write my own user flow that simulates a video player in order to get the behavior I wanted. You’ll need to do the same, based on your specific use case.
I would recommend writing a Python script that does what you want it to do. In a basic scenario, you can then copy and paste the whole thing into Locust and mark it as @task
And replace your network calls with Locust’s.
For a more advanced scenario, you can write Python code to do whatever you need it to do and manually fire events at desired points to report status of things back to Locust. In the docs this is referred to as testing other systems using custom clients. You can check that out here https://docs.locust.io/en/stable/testing-other-systems.html
Upvotes: 4