Skip to content

Commit b738ccd

Browse files
committed
roachtest: add buffered-writes variants of TPCC bench
This commit adds the following variants of TPCC bench: - write buffering enabled, pipelining enabled (by default), - write buffering enabled, pipelining disabled. The former will help us compare the performance of buffered writes to the default setup, and the latter will inform our decision to replace pipelining with buffering altogether. Part of: #148235 Release note: None
1 parent 1527d0a commit b738ccd

File tree

3 files changed

+103
-0
lines changed

3 files changed

+103
-0
lines changed

pkg/cmd/roachtest/registry/test_spec.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ type TestSpec struct {
131131
// to epoch leases.
132132
Leases LeaseType
133133

134+
// WriteOptimization specifies what kind of write optimization to use.
135+
// Defaults to pipelining. This is currently used only in benchmark tests.
136+
// If used in a non-benchmark test, this setting will be overwritten to enable
137+
// pipelining and additionally, with 50% probability, buffering.
138+
WriteOptimization WriteOptimizationType
139+
134140
// SkipPostValidations is a bit-set of post-validations that should be skipped
135141
// after the test completes. This is useful for tests that are known to be
136142
// incompatible with some validations. By default, tests will run all
@@ -284,6 +290,35 @@ const (
284290
// The list does not contain aliases like "default" and "metamorphic".
285291
var LeaseTypes = []LeaseType{EpochLeases, ExpirationLeases, LeaderLeases}
286292

293+
// WriteOptimizationType specifies the type of write optimization to use.
294+
type WriteOptimizationType int
295+
296+
func (w WriteOptimizationType) String() string {
297+
switch w {
298+
case DefaultWriteOptimization:
299+
return "default"
300+
case Pipelining:
301+
return "pipelining"
302+
case Buffering:
303+
return "buffering"
304+
case PipeliningBuffering:
305+
return "pipelining-buffering"
306+
default:
307+
return fmt.Sprintf("writeoptimization-%d", w)
308+
}
309+
}
310+
311+
const (
312+
// DefaultWriteOptimization uses the default cluster settings.
313+
DefaultWriteOptimization = WriteOptimizationType(iota)
314+
// Pipelining uses write pipelining.
315+
Pipelining
316+
// Buffering uses client-side write buffering.
317+
Buffering
318+
// PipeliningBuffering uses both buffering and pipelining.
319+
PipeliningBuffering
320+
)
321+
287322
// CloudSet represents a set of clouds.
288323
//
289324
// Instances of CloudSet are immutable. The uninitialized (zero) value is not

pkg/cmd/roachtest/test_runner.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,22 @@ func (r *testRunner) runWorker(
933933
t.Fatalf("unknown lease type %s", leases)
934934
}
935935

936+
// Choose which write optimization to use. These are currently used only
937+
// in benchmark tests. For non-benchmark tests, write buffering will be
938+
// enabled metamorphically below.
939+
switch testSpec.WriteOptimization {
940+
case registry.DefaultWriteOptimization:
941+
case registry.Pipelining:
942+
c.clusterSettings["kv.transaction.write_pipelining.enabled"] = "true"
943+
c.clusterSettings["kv.transaction.write_buffering.enabled"] = "false"
944+
case registry.Buffering:
945+
c.clusterSettings["kv.transaction.write_buffering.enabled"] = "true"
946+
c.clusterSettings["kv.transaction.write_pipelining.enabled"] = "false"
947+
case registry.PipeliningBuffering:
948+
c.clusterSettings["kv.transaction.write_pipelining.enabled"] = "true"
949+
c.clusterSettings["kv.transaction.write_buffering.enabled"] = "true"
950+
}
951+
936952
// Apply metamorphic settings not explicitly defined by the test.
937953
// These settings should only be applied to non-benchmark tests.
938954
if !testSpec.Benchmark {

pkg/cmd/roachtest/tests/tpcc.go

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,6 +1619,50 @@ func registerTPCC(r registry.Registry) {
16191619
Clouds: registry.OnlyGCE,
16201620
Suites: registry.Suites(registry.Weekly),
16211621
})
1622+
1623+
// Buffered writes benchmarks. These are duplicates of variants above.
1624+
1625+
// A variant with only buffering enabled (pipelining disabled).
1626+
registerTPCCBenchSpec(
1627+
r, tpccBenchSpec{
1628+
Nodes: 3,
1629+
CPUs: 16,
1630+
1631+
LoadWarehousesGCE: 3500,
1632+
LoadWarehousesAWS: 3900,
1633+
LoadWarehousesAzure: 3900,
1634+
LoadWarehousesIBM: 3900,
1635+
EstimatedMaxGCE: 3100,
1636+
EstimatedMaxAWS: 3600,
1637+
EstimatedMaxAzure: 3600,
1638+
EstimatedMaxIBM: 3600,
1639+
WriteOptimization: registry.Buffering,
1640+
1641+
Clouds: registry.AllClouds,
1642+
Suites: registry.Suites(registry.Nightly),
1643+
},
1644+
)
1645+
1646+
// A variant with pipelining and buffering both enabled.
1647+
registerTPCCBenchSpec(
1648+
r, tpccBenchSpec{
1649+
Nodes: 3,
1650+
CPUs: 16,
1651+
1652+
LoadWarehousesGCE: 3500,
1653+
LoadWarehousesAWS: 3900,
1654+
LoadWarehousesAzure: 3900,
1655+
LoadWarehousesIBM: 3900,
1656+
EstimatedMaxGCE: 3100,
1657+
EstimatedMaxAWS: 3600,
1658+
EstimatedMaxAzure: 3600,
1659+
EstimatedMaxIBM: 3600,
1660+
WriteOptimization: registry.PipeliningBuffering,
1661+
1662+
Clouds: registry.AllClouds,
1663+
Suites: registry.Suites(registry.Nightly),
1664+
},
1665+
)
16221666
}
16231667

16241668
func valueForCloud(cloud spec.Cloud, gce, aws, azure, ibm int) int {
@@ -1730,6 +1774,9 @@ type tpccBenchSpec struct {
17301774
// SharedProcessMT, if true, indicates that the cluster should run in
17311775
// shared-process mode of multi-tenancy.
17321776
SharedProcessMT bool
1777+
// WriteOptimization specifies the write optimization to use (e.g. pipelining,
1778+
// buffering, or both).
1779+
WriteOptimization registry.WriteOptimizationType
17331780
}
17341781

17351782
func (s tpccBenchSpec) EstimatedMax(cloud spec.Cloud) int {
@@ -1829,6 +1876,10 @@ func registerTPCCBenchSpec(r registry.Registry, b tpccBenchSpec) {
18291876
nameParts = append(nameParts, "mt-shared-process")
18301877
}
18311878

1879+
if b.WriteOptimization != registry.DefaultWriteOptimization {
1880+
nameParts = append(nameParts, fmt.Sprintf("write-optimization=%s", b.WriteOptimization.String()))
1881+
}
1882+
18321883
name := strings.Join(nameParts, "/")
18331884

18341885
numNodes := b.Nodes + b.LoadConfig.numLoadNodes(b.Distribution)
@@ -1844,6 +1895,7 @@ func registerTPCCBenchSpec(r registry.Registry, b tpccBenchSpec) {
18441895
Suites: b.Suites,
18451896
EncryptionSupport: encryptionSupport,
18461897
Leases: leases,
1898+
WriteOptimization: b.WriteOptimization,
18471899
PostProcessPerfMetrics: getMaxWarehousesAboveEfficiency,
18481900
Run: func(ctx context.Context, t test.Test, c cluster.Cluster) {
18491901
runTPCCBench(ctx, t, c, b)

0 commit comments

Comments
 (0)