Skip to content

Commit

Permalink
roachtest: add bandwidth limit to perturbation/* tests
Browse files Browse the repository at this point in the history
This change adds the ability to set the bandwidth limit for all the
perturbation/* tests. The default full tests still run without it set to
mimic the behavior of the "out of the box" configuration, but the
metamorphic tests will choose a bandwidth limit and it can be set for
manual testing using an env variable.

Epic: none

Release note: None
  • Loading branch information
andrewbaptist committed Nov 15, 2024
1 parent 62303c3 commit 0b7966d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pkg/cmd/roachtest/tests/perturbation/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ type variations struct {
acceptableChange float64
cloud registry.CloudSet
acMode admissionControlMode
diskBandwidthLimit string
profileOptions []roachtestutil.ProfileOptionFunc
specOptions []spec.Option
clusterSettings map[string]string
Expand All @@ -108,6 +109,7 @@ var numDisks = []int{1, 2}
var memOptions = []spec.MemPerCPU{spec.Low, spec.Standard, spec.High}
var cloudSets = []registry.CloudSet{registry.OnlyAWS, registry.OnlyGCE, registry.OnlyAzure}
var admissionControlOptions = []admissionControlMode{elasticOnlyBoth, fullNormalElasticRepl, fullBoth}
var diskBandwidthLimitOptions = []string{"0", "350MiB"}

var leases = []registry.LeaseType{
registry.EpochLeases,
Expand Down Expand Up @@ -187,10 +189,12 @@ func (a admissionControlMode) getSettings() map[string]string {
func (v variations) String() string {
return fmt.Sprintf("seed: %d, fillDuration: %s, maxBlockBytes: %d, perturbationDuration: %s, "+
"validationDuration: %s, ratioOfMax: %f, splits: %d, numNodes: %d, numWorkloadNodes: %d, "+
"vcpu: %d, disks: %d, memory: %s, leaseType: %s, cloud: %v, acMode: %s, perturbation: %+v",
"vcpu: %d, disks: %d, memory: %s, leaseType: %s, cloud: %v, acMode: %s, diskBandwidthLimit %s, "+
"perturbation: %+v",
v.seed, v.fillDuration, v.maxBlockBytes,
v.perturbationDuration, v.validationDuration, v.ratioOfMax, v.splits, v.numNodes, v.numWorkloadNodes,
v.vcpu, v.disks, v.mem, v.leaseType, v.cloud, v.acMode, v.perturbation)
v.vcpu, v.disks, v.mem, v.leaseType, v.cloud, v.acMode, v.diskBandwidthLimit,
v.perturbation)
}

// Normally a single worker can handle 20-40 nodes. If we find this is
Expand All @@ -213,6 +217,7 @@ func (v variations) randomize(rng *rand.Rand) variations {
v.cloud = registry.OnlyGCE
v.mem = memOptions[rng.Intn(len(memOptions))]
v.acMode = admissionControlOptions[rng.Intn(len(admissionControlOptions))]
v.diskBandwidthLimit = diskBandwidthLimitOptions[rng.Intn(len(diskBandwidthLimitOptions))]
return v
}

Expand All @@ -233,6 +238,7 @@ func setup(p perturbation, acceptableChange float64) variations {
v.ratioOfMax = 0.5
v.cloud = registry.OnlyGCE
v.mem = spec.Standard
v.diskBandwidthLimit = "0"
v.perturbation = p
v.profileOptions = []roachtestutil.ProfileOptionFunc{
roachtestutil.ProfDbName("target"),
Expand Down Expand Up @@ -295,6 +301,7 @@ func (v variations) finishSetup() variations {
}
// Enable raft tracing. Remove this once raft tracing is the default.
v.clusterSettings["kv.raft.max_concurrent_traces"] = "10"
v.clusterSettings["kvadmission.store.provisioned_bandwidth"] = v.diskBandwidthLimit
return v
}

Expand Down Expand Up @@ -326,6 +333,8 @@ func (v *variations) applyEnvOverride(key string, val string) (err error) {
if v.mem == -1 {
err = errors.Errorf("unknown memory setting: %s", val)
}
case "diskBandwidthLimit":
v.diskBandwidthLimit = val
case "leaseType":
for _, l := range leases {
if l.String() == val {
Expand Down

0 comments on commit 0b7966d

Please sign in to comment.