Skip to content

Commit 6a2a1b7

Browse files
test set threasholds
1 parent 7de0be7 commit 6a2a1b7

File tree

22 files changed

+225
-5
lines changed

22 files changed

+225
-5
lines changed

Benchmarks/Benchmarks/SwiftKafkaConsumerBenchmarks/KafkaConsumerBenchmark.swift

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,19 @@ let benchmarks = {
3030
warmupIterations: 0,
3131
scalingFactor: .one,
3232
maxDuration: .seconds(5),
33-
maxIterations: 100
33+
maxIterations: 100,
34+
thresholds: [
35+
// Thresholds are wild guess mostly. Have to adjust with time.
36+
.wallClock: .init(relative: [.p90: 10]),
37+
.cpuTotal: .init(relative: [.p90: 0]),
38+
.allocatedResidentMemory: .init(relative: [.p90: 20]),
39+
.contextSwitches: .init(relative: [.p90: 10]),
40+
.throughput: .init(relative: [.p90: 10]),
41+
.objectAllocCount: .init(relative: [.p90: 10]),
42+
.retainCount: .init(relative: [.p90: 10]),
43+
.releaseCount: .init(relative: [.p90: 10]),
44+
.retainReleaseDelta: .init(relative: [.p90: 10]),
45+
]
3446
)
3547

3648
Benchmark.setup = {
@@ -44,7 +56,7 @@ let benchmarks = {
4456
uniqueTestTopic = nil
4557
}
4658

47-
Benchmark("SwiftKafkaConsumer - basic consumer (messages: \(messageCount))") { benchmark in
59+
Benchmark("SwiftKafkaConsumer_basic_consumer_messages_\(messageCount)") { benchmark in
4860
let uniqueGroupID = UUID().uuidString
4961
var consumerConfig = KafkaConsumerConfiguration(
5062
consumptionStrategy: .group(
@@ -112,7 +124,7 @@ let benchmarks = {
112124
}
113125
}
114126

115-
Benchmark("SwiftKafkaConsumer - with offset commit (messages: \(messageCount))") { benchmark in
127+
Benchmark("SwiftKafkaConsumer_with_offset_commit_messages_\(messageCount)") { benchmark in
116128
let uniqueGroupID = UUID().uuidString
117129
var consumerConfig = KafkaConsumerConfiguration(
118130
consumptionStrategy: .group(
@@ -183,7 +195,7 @@ let benchmarks = {
183195
}
184196
}
185197

186-
Benchmark("librdkafka - basic consumer (messages: \(messageCount))") { benchmark in
198+
Benchmark("librdkafka_basic_consumer_messages_\(messageCount)") { benchmark in
187199
let uniqueGroupID = UUID().uuidString
188200
let rdKafkaConsumerConfig: [String: String] = [
189201
"group.id": uniqueGroupID,
@@ -251,7 +263,7 @@ let benchmarks = {
251263
benchLog("All read up to ctr: \(ctr), avgRate: (\(Int(avgRateMb))KB/s), timePassed: \(Int(timeIntervalTotal))sec")
252264
}
253265

254-
Benchmark("librdkafka - with offset commit (messages: \(messageCount))") { benchmark in
266+
Benchmark("librdkafka_with_offset_commit_messages_\(messageCount)") { benchmark in
255267
let uniqueGroupID = UUID().uuidString
256268
let rdKafkaConsumerConfig: [String: String] = [
257269
"group.id": uniqueGroupID,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//
2+
// File.swift
3+
//
4+
//
5+
// Created by Andrey Potemkin on 26.2.2024.
6+
//
7+
8+
import Foundation
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"allocatedResidentMemory" : 77660159,
3+
"cpuTotal" : 80000000,
4+
"objectAllocCount" : 4643,
5+
"releaseCount" : 30815,
6+
"retainCount" : 23791,
7+
"retainReleaseDelta" : 2391,
8+
"throughput" : 8,
9+
"wallClock" : 133693439
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"allocatedResidentMemory" : 70254592,
3+
"cpuTotal" : 270000000,
4+
"objectAllocCount" : 7917,
5+
"releaseCount" : 38881,
6+
"retainCount" : 27059,
7+
"retainReleaseDelta" : 3905,
8+
"throughput" : 2,
9+
"wallClock" : 634566500
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"allocatedResidentMemory" : 42860544,
3+
"cpuTotal" : 20000000,
4+
"objectAllocCount" : 0,
5+
"releaseCount" : 0,
6+
"retainCount" : 0,
7+
"retainReleaseDelta" : 0,
8+
"throughput" : 2,
9+
"wallClock" : 620173292
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"allocatedResidentMemory" : 48300032,
3+
"cpuTotal" : 150000000,
4+
"objectAllocCount" : 0,
5+
"releaseCount" : 0,
6+
"retainCount" : 0,
7+
"retainReleaseDelta" : 0,
8+
"throughput" : 1,
9+
"wallClock" : 827764833
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"allocatedResidentMemory" : 69468160,
3+
"cpuTotal" : 270000000,
4+
"objectAllocCount" : 7175,
5+
"releaseCount" : 37657,
6+
"retainCount" : 26402,
7+
"retainReleaseDelta" : 4080,
8+
"throughput" : 2,
9+
"wallClock" : 683494251
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"allocatedResidentMemory" : 73007104,
3+
"cpuTotal" : 270000000,
4+
"objectAllocCount" : 7941,
5+
"releaseCount" : 39038,
6+
"retainCount" : 27174,
7+
"retainReleaseDelta" : 3923,
8+
"throughput" : 2,
9+
"wallClock" : 644024709
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"allocatedResidentMemory" : 46596096,
3+
"cpuTotal" : 20000000,
4+
"objectAllocCount" : 0,
5+
"releaseCount" : 0,
6+
"retainCount" : 0,
7+
"retainReleaseDelta" : 0,
8+
"throughput" : 2,
9+
"wallClock" : 627353501
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"allocatedResidentMemory" : 44040192,
3+
"cpuTotal" : 150000000,
4+
"objectAllocCount" : 0,
5+
"releaseCount" : 0,
6+
"retainCount" : 0,
7+
"retainReleaseDelta" : 0,
8+
"throughput" : 1,
9+
"wallClock" : 835152709
10+
}

0 commit comments

Comments
 (0)