Skip to content

Commit

Permalink
storage: remove batch=true variants of BenchmarkMVCCPut
Browse files Browse the repository at this point in the history
This benchmark has batching variants but the batch size is `b.N` which
can hit the 4GB batch limit.

Given that we already have a separate `MVCCBatchPut` which has
reasonable batch sizes, we are removing the batched variants of
`BenchmarkMVCCPut`.

Fixes: #115811
Release note: None
  • Loading branch information
RaduBerinde committed Dec 7, 2023
1 parent 445e254 commit e933c3b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 25 deletions.
28 changes: 11 additions & 17 deletions pkg/storage/bench_pebble_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,40 +408,34 @@ func BenchmarkMVCCPut_Pebble(b *testing.B) {
defer log.Scope(b).Close(b)

type testCase struct {
batch bool
valueSize int
versions int
}
var testCases []testCase

for _, batch := range []bool{false, true} {
for _, valueSize := range []int{10, 100, 1000, 10000} {
for _, versions := range []int{1, 10} {
testCases = append(testCases, testCase{
batch: batch,
valueSize: valueSize,
versions: versions,
})
}
for _, valueSize := range []int{10, 100, 1000, 10000} {
for _, versions := range []int{1, 10} {
testCases = append(testCases, testCase{
valueSize: valueSize,
versions: versions,
})
}
}

if testing.Short() {
// Choose a few configurations for the short version.
testCases = []testCase{
{batch: false, valueSize: 10, versions: 1},
{batch: true, valueSize: 1000, versions: 10},
{valueSize: 10, versions: 1},
{valueSize: 1000, versions: 10},
}
}

for _, tc := range testCases {
name := fmt.Sprintf(
"batch=%t/valueSize=%d/versions=%d",
tc.batch, tc.valueSize, tc.versions,
)
// We use "batch=false" so that we can compare with corresponding benchmarks in older branches.
name := fmt.Sprintf("batch=false/valueSize=%d/versions=%d", tc.valueSize, tc.versions)
b.Run(name, func(b *testing.B) {
ctx := context.Background()
runMVCCPut(ctx, b, setupMVCCInMemPebble, tc.valueSize, tc.versions, tc.batch)
runMVCCPut(ctx, b, setupMVCCInMemPebble, tc.valueSize, tc.versions)
})
}
}
Expand Down
9 changes: 1 addition & 8 deletions pkg/storage/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -876,9 +876,7 @@ func runMVCCGet(ctx context.Context, b *testing.B, opts mvccBenchData, useBatch
b.StopTimer()
}

func runMVCCPut(
ctx context.Context, b *testing.B, emk engineMaker, valueSize, versions int, useBatch bool,
) {
func runMVCCPut(ctx context.Context, b *testing.B, emk engineMaker, valueSize, versions int) {
rng, _ := randutil.NewTestRand()
value := roachpb.MakeValueFromBytes(randutil.RandBytes(rng, valueSize))
keyBuf := append(make([]byte, 0, 64), []byte("key-")...)
Expand All @@ -887,11 +885,6 @@ func runMVCCPut(
defer eng.Close()

rw := ReadWriter(eng)
if useBatch {
batch := eng.NewBatch()
defer batch.Close()
rw = batch
}

b.SetBytes(int64(valueSize))
b.ResetTimer()
Expand Down

0 comments on commit e933c3b

Please sign in to comment.