Skip to content

Commit 27c7c7c

Browse files
committed
asim: use cluster setting for some non-simulation settings
Previously, we began populating cluster settings in the simulator to allow direct use of non-simulation settings. This commit updates LoadThreshold, kvserver.LBRebalancingObjective, and allocatorimpl.LoadRebalanceRequiredMinDiff to use values from the populated cluster settings directly. Epic: none Release note: none
1 parent e8dc440 commit 27c7c7c

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

pkg/kv/kvserver/asim/config/settings.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ const (
3030
defaultLBRebalancingMode = 2 // Leases and replicas.
3131
defaultLBRebalancingInterval = time.Minute
3232
defaultLBRebalanceQPSThreshold = 0.1
33-
defaultLBMinRequiredQPSDiff = 200
3433
defaultLBRebalancingObjective = 0 // QPS
3534
)
3635

@@ -105,13 +104,6 @@ type SimulationSettings struct {
105104
// LBRebalancingInterval controls how often the store rebalancer will
106105
// consider opportunities for rebalancing.
107106
LBRebalancingInterval time.Duration
108-
// LBRebalanceQPSThreshold is the fraction above or below the mean store QPS,
109-
// that a store is considered overfull or underfull.
110-
LBRebalanceQPSThreshold float64
111-
// LBMinQPSDifferenceForTransfers is the minimum QPS difference that the store
112-
// rebalancer would care to reconcile (via lease or replica rebalancing) between
113-
// any two stores.
114-
LBMinRequiredQPSDiff float64
115107
// ReplicateQueueEnabled controls whether the replicate queue is enabled.
116108
ReplicateQueueEnabled bool
117109
// LeaseQueueEnabled controls whether the lease queue is enabled.
@@ -147,8 +139,6 @@ func DefaultSimulationSettings() *SimulationSettings {
147139
LBRebalancingMode: defaultLBRebalancingMode,
148140
LBRebalancingObjective: defaultLBRebalancingObjective,
149141
LBRebalancingInterval: defaultLBRebalancingInterval,
150-
LBRebalanceQPSThreshold: defaultLBRebalanceQPSThreshold,
151-
LBMinRequiredQPSDiff: defaultLBMinRequiredQPSDiff,
152142
ReplicateQueueEnabled: true,
153143
LeaseQueueEnabled: true,
154144
SplitQueueEnabled: true,

pkg/kv/kvserver/asim/storerebalancer/store_rebalancer.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package storerebalancer
77

88
import (
99
"context"
10+
"fmt"
1011
"time"
1112

1213
"github.com/cockroachdb/cockroach/pkg/kv/kvserver"
@@ -128,14 +129,15 @@ func (s simRebalanceObjectiveProvider) Objective() kvserver.LBRebalancingObjecti
128129
}
129130

130131
func (src *storeRebalancerControl) scorerOptions() *allocatorimpl.LoadScorerOptions {
132+
dim := kvserver.LBRebalancingObjective(src.settings.LBRebalancingObjective).ToDimension()
131133
return &allocatorimpl.LoadScorerOptions{
132134
IOOverloadOptions: src.allocator.IOOverloadOptions(),
133135
DiskOptions: src.allocator.DiskOptions(),
134136
Deterministic: true,
135-
LoadDims: []load.Dimension{load.Queries},
136-
LoadThreshold: allocatorimpl.MakeQPSOnlyDim(src.settings.LBRebalanceQPSThreshold),
137-
MinLoadThreshold: allocatorimpl.LoadMinThresholds(load.Queries),
138-
MinRequiredRebalanceLoadDiff: allocatorimpl.MakeQPSOnlyDim(src.settings.LBMinRequiredQPSDiff),
137+
LoadDims: []load.Dimension{dim},
138+
LoadThreshold: allocatorimpl.LoadThresholds(&src.settings.ST.SV, dim),
139+
MinLoadThreshold: allocatorimpl.LoadMinThresholds(dim),
140+
MinRequiredRebalanceLoadDiff: allocatorimpl.LoadRebalanceRequiredMinDiff(&src.settings.ST.SV, dim),
139141
}
140142
}
141143

pkg/kv/kvserver/asim/tests/datadriven_simulation_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,6 @@ func TestDataDriven(t *testing.T) {
500500
scanIfExists(t, d, "split_queue_enabled", &settingsGen.Settings.SplitQueueEnabled)
501501
scanIfExists(t, d, "rebalance_mode", &settingsGen.Settings.LBRebalancingMode)
502502
scanIfExists(t, d, "rebalance_interval", &settingsGen.Settings.LBRebalancingInterval)
503-
scanIfExists(t, d, "rebalance_qps_threshold", &settingsGen.Settings.LBRebalanceQPSThreshold)
504503
scanIfExists(t, d, "split_qps_threshold", &settingsGen.Settings.SplitQPSThreshold)
505504
scanIfExists(t, d, "rebalance_range_threshold", &settingsGen.Settings.RangeRebalanceThreshold)
506505
scanIfExists(t, d, "gossip_delay", &settingsGen.Settings.StateExchangeDelay)

0 commit comments

Comments
 (0)