Skip to content

Commit c30ebaf

Browse files
committed
perf: add max udp payload size option
1 parent f6baf26 commit c30ebaf

3 files changed

Lines changed: 12 additions & 8 deletions

File tree

perf/src/bin/perf_client.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ async fn run(opt: Opt) -> Result<()> {
109109

110110
let socket = opt.common.bind_socket(bind_addr)?;
111111

112-
let endpoint = quinn::Endpoint::new(Default::default(), None, socket, Arc::new(TokioRuntime))?;
112+
let mut endpoint_cfg = quinn::EndpointConfig::default();
113+
endpoint_cfg.max_udp_payload_size(opt.common.max_udp_payload_size)?;
114+
115+
let endpoint = quinn::Endpoint::new(endpoint_cfg, None, socket, Arc::new(TokioRuntime))?;
113116

114117
let default_provider = rustls::crypto::ring::default_provider();
115118
let provider = Arc::new(rustls::crypto::CryptoProvider {

perf/src/bin/perf_server.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,11 @@ async fn run(opt: Opt) -> Result<()> {
9090

9191
let socket = opt.common.bind_socket(opt.listen)?;
9292

93-
let endpoint = quinn::Endpoint::new(
94-
Default::default(),
95-
Some(config),
96-
socket,
97-
Arc::new(TokioRuntime),
98-
)
99-
.context("creating endpoint")?;
93+
let mut endpoint_cfg = quinn::EndpointConfig::default();
94+
endpoint_cfg.max_udp_payload_size(opt.common.max_udp_payload_size)?;
95+
96+
let endpoint = quinn::Endpoint::new(endpoint_cfg, Some(config), socket, Arc::new(TokioRuntime))
97+
.context("creating endpoint")?;
10098

10199
info!("listening on {}", endpoint.local_addr().unwrap());
102100

perf/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ pub struct CommonOpt {
7777
/// 1MiB, 10G will limit to 10GiB.
7878
#[clap(long, value_parser = parse_byte_size)]
7979
pub send_window: Option<u64>,
80+
/// Max UDP payload size in bytes
81+
#[clap(long, default_value = "1472")]
82+
pub max_udp_payload_size: u16,
8083
/// qlog output file
8184
#[cfg(feature = "qlog")]
8285
#[clap(long = "qlog")]

0 commit comments

Comments
 (0)