fix: Fix diskNormalized cost balancer strategy#19303
Merged
jtuglu1 merged 3 commits intoapache:masterfrom Apr 23, 2026
Merged
Conversation
169a2e1 to
63e5b04
Compare
maytasm
approved these changes
Apr 23, 2026
Contributor
maytasm
left a comment
There was a problem hiding this comment.
nit: diskUtilThresholdTolerance is a weird name. It doesn't indicate that a segment is already on the server. Maybe like a ...stickiness... or ...movingCost... is better?
34e2003 to
13c5d4d
Compare
13c5d4d to
ddad803
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
We've seen issues with the
costsegment balancing strategy not working correctly in production, where it leaves historicals in a tier in a bimodal distribution: ~50% in ~100% utilization and ~50% in 60% utilization. This is due to the cost-based balancer not having any visibility into disk util on each historical. The diskNormalized strategy is available, but is marked as not "production-ready," I believe due to the following reason:The “diskNormalized” balancer works by extending from the “cost” balancer and overriding the computeCost function in the following way:
This logic is a bit strange. Consider the case where historicals are all homogeneous, so server.getServer().getMaxSize() can be treated as a constant. In that case, the returned value simplifies to:
So, in practice, it’s just adjusting cost by a factor of avgSegmentSize. This could lead to imbalances that make themselves worse over time, especially if newly created segments tend to have smaller sizes than older ones (which is common with append-based ingestion methods).
This fixes the diskNormalized strategy just weight the
CostBalancerStrategywith the utilization of the server, defaulting to a 5% lenience threshold (TODO: make this adjustable via config?) to avoid ping-ponging segments between 2 historicals due to utilization differences.Release note
Fix diskNormalized cost balancer strategy
This PR has: