Skip to content

Commit 2f38159

Browse files
committed
mmaprototype: comment for meanutil
1 parent ac9c647 commit 2f38159

File tree

1 file changed

+17
-1
lines changed
  • pkg/kv/kvserver/allocator/mmaprototype

1 file changed

+17
-1
lines changed

pkg/kv/kvserver/allocator/mmaprototype/load.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,23 @@ type NodeLoad struct {
187187
type meanStoreLoad struct {
188188
load LoadVector
189189
capacity LoadVector
190-
// Util is 0 for CPURate, WriteBandwidth. Non-zero for ByteSize.
190+
// util is the capacity-weighted mean utilization, computed as
191+
// sum(load)/sum(capacity), NOT the average of individual store utilizations.
192+
//
193+
// We use capacity-weighted mean because it answers: "Is this store carrying
194+
// its fair share of load?" rather than "Is this store more utilized than
195+
// typical stores?". This is the desired behavior for heterogeneous clusters
196+
// where ideally all stores run at the same utilization regardless of size.
197+
//
198+
// Example: 3 stores with (load, capacity) = (10, 10), (10, 10), (10, 100)
199+
// - Average of individual utils: (100% + 100% + 10%) / 3 = 70%
200+
// - Capacity-weighted (sum/sum): 30 / 120 = 25%
201+
// The capacity-weighted 25% is the true picture of resource availability,
202+
// and comparing a store's utilization against this tells us if it's
203+
// carrying more than its proportional share.
204+
//
205+
// Util is 0 for WriteBandwidth (since its Capacity is UnknownCapacity).
206+
// Non-zero for CPURate, ByteSize.
191207
util [NumLoadDimensions]float64
192208

193209
secondaryLoad SecondaryLoadVector

0 commit comments

Comments
 (0)