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

Rate limit multiple batch sends #14802

Open
powersj opened this issue Feb 13, 2024 · 1 comment
Open

Rate limit multiple batch sends #14802

powersj opened this issue Feb 13, 2024 · 1 comment
Assignees
Labels
feature request Requests for new plugin and for new features to existing plugins

Comments

@powersj
Copy link
Contributor

powersj commented Feb 13, 2024

Use Case

In the case or scenario where an output goes down for a little bit, the buffer will accumulate metrics. Once connectivity is restored to the output, then the output could get hit essentially a mini-DOS of batches from telegraf. Telegraf will send multiple batches immediately, rather than gently sending them.

Expected behavior

Opt-in configuration option to allow turning rate limiting on.

Actual behavior

Lots of messages sent at once, for example from an old issue:

2021-09-21T20:10:30Z D! [outputs.influxdb_v2] Wrote batch of 1500 metrics in 40.980832ms
2021-09-21T20:10:30Z D! [outputs.influxdb_v2] Wrote batch of 1500 metrics in 28.129692ms
2021-09-21T20:10:30Z D! [outputs.influxdb_v2] Wrote batch of 1500 metrics in 25.840982ms
2021-09-21T20:10:30Z D! [outputs.influxdb_v2] Wrote batch of 1500 metrics in 30.648302ms
2021-09-21T20:10:31Z D! [outputs.influxdb_v2] Wrote batch of 1500 metrics in 35.806018ms
2021-09-21T20:10:31Z D! [outputs.influxdb_v2] Wrote batch of 1500 metrics in 68.213211ms
2021-09-21T20:10:31Z D! [outputs.influxdb_v2] Wrote batch of 1500 metrics in 22.580247ms
2021-09-21T20:10:31Z D! [outputs.influxdb_v2] Wrote batch of 1500 metrics in 20.719449ms
2021-09-21T20:10:31Z D! [outputs.influxdb_v2] Wrote batch of 500 metrics in 33.120372ms
2021-09-21T20:10:31Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 50000 metrics

Additional info

Go includes a rate limiting package: https://pkg.go.dev/golang.org/x/time/rate that we could make use of in the flushLoop or in the flushBatch functions.

@powersj powersj added the feature request Requests for new plugin and for new features to existing plugins label Feb 13, 2024
@powersj powersj assigned DStrand1 and srebhan and unassigned DStrand1 Feb 21, 2024
@powersj
Copy link
Contributor Author

powersj commented Feb 26, 2024

next steps: look into this

@srebhan srebhan changed the title Rate limit multiple batche sends Rate limit multiple batch sends May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requests for new plugin and for new features to existing plugins
Projects
None yet
Development

No branches or pull requests

3 participants