Throttle
The Throttle filter sets the average Rate
of messages per Interval
, based on the leaky bucket and sliding window algorithm. In case of flooding, it will leak at a certain rate.
Configuration parameters
The plugin supports the following configuration parameters:
Rate
Integer
Amount of messages for the time.
Window
Integer
Amount of intervals to calculate average over. Default: 5
.
Interval
String
Time interval, expressed in sleep
format. For example, 3s
, 1.5m
, 0.5h
.
Print_Status
Bool
Whether to print status messages with current rate and the limits to information logs.
Functional description
Using the following configuration:
You would receive 1 message in the first second, 3 messages second, and 5 third. Disregard that Window is actually 5, because the configuration uses slow
start to prevent flooding during the startup.
But as soon as you reach Window size * Interval
, you will have true sliding window with aggregation over complete window.
When the average over window is more than Rate
, Fluent Bit starts dropping messages, so the following:
will become:
The last pane of the window was overwritten and 1 message was dropped.
Interval versus Window size
You might notice it's possible to configure the Interval
of the Window
shift. It's counter intuitive, but there is a difference between the two previous examples:
and
Even though both examples will allow maximum Rate
of 60 messages per minute, the first example might get all 60 messages within first second, and will drop all the rest for the entire minute:
While the second example won't allow more than 1 message per second every second, making output rate more smooth:
Fluent Bit might drop some data if the rate is ragged. Use bigger intervals and rates for streams of rare but important events, while keeping Window
bigger and Interval
smaller for constantly intensive inputs.
Command line
It's suggested to use a configuration file.
The following command will load the Tail plugin and read the content of the lines.txt
file. Then, the Throttle filter will apply a rate limit and only pass the records which are read below the rate
:
Configuration File
This example will pass 1000 messages per second in average over 300 seconds.
Last updated
Was this helpful?