Skip to content

[#10029][benchmarks] arrow-flight roundtrip as well as encode/decode #10031

Open
Rich-T-kid wants to merge 1 commit into
apache:mainfrom
Rich-T-kid:rich-T-kid/introduce-flight-benchmarks
Open

[#10029][benchmarks] arrow-flight roundtrip as well as encode/decode #10031
Rich-T-kid wants to merge 1 commit into
apache:mainfrom
Rich-T-kid:rich-T-kid/introduce-flight-benchmarks

Conversation

@Rich-T-kid
Copy link
Copy Markdown
Contributor

@Rich-T-kid Rich-T-kid commented May 27, 2026

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

@github-actions github-actions Bot added arrow Changes to the arrow crate arrow-flight Changes to the arrow-flight crate labels May 27, 2026
@Rich-T-kid Rich-T-kid changed the title [#10029] arrow-flight roundtrip as well as encode/decode [#10029][benchmarks] arrow-flight roundtrip as well as encode/decode May 27, 2026
@Rich-T-kid Rich-T-kid force-pushed the rich-T-kid/introduce-flight-benchmarks branch from 20b0d75 to 4f6d153 Compare May 27, 2026 21:25
@Rich-T-kid
Copy link
Copy Markdown
Contributor Author

@alamb could you take a look at this when you get a chance? smaller PR that only includes benchmarks, #10029 has a bit more context. 🫡

Copy link
Copy Markdown
Contributor

@gabotechs gabotechs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 nice work @Rich-T-kid! pretty clean benchmarks. Left some suggestions, but otherwise this LGTM

Err(Status::unimplemented(""))
}

#[rustfmt::skip]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+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();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate arrow-flight Changes to the arrow-flight crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants