Time-based demand limiting in GenStage


We are on planning stage, so no code here, but as the problem is already on the horizon I would like to know is there are any backed in solutions in the GenStage library.
The challenge we are facing is to limit request rate to 14 or fewer requests per second. The naive approach will be to count time and disperse accordingly in handle_demand, but digging through the Flow documentation, esp Flow.Window nudge me to come and ask if is there an already existing and battle-proven solution to this problem?

1 Like

There is an example of a RateLimiter in GenStage’s documentation: https://hexdocs.pm/gen_stage/Experimental.GenStage.html#module-asynchronous-work-and

Windows are for grouping data, not rate limiting.