[#10029][benchmarks] arrow-flight roundtrip as well as encode/decode #10031
[#10029][benchmarks] arrow-flight roundtrip as well as encode/decode #10031Rich-T-kid wants to merge 1 commit into
Conversation
20b0d75 to
4f6d153
Compare
There was a problem hiding this comment.
👍 nice work @Rich-T-kid! pretty clean benchmarks. Left some suggestions, but otherwise this LGTM
| Err(Status::unimplemented("")) | ||
| } | ||
|
|
||
| #[rustfmt::skip] |
There was a problem hiding this comment.
+1 to skipping formatting here, otherwise this boilerplaty code occupies too much space.
|
|
||
| pub async fn start_server() -> (Channel, BenchServer) { | ||
| let server = BenchServer::default(); | ||
| let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap(); |
There was a problem hiding this comment.
Actually, rather than spawning a real server in local-host, you may want to spawn a fully in-memory server here. That way sys calls to the network interface of the OS are not baked into the benchmarks.
There was a problem hiding this comment.
Something like this should be the same thing, but the everything is spawned in-memory, without passing through localhost:
pub async fn start_server() -> (Channel, BenchServer) {
const DUMMY_URL: &str = "http://localhost:50051";
let bench_server = BenchServer::default();
let (client, server) = tokio::io::duplex(1024 * 1024);
let mut client = Some(client);
let channel = Endpoint::try_from(DUMMY_URL)
.expect("Invalid dummy URL for building an endpoint. This should never happen")
.connect_with_connector_lazy(tower::service_fn(move |_| {
let client = client
.take()
.expect("Client taken twice. This should never happen");
async move { Ok::<_, std::io::Error>(TokioIo::new(client)) }
}));
tokio::spawn(
Server::builder()
.add_service(FlightServiceServer::new(bench_server.clone()))
.serve_with_incoming(tokio_stream::once(Ok::<_, std::io::Error>(server))),
);
(channel, bench_server)
}| @@ -0,0 +1,146 @@ | |||
| // Licensed to the Apache Software Foundation (ASF) under one | |||
There was a problem hiding this comment.
Typically, the folders containing benchmarks are not called benchmarks, they are instead called benches.
Can we rename the folder containing this code to account for this?
Which issue does this PR close?
Rationale for this change
Provides benchmarks for arrow-flight crate. benchmarks for round trip as well as encode/decode individually.
What changes are included in this PR?
Adds three criterion benches under arrow-flight/benchmarks/ (roundtrip.rs, flight_encode.rs, flight_decode.rs), each sweeping a tunable matrix of rows, cols, and column types (fixed Int64, variable StringArray, nested List, dict DictionaryArray) built via a shared
common::build_batch helper.
Are these changes tested?
n/a
Are there any user-facing changes?
no