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

chore: Remove ring client pool from JumpHashClientPool #14367

Merged
merged 5 commits into from
Oct 3, 2024

Conversation

chaudum
Copy link
Contributor

@chaudum chaudum commented Oct 3, 2024

What this PR does / why we need it:

The ring client pool has functionality, such as periodic health checking of the servers and removing of stale clients, which is not needed in the JumpHashClientPool.

The removal of stale clients was problematic, because it compared the original server list (which is a list of CNAME records from the DNS lookup) with the client cache, which uses the IP of the server as key. Therefore it removed all cached clients on every check interval.

Special notes for your reviewer:

screenshot_20241003_102636

On the left side of the screenshot the index gateways use the current implementation of the client pool, then on the right side, the index gateways were updated to the new implementation. Cancelled requests are gone.

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR

@chaudum chaudum requested a review from a team as a code owner October 3, 2024 08:28
@github-actions github-actions bot added the type/docs Issues related to technical documentation; the Docs Squad uses this label across many repositories label Oct 3, 2024
// ServerList deterministically maps keys to _index_ of the server list.
// Since DNS returns records in different order each time, we sort to
// guarantee best possible match between nodes.
sort.Strings(servers)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lexicographic sort isn't necessary here (and is incorrect for jumphash); jumphash needs natural sorting of servers so that z11 sorts after z2. The call to SetServers below will do a natural sort at the top of its implementation.

if err != nil {
return nil, err
}
p.clients[addr] = client
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it OK that nothing ever gets removed from p.clients?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so. Worst thing is that we keep a couple of unused client objects around that are not actively used.

@chaudum chaudum force-pushed the chaudum/remove-ring-client-pool branch from 4344ec1 to 4cc6b85 Compare October 3, 2024 14:02
@chaudum chaudum merged commit 46f61fd into main Oct 3, 2024
61 checks passed
@chaudum chaudum deleted the chaudum/remove-ring-client-pool branch October 3, 2024 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L type/docs Issues related to technical documentation; the Docs Squad uses this label across many repositories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants