Some benchmarks fail #1510

Closed
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 of 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())

```console $ 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 of 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
a-savchuk was assigned by fyrchik 2024-12-06 07:34:08 +00:00
a-savchuk removed the
triage
label 2024-12-09 11:08:48 +00:00
a-savchuk changed title from A few benchmarks fail to Some benchmarks fail 2024-12-13 10:08:21 +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.