Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify how burst limits config works in Promtail #6768

Open
salvacorts opened this issue Jul 26, 2022 · 3 comments
Open

Clarify how burst limits config works in Promtail #6768

salvacorts opened this issue Jul 26, 2022 · 3 comments
Assignees
Labels
component/promtail help wanted We would love help on these issues. Please come help us! type/docs Issues related to technical documentation; the Docs Squad uses this label across many repositories

Comments

@salvacorts
Copy link
Contributor

salvacorts commented Jul 26, 2022

The documentation for Promtail's readline_burst limit is not clear enough about when bursts are allowed. It currently states the following:

# The cap in the quantity of burst lines that this instance of Promtail may push
# to Loki.
[readline_burst: <int> | default = 10000]

We use golang.org/x/time/rate under the hood. Where b is readline_burst and r is readline_rate. According to it’s documentation:

… It implements a “token bucket” of size b, initially full and refilled at rate r tokens per second. Informally, in any large enough time interval, the Limiter limits the rate to r tokens per second, with a maximum burst size of b events … See https://en.wikipedia.org/wiki/Token_bucket for more about token buckets.

In other words, the average rate will be readline_rate, but bursts up to a size of readline_burst are allowed from time to time.

The burst limit is enforced here: https://github.com/golang/time/blob/579cf78fd858857c0d766e0d63eb2b0ccf29f436/rate/rate.go#L396-L398

For example, If readline_rate is 100 and readline_burst is 200, and they send 150 items exactly once per second, then the first 150 will go through, and thereafter, they will be able to send up to 100 items per second. If they stopped sending for 2 seconds, they could send 150 in one go again and subsequent sends will be limited to 100 items per second. In any case, if the rate is above readline_burst, for example 250, the 50 items over the bust size will be dropped.

Note that there are other burst limits within Loki that maybe benefit from the clarification of Promtail's readline_burst. Here is a list:

  • ingestion_burst_size_mb: The documentation for this limit config is more clear than Promtail's readline_burst, but there may be room for improvement.
  • per_stream_rate_limit_burst
  • rate_limit_burst
@salvacorts salvacorts added the type/docs Issues related to technical documentation; the Docs Squad uses this label across many repositories label Jul 26, 2022
@KMiller-Grafana KMiller-Grafana self-assigned this Jul 26, 2022
@KMiller-Grafana
Copy link
Contributor

Slack discussion on the definitions and how the rate/burst work: https://raintank-corp.slack.com/archives/C029V4SSS9L/p1658750411188449.

@GrafanaWriter
Copy link
Contributor

@KMiller-Grafana to identify what's completed and what is still in need of development, splitting the issue in two.

@GrafanaWriter
Copy link
Contributor

@JStickler - can you please review with the team to prioritize?

@JStickler JStickler added the help wanted We would love help on these issues. Please come help us! label Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/promtail help wanted We would love help on these issues. Please come help us! type/docs Issues related to technical documentation; the Docs Squad uses this label across many repositories
Projects
None yet
Development

No branches or pull requests

5 participants