tag1consulting / goose

Load testing framework, inspired by Locust
https://tag1.com/goose
Apache License 2.0
759 stars 69 forks source link

Send custom messages to workers #496

Open nicholasdavidson opened 2 years ago

nicholasdavidson commented 2 years ago

Apologies if this is in the examples somewhere, but I was looking at converting a distributed locust test to goose and couldn't see any obvious way of sending custom messages from the manager to the worker.

I've typically used this to distribute some finite resource like a pre-created pool of credentials to workers.

I could do something like sending the pool to all workers and bucket the pool by worker number, but wondered if I'd just missed how to send custom messages.

jeremyandrews commented 2 years ago

Unfortunately this is not currently supported by Goose.

Can you send a link to how custom messaging works in Locust?

nicholasdavidson commented 2 years ago

The https://docs.locust.io/en/stable/api.html#locust.runners.MasterRunner provides the register message and send_message hooks which allow you to send and acknowledge any message between the master and its swarm workers. This is usefully combined with the event listeners decorators to send messages once the worker has initialised. An example can be read here: https://github.com/locustio/locust/blob/master/examples/custom_messages.py

If this is something that you would be interested in accepting I could try and come up with a PR?

You're already using serd so it'd be a bit of work around the send_message loop in manager.rs, and I guess we'd need a trait for user messages as well as requiring them to be send/sync and Serialize / Deserialize.

jeremyandrews commented 2 years ago

PR's are always welcome! I definitely think this would be a useful feature to add.