Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frameworks/wtx-grpc-tls/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"engine": "wtx",
"description": "WTX - gRPC Server",
"repo": "https://github.com/c410-f3r/wtx",
"enabled": false,
"enabled": true,
"tests": [
"unary-grpc-tls"
]
Expand Down
11 changes: 8 additions & 3 deletions frameworks/wtx-grpc-tls/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use wtx::{
grpc::{GrpcManager, GrpcMiddleware},
http::{
HttpRecvParams,
http2_server_framework::{Http2ServerFramework, HttpRouter, State, post},
StatusCode,
http2_server_framework::{Http2ServerFramework, HttpRouter, State, VerbatimParams, post},
},
tls::{TlsConfig, TlsModeVerified},
};
Expand All @@ -28,10 +29,14 @@ fn main() -> wtx::Result<()> {
.run_in_threads("0.0.0.0:8443", router)
}

async fn endpoint_grpc_unary(state: State<'_, GrpcManager<QuickProtobuf>>) -> wtx::Result<()> {
// Same fix as the plaintext entry: ResFinalizer for () clears the request
// buffer after the handler runs, which erased the serialized reply.
async fn endpoint_grpc_unary(
state: State<'_, GrpcManager<QuickProtobuf>>,
) -> wtx::Result<VerbatimParams> {
let sr = state.data.des_from_req_bytes::<SumRequest>(&mut state.req.msg_data.body.as_slice())?;
state.req.clear();
let result = sr.a.wrapping_add(sr.b);
state.data.ser_to_res_bytes(&mut state.req.msg_data.body, SumReply { result })?;
Ok(())
Ok(VerbatimParams(StatusCode::Ok))
}
2 changes: 1 addition & 1 deletion frameworks/wtx-grpc/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"engine": "wtx",
"description": "WTX - gRPC Server",
"repo": "https://github.com/c410-f3r/wtx",
"enabled": false,
"enabled": true,
"tests": [
"unary-grpc"
]
Expand Down
13 changes: 10 additions & 3 deletions frameworks/wtx-grpc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use wtx::{
grpc::{GrpcManager, GrpcMiddleware},
http::{
HttpRecvParams,
http2_server_framework::{Http2ServerFramework, HttpRouter, State, post},
StatusCode,
http2_server_framework::{Http2ServerFramework, HttpRouter, State, VerbatimParams, post},
},
tls::TlsConfig,
};
Expand All @@ -22,10 +23,16 @@ fn main() -> wtx::Result<()> {
.run_in_threads("0.0.0.0:8080", router)
}

async fn endpoint_grpc_unary(state: State<'_, GrpcManager<QuickProtobuf>>) -> wtx::Result<()> {
// Returns VerbatimParams rather than (). ResFinalizer for () calls req.clear()
// after the handler runs, which erased the reply just serialized into the
// request buffer: the server answered 200 with grpc-status 0 and an empty
// body. VerbatimParams carries the status and leaves the body alone.
async fn endpoint_grpc_unary(
state: State<'_, GrpcManager<QuickProtobuf>>,
) -> wtx::Result<VerbatimParams> {
let sr = state.data.des_from_req_bytes::<SumRequest>(&mut state.req.msg_data.body.as_slice())?;
state.req.clear();
let result = sr.a.wrapping_add(sr.b);
state.data.ser_to_res_bytes(&mut state.req.msg_data.body, SumReply { result })?;
Ok(())
Ok(VerbatimParams(StatusCode::Ok))
}
76 changes: 76 additions & 0 deletions site/data/results/wtx.json
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,82 @@
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
},
"unary-grpc-1024": {
"framework": "wtx",
"language": "Rust",
"rps": 3620970,
"avg_latency": "26.89ms",
"p99_latency": "193.30ms",
"cpu": "6383.3%",
"memory": "1022MiB",
"connections": 1024,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "213.19MB/s",
"reconnects": 0,
"status_2xx": 18322111,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
},
"unary-grpc-256": {
"framework": "wtx",
"language": "Rust",
"rps": 3990708,
"avg_latency": "6.55ms",
"p99_latency": "69.93ms",
"cpu": "6379.2%",
"memory": "727MiB",
"connections": 256,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "233.55MB/s",
"reconnects": 0,
"status_2xx": 20073262,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
},
"unary-grpc-tls-1024": {
"framework": "wtx",
"language": "Rust",
"rps": 3625918,
"avg_latency": "22.35ms",
"p99_latency": "345.55ms",
"cpu": "6380.6%",
"memory": "984MiB",
"connections": 1024,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "213.48MB/s",
"reconnects": 0,
"status_2xx": 18347146,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
},
"unary-grpc-tls-256": {
"framework": "wtx",
"language": "Rust",
"rps": 3688532,
"avg_latency": "5.19ms",
"p99_latency": "49.74ms",
"cpu": "5485.4%",
"memory": "726MiB",
"connections": 256,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "215.87MB/s",
"reconnects": 0,
"status_2xx": 18553318,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
}
}
}
Loading