Skip to content

Dynamic Maglev Table Sizing Based on Application Instance Count #556

@b1tamara

Description

@b1tamara

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Inbox

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions