[#1302] writecache: Add put->flush->put benchmark
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
c985b1198f
commit
fa82854af4
1 changed files with 23 additions and 0 deletions
|
@ -2,6 +2,7 @@ package benchmark
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/common"
|
||||
|
@ -27,6 +28,24 @@ func BenchmarkWritecachePar(b *testing.B) {
|
|||
})
|
||||
}
|
||||
|
||||
func BenchmarkWriteAfterDelete(b *testing.B) {
|
||||
const payloadSize = 32 << 10
|
||||
const parallel = 25
|
||||
|
||||
cache := newCache(b)
|
||||
benchmarkPutPrepare(b, cache)
|
||||
b.Run(fmt.Sprintf("%dB_before", payloadSize), func(b *testing.B) {
|
||||
b.SetParallelism(parallel)
|
||||
benchmarkRunPar(b, cache, payloadSize)
|
||||
})
|
||||
require.NoError(b, cache.Flush(context.Background(), false, false))
|
||||
b.Run(fmt.Sprintf("%dB_after", payloadSize), func(b *testing.B) {
|
||||
b.SetParallelism(parallel)
|
||||
benchmarkRunPar(b, cache, payloadSize)
|
||||
})
|
||||
require.NoError(b, cache.Close())
|
||||
}
|
||||
|
||||
func benchmarkPutSeq(b *testing.B, cache writecache.Cache, size uint64) {
|
||||
benchmarkPutPrepare(b, cache)
|
||||
defer func() { require.NoError(b, cache.Close()) }()
|
||||
|
@ -54,6 +73,10 @@ func benchmarkPutPar(b *testing.B, cache writecache.Cache, size uint64) {
|
|||
benchmarkPutPrepare(b, cache)
|
||||
defer func() { require.NoError(b, cache.Close()) }()
|
||||
|
||||
benchmarkRunPar(b, cache, size)
|
||||
}
|
||||
|
||||
func benchmarkRunPar(b *testing.B, cache writecache.Cache, size uint64) {
|
||||
ctx := context.Background()
|
||||
|
||||
b.ResetTimer()
|
||||
|
|
Loading…
Reference in a new issue