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

Scale Preset should prevent Thundering Herd issue with many Agents #4469

Open
3 tasks
StephanErb opened this issue Mar 22, 2024 · 4 comments
Open
3 tasks

Scale Preset should prevent Thundering Herd issue with many Agents #4469

StephanErb opened this issue Mar 22, 2024 · 4 comments
Assignees
Labels
Team:Elastic-Agent Label for the Agent team Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Comments

@StephanErb
Copy link

StephanErb commented Mar 22, 2024

Describe the enhancement:

The scale preset introduced in elastic/kibana#166870 and #3797 is a great start to make agent ingestion more scalable. However, assuming one wants to ingest using thousand of agents, there is a high risk of a thundering herd problem. If Elastic starts choking the the agents reconnect and retry logic further increases the load on the cluster. This might kick the entire system over the edge.

This should be addressed with further options being tuned by the preset.

Describe a specific use case for the enhancement or feature:

The scale preset should adjust the following additional options:

  • backoff.init and backoff.max should use a higher default and leverage a jitter. There is currently no jitter in the backoff which leads to a synchronized retry across all agents.
  • max_retries should be reduced for metric data sets (but not logs). It is better to focus on delivering recent data then retrying the delivery of outdated scrapes. This will act as a form of back pressure to ensure a single failure does not lead to further increased load on the server side.

What is the definition of done?

Better defaults with no actions needed by users.

Implementation tasks

Preview Give feedback
@cmacknz
Copy link
Member

cmacknz commented Mar 22, 2024

backoff.init and backoff.max should use a higher default and leverage a jitter. There is currently no jitter in the backoff which leads to a synchronized retry across all agents.

+1 thanks for pointing this out, we should be using pseudo-random exponential backoff, not just exponential backoff.

max_retries should be reduced for metric data sets (but not logs).

Metricbeat should already default to 3 retries, while Filebeat defaults to infinite retries. Agent doesn't modify this part of the Metricbeat configuration. https://www.elastic.co/guide/en/beats/metricbeat/current/elasticsearch-output.html#_max_retries

@cmacknz cmacknz added the Team:Elastic-Agent Label for the Agent team label Mar 22, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent (Team:Elastic-Agent)

@cmacknz
Copy link
Member

cmacknz commented Mar 22, 2024

https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/ has the modifications to the backoff algorithm we should make along with their relative performance.

@pierrehilbert pierrehilbert added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label May 21, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Elastic-Agent Label for the Agent team Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

No branches or pull requests

5 participants