Small fixes for local blobstor benchmarks #236
1 changed files with 14 additions and 8 deletions
|
@ -11,6 +11,7 @@ import (
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/memstore"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/memstore"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
"golang.org/x/sync/errgroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
type storage struct {
|
type storage struct {
|
||||||
|
@ -103,18 +104,23 @@ func BenchmarkSubstorageReadPerf(b *testing.B) {
|
||||||
st := stEntry.open(b)
|
st := stEntry.open(b)
|
||||||
|
|
||||||
// Fill database
|
// Fill database
|
||||||
|
var errG errgroup.Group
|
||||||
for i := 0; i < tt.size; i++ {
|
for i := 0; i < tt.size; i++ {
|
||||||
obj := objGen.Next()
|
obj := objGen.Next()
|
||||||
addr := testutil.AddressFromObject(b, obj)
|
addr := testutil.AddressFromObject(b, obj)
|
||||||
raw, err := obj.Marshal()
|
errG.Go(func() error {
|
||||||
require.NoError(b, err)
|
raw, err := obj.Marshal()
|
||||||
if _, err := st.Put(common.PutPrm{
|
if err != nil {
|
||||||
Address: addr,
|
return fmt.Errorf("marshal: %v", err)
|
||||||
RawData: raw,
|
}
|
||||||
}); err != nil {
|
_, err = st.Put(common.PutPrm{
|
||||||
b.Fatalf("writing entry: %v", err)
|
Address: addr,
|
||||||
}
|
RawData: raw,
|
||||||
|
})
|
||||||
|
return err
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
require.NoError(b, errG.Wait())
|
||||||
|
|
||||||
// Benchmark reading
|
// Benchmark reading
|
||||||
addrGen := tt.addrGen()
|
addrGen := tt.addrGen()
|
||||||
|
|
Loading…
Reference in a new issue