cloudfoundry / cloudfoundry/routing-release
Dynamic Maglev Table Sizing Based on Application Instance Count
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 176
- Forks
- 114
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 6
Description
Proposed Change
As a developer of applications with varying numbers of instances using hash-based routing
I want Maglev lookup table sizes to be calculated dynamically based on the number of application instances per route pool
So that I can ensure better hash distribution for large pools.
The current implementation uses a hard-coded lookup table size of 3001 for the Maglev consistent hashing algorithm across all route pools. According to the Maglev paper recommendations, the optimal table size should be approximately 100× the number of application instances per pool. The size of 3001 may provide insufficient distribution for large pools.
Acceptance criteria
- Maglev lookup table size is dynamically calculated as the nearest prime number to 100 × number_of_instances per route pool
- When instances are added, table size is calculated with a buffer to prevent frequent resizing when instance counts fluctuate slightly; table only resizes when actual instance count exceeds the buffered capacity
- When instances are removed, the table size does not change to prevent frequent remapping of hashes
- Minimum table size is defined
- Maximum table size is defined to prevent excessive memory usage
- Table size changes are logged with appropriate level
Related links
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/code.cloudfoundry.org/gorouter/route/maglev.go, especially the current hard-coded table size, then review the linked hash-based routing pull request and RFC0042. Define and implement the sizing, buffering, minimum, maximum, removal, and logging behavior so every acceptance criterion is met without unnecessary remapping.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100