Skip to content

RFC: Hash-based routing #1222

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

b1tamara
Copy link

Cloud Foundry uses round-robin and least-connection algorithms for load balancing between Gorouters and backends. Still, they are unsuitable for specific use cases, prompting a proposal to introduce hash-based routing on a per-route basis.

@beyhan beyhan requested review from a team, rkoster, beyhan, stephanme, ameowlia and ChrisMcGowan and removed request for a team June 26, 2025 08:44
@beyhan beyhan added the rfc CFF community RFC label Jun 26, 2025
@b1tamara
Copy link
Author

Hi @beyhan, thanks for picking this up. We are still doing a team-internal review first and keeping this PR in "Draft" state. We will ping again once it's ready for the big stage.

tenant-specific databases. With the current load balancing algorithms, each tenant eventually creates a connection to each
application instance, which then creates connection pools to every customer database. As a result, all tenants might span
up a full mesh, leading to too many open connections to the customer databases, impacting performance. This limitation
represents a gap in achieving optimal load distribution and can be solved with routing based on a tenant.
Copy link
Member

Choose a reason for hiding this comment

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

"enhance load distribution" and "achieving optimal load distribution" depend very much on what you consider the optimal distribution. Ordinarily I would say the most (load) balanced situation is when each instance is experiencing exactly the same load but with hash-based we deliberately sacrifice this goal because we know that there is a more efficient way which might not be as fair as rr or lc but optimizes the overall resource consumption of the system (which you do mention later on in line 42f.

See also:

  • line 14
  • line 34


[Maglev hashing](https://storage.googleapis.com/gweb-research2023-media/pubtools/2904.pdf) can be considered as a possible solution.

N hashes can be associated with one application instance. The number of hashes is a multiple of the number of application instances.
Copy link
Member

Choose a reason for hiding this comment

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

This sentence seems a bit disconnected. Either you spend a paragraph summarizing Maglev hashing or you don't and people have to read the paper. But just having this once sentence is probably confusing if you are not already into the details.

The options are raw JSON and will be passed directly to the Gorouter without any modifications.

#### Route-Registrar
No use cases are known to implement hash-based routing for the platform-related routes.
Copy link
Member

Choose a reason for hiding this comment

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

This seems unfair, couldn't we just include it for completeness?

Copy link
Author

Choose a reason for hiding this comment

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

You are right that it is unfair, but I would rather avoid implementing a feature that won't be used.
However, we are open to hearing about any use cases where it might be beneficial.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a rewording helps? I agree on not including it in the "MVP" that is implemented via this RFC. Would be open to re-discuss if the panel/reviwers come up with use-cases

Suggested change
No use cases are known to implement hash-based routing for the platform-related routes.
In the scope of this RFC, it is not planned to implement hash-based routing in route-registrar for platform-routes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rfc CFF community RFC
Projects
Status: Inbox
Development

Successfully merging this pull request may close these issues.

4 participants