A few benchmarks fail #1510

Open
opened 2024-11-20 11:05:09 +00:00 by a-savchuk · 0 comments
Member
$ go test -run=^$ -bench=Benchmark* -benchtime=1x ./... | grep -E "FAIL: Benchmark"
--- FAIL: BenchmarkGet/1_objects/parallel
--- FAIL: BenchmarkGet/1_objects/serial
--- FAIL: BenchmarkGet/1_objects
--- FAIL: BenchmarkGet/10_objects/parallel
--- FAIL: BenchmarkGet/10_objects/serial
--- FAIL: BenchmarkGet/10_objects
--- FAIL: BenchmarkGet/100_objects/parallel
--- FAIL: BenchmarkGet/100_objects/serial
--- FAIL: BenchmarkGet/100_objects
--- FAIL: BenchmarkGet
--- FAIL: BenchmarkListWithCursor/1_item
--- FAIL: BenchmarkListWithCursor/10_items
--- FAIL: BenchmarkListWithCursor/100_items
--- FAIL: BenchmarkListWithCursor

It happens mostly because misplaced defers

func benchmarkGet(b *testing.B, numOfObj int) {
prepareDb := func(batchSize int) (*meta.DB, []oid.Address) {
db := newDB(b,
meta.WithMaxBatchSize(batchSize),
meta.WithMaxBatchDelay(10*time.Millisecond),
)
defer func() { require.NoError(b, db.Close(context.Background())) }()
addrs := make([]oid.Address, 0, numOfObj)
for range numOfObj {
raw := testutil.GenerateObject()
addrs = append(addrs, object.AddressOf(raw))
err := putBig(db, raw)
require.NoError(b, err)
}
return db, addrs
}
db, addrs := prepareDb(runtime.NumCPU())

``` $ go test -run=^$ -bench=Benchmark* -benchtime=1x ./... | grep -E "FAIL: Benchmark" --- FAIL: BenchmarkGet/1_objects/parallel --- FAIL: BenchmarkGet/1_objects/serial --- FAIL: BenchmarkGet/1_objects --- FAIL: BenchmarkGet/10_objects/parallel --- FAIL: BenchmarkGet/10_objects/serial --- FAIL: BenchmarkGet/10_objects --- FAIL: BenchmarkGet/100_objects/parallel --- FAIL: BenchmarkGet/100_objects/serial --- FAIL: BenchmarkGet/100_objects --- FAIL: BenchmarkGet --- FAIL: BenchmarkListWithCursor/1_item --- FAIL: BenchmarkListWithCursor/10_items --- FAIL: BenchmarkListWithCursor/100_items --- FAIL: BenchmarkListWithCursor ``` It happens mostly because misplaced `defer`s https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/6ae8667fb4a7c00fc5d3a72ff181a8da54a0eba3/pkg/local_object_storage/metabase/get_test.go#L216-L236
a-savchuk added the
good first issue
P3
triage
internal
labels 2024-11-20 11:05:09 +00:00
fyrchik added the
bug
label 2024-11-20 11:31:00 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#1510
No description provided.