| Crates.io | hailstorm |
| lib.rs | hailstorm |
| version | 0.2.0 |
| created_at | 2022-05-28 17:00:51.359839+00 |
| updated_at | 2024-12-21 13:24:32.71403+00 |
| description | Load testing framework |
| homepage | |
| repository | https://github.com/dghilardi/hailstorm |
| max_upload_size | |
| id | 595841 |
| size | 747,842 |
Hailstorm is a distributed load testing framework inspired by Locust.
The following example shows how a simulation can be configured and launched using the provided example biaries. For more control over hailstorm and its features I suggest to use hailstorm as a dependency and create your own agent and controller components.
Environment variables definition
# .env.controller
hs_address="0.0.0.0:50051"
hs_clients_distribution.hailstone="ln(1 + t/1000) * (sin(t/10) + 1) * 1000"
hs_script_path="simulation-script.rn"
Client behaviour can then be defined using a rune script.
// simulation-script.rn
struct hailstone {
id
}
impl hailstone {
pub fn new() {
Self { id: 10 }
}
pub fn register_bot(bot) {
bot.register_action(10.0, Self::do_http_req)
}
pub async fn do_http_req(self) {
let res = http::get("http://someserver:80").await;
}
}
Controller can then be launched with
zenv -f .env.controller -- ./target/release/examples/controller
Environment variables definition
# .env.agent
hs_upstream.lvl1=http://localhost:50051
hs_simulation.running_max = 1000
hs_simulation.rate_max = 100
One or more agents can then be launched with
hs_address=0.0.0.0:50151 zenv -f .env.agent -- ./target/release/examples/agent
hs_address=0.0.0.0:50152 zenv -f .env.agent -- ./target/release/examples/agent
hs_address=0.0.0.0:50153 zenv -f .env.agent -- ./target/release/examples/agent
Agents can also be attached to other agents, in order to have a more distributed topology. Each agent can also have more than one parent in order to reduce data loss chances.
Environment variables definition
# .env.agent.lvl2
hs_upstream.lvl1_0=http://localhost:50151
hs_upstream.lvl1_1=http://localhost:50152
hs_upstream.lvl1_2=http://localhost:50153
As before can be launched with
hs_address=0.0.0.0:50251 zenv -f .env.agent.lvl2 -- ./target/release/examples/agent
hs_address=0.0.0.0:50252 zenv -f .env.agent.lvl2 -- ./target/release/examples/agent
hs_address=0.0.0.0:50253 zenv -f .env.agent.lvl2 -- ./target/release/examples/agent