Skip to content

Improve performance of tracker client lookup in SimpleLoadBalancer#1152

Open
idarmans wants to merge 1 commit intolinkedin:masterfrom
idarmans:master
Open

Improve performance of tracker client lookup in SimpleLoadBalancer#1152
idarmans wants to merge 1 commit intolinkedin:masterfrom
idarmans:master

Conversation

@idarmans
Copy link
Copy Markdown
Contributor

@idarmans idarmans commented Mar 2, 2026

SimpleLoadBalancer#getPotentialClients came up as a CPU hotspot in production, and 45% of the CPU usage is spent on URI#hashCode & URI#equals.

The fix is in UriLoadBalancerSubscriber#handlePut, we make sure to use the URI objects out of the incoming UriProperties in the tracker client map, such that the map look up becomes O(1) due to it falling back to identity equality. This fix only costs slightly more memory allocation during updates, with no extra heap usage in the long run.

Added unit tests to cover the identity equality

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant