Skip to content

Commit 8f680af

Browse files
committed
Fix perf benchmarks
Motivation: In grpc#922 we adopted some changes from NIO HTTP/2: our handlers now speak in terms of `HTTP2Frame.FramePayload` rather than `HTTP2Frame`. We forgot to update our benchmarks at that time. Modifications: - Speak in `HTTP2Frame.FramePayload`s in embedded client benchmarks - Fix up a couple of typos in benchmark names Result: Benchmarks work.
1 parent 8b5d7d9 commit 8f680af

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

Sources/GRPCPerformanceTests/Benchmarks/EmbeddedClientThroughput.swift

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class EmbeddedClientThroughput: Benchmark {
102102

103103
// Read out the request frames.
104104
var requestFrames = 0
105-
while let _ = try channel.readOutbound(as: HTTP2Frame.self) {
105+
while let _ = try channel.readOutbound(as: HTTP2Frame.FramePayload.self) {
106106
requestFrames += 1
107107
}
108108
precondition(requestFrames == 3) // headers, data, empty data (end-stream)
@@ -114,15 +114,13 @@ class EmbeddedClientThroughput: Benchmark {
114114
":status": "200",
115115
"content-type": "application/grpc+proto",
116116
]
117-
let headerFrame = HTTP2Frame(
118-
streamID: .init(1),
119-
payload: .headers(.init(headers: responseHeaders))
120-
)
117+
118+
let headerFrame = HTTP2Frame.FramePayload.headers(.init(headers: responseHeaders))
121119
try channel.writeInbound(headerFrame)
122120

123121
// The response data.
124122
for chunk in self.responseDataChunks {
125-
let frame = HTTP2Frame(streamID: 1, payload: .data(.init(data: .byteBuffer(chunk))))
123+
let frame = HTTP2Frame.FramePayload.data(.init(data: .byteBuffer(chunk)))
126124
try channel.writeInbound(frame)
127125
}
128126

@@ -131,10 +129,7 @@ class EmbeddedClientThroughput: Benchmark {
131129
"grpc-status": "0",
132130
"grpc-message": "ok",
133131
]
134-
let trailersFrame = HTTP2Frame(
135-
streamID: .init(1),
136-
payload: .headers(.init(headers: responseTrailers))
137-
)
132+
let trailersFrame = HTTP2Frame.FramePayload.headers(.init(headers: responseTrailers))
138133
try channel.writeInbound(trailersFrame)
139134

140135
// And read them back out.

Sources/GRPCPerformanceTests/main.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ func runBenchmarks(spec: TestSpec) {
6363
)
6464

6565
measureAndPrint(
66-
description: "embedded_client_unary_10k_large_requests",
66+
description: "embedded_client_unary_1k_large_requests",
6767
benchmark: EmbeddedClientThroughput(requests: 1000, text: largeRequest),
6868
spec: spec
6969
)
7070

7171
measureAndPrint(
72-
description: "embedded_client_unary_10k_large_requests_1k_frames",
72+
description: "embedded_client_unary_1k_large_requests_1k_frames",
7373
benchmark: EmbeddedClientThroughput(
7474
requests: 1000,
7575
text: largeRequest,

0 commit comments

Comments
 (0)