Overview
The throttle transform caps the throughput of a stream by buffering records into batches and emitting each batch on a fixed minimum interval. Use it to:- Stay under rate limits of downstream sinks or external APIs
- Smooth out bursty sources into a steady, predictable rate
- Test sink behavior at a controlled records-per-second rate
- Reduce pressure on small resource sizes during development
Configuration
Parameters
string
required
Must be
throttlestring
required
The source or transform to read data from
integer
default:"100"
Row budget per
min_batch_interval. Must be greater than 0. Defaults to
100.duration
default:"1s"
Minimum time between emissions, in
humantime format (e.g., 500ms, 1s,
2m). Must be greater than 0. Defaults to 1s.Invalid values (
max_batch_size: 0, an unparseable duration, etc.) fail at
pipeline start with a configuration error.How throttling works
Batches arrive from the upstream source or transform and pass through unchanged. The throttle paces when each batch is released so that the long-run row rate does not exceedmax_batch_size rows per min_batch_interval.
For each incoming batch of rows rows:
- If the schedule says the throttle is not yet eligible to emit, it sleeps until it is.
- The batch is emitted downstream, unchanged.
-
The next-eligible time advances by:
max_batch_size: 100, min_batch_interval: 1s:
“Rows per second” here is the average throughput the downstream system
needs to handle, not literal requests or messages per second. The throttle
emits one batch per interval; sinks consume that batch in whatever way is
natural for them. For example, an S3 sink writes one file per interval at
the configured batch size.
Throttle limits the maximum rate, not the minimum. If the upstream is
slow, batches will be smaller and arrive less frequently. Empty batches
pass through immediately and do not advance the schedule.
Backpressure
When the throttle is sleeping, its input slot fills up and the upstream stage’s send blocks. That stall walks all the way back to the source, so no batches are dropped and in-flight memory stays bounded. Shutdown is not delayed by a longmin_batch_interval — an in-flight sleep is cancelled when the pipeline terminates.
Example
Throttle a high-volume ERC-20 transfer stream down to ~10 rps before sending it to a sink:When to use throttle
- Rate-limited sinks: Stay under per-second write quotas on downstream APIs or databases.
- External handler protection: Pace records into an HTTP handler so the receiving service is not overwhelmed.
- Cost control during development: Slow down processing while iterating on a pipeline against a live source.
- Testing: Reproduce sink behavior under a known, fixed input rate.
Best Practices
1
Place throttle close to the bottleneck
Throttle the stream just before the rate-limited sink or handler so
upstream transforms still process at full speed.
2
Tune batch size to your sink
Larger
max_batch_size reduces per-batch overhead but increases latency
per record. Pick a size that matches your sink’s preferred batch size.3
Remove throttle in production where possible
Throttle caps throughput by design. Once rate-limit concerns are addressed,
remove the transform to let the pipeline run at full speed.