Skip to content

Commit cf09a00

Browse files
committed
explain how to use requests per minute or hour
1 parent b0f0414 commit cf09a00

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

book/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
- [Start local observability stack](./libs/wasp/how-to/start_local_observability_stack.md)
101101
- [Try it out quickly](./libs/wasp/how-to/run_included_tests.md)
102102
- [Chose between RPS and VUs](./libs/wasp/how-to/chose_rps_vu.md)
103+
- [Configure requests per minute or hour](./libs/wasp/how-to/rps_per_minute.md)
103104
- [Define NFRs and check alerts](./libs/wasp/how-to/define_nfr_check_alerts.md)
104105
- [Use labels](./libs/wasp/how-to/use_labels.md)
105106
- [Incorporate load tests in your workflow](./libs/wasp/how-to/incorporate_load_tests.md)

book/src/libs/wasp/components/generator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A **Generator** is a component that encapsulates all the characteristics of load
1010
* [Sampling](./sampler.md)
1111
* Timeouts
1212

13-
> [!WARNING]
13+
> [!WARNING]
1414
> RPS load type can only be used with a `Gun`, while VUs can only be used with a `VirtualUser`.
1515
1616
---

book/src/libs/wasp/how-to/chose_rps_vu.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
When writing a test, you need to decide whether to use **RPS** or **VUs** as your load type.
44

5-
> [!WARNING]
5+
> [!WARNING]
66
> RPS load type can only be used with a `Gun`, and VUs can only be used with a `VirtualUser`.
77
88
---
@@ -16,6 +16,9 @@ You should use **RPS** when your goal is to measure **throughput**. This load ty
1616

1717
In an RPS-based test, new requests are sent continuously, regardless of how long previous requests take.
1818

19+
> [!NOTE]
20+
> [Read here](./libs/wasp/how-to/rps_per_minute.md) how to define the RPS load in terms of requests per minute or per hour instead of default per second.
21+
1922
### Example RPS Test Diagram
2023
```mermaid
2124
---
@@ -105,5 +108,5 @@ In this model, `VU2` starts only after `VU1` has finished its iteration.
105108
- Workflows that involve multiple steps.
106109
- Scenarios where response time impacts the load generation rate.
107110

108-
> [!NOTE]
111+
> [!NOTE]
109112
> Learn more about open and closed models [here](https://grafana.com/docs/k6/latest/using-k6/scenarios/concepts/open-vs-closed/).
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# WASP - How to configure requests per minute or hour
2+
3+
By default, WASP schedule describes requests **per second**, but what if you want to define the load in terms of requests **per minute** or **per hour**? `RateLimitUnitDuration` to the rescue!
4+
5+
If you want to execute 10 requests per minute, you'd use this generator config:
6+
```go
7+
gen, err := wasp.NewGenerator(&wasp.Config{
8+
LoadType: wasp.RPS,
9+
Schedule: wasp.Plain(10, 2*time.Hour), // plain line profile - 10 requests per minute for 2h
10+
Gun: NewExampleHTTPGun(srv.URL()),
11+
Labels: labels,
12+
LokiConfig: wasp.NewEnvLokiConfig(),
13+
RateLimitUnitDuration: time.Minute, // <---- this is the key setting
14+
})
15+
if err != nil {
16+
panic(err)
17+
}
18+
```
19+
20+
In other words you could say that `RateLimitUnitDuration` represents the *denominator* of rate limit duration and RPS value in the schedule the *numeral*.

0 commit comments

Comments
 (0)