Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add network config to all component benchmarks #1284

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
23 changes: 21 additions & 2 deletions mountpoint-s3-client/examples/client_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ enum Client {
key: String,
#[arg(long, help = "AWS region", default_value = "us-east-1")]
region: String,
#[clap(
long,
help = "One or more network interfaces to use when accessing S3. Requires Linux 5.7+ or running as root.",
value_name = "NETWORK_INTERFACE"
)]
bind: Option<Vec<String>>,
},
#[command(about = "Download a key from a mock S3 server")]
Mock {
Expand All @@ -101,7 +107,12 @@ enum Client {
struct CliArgs {
#[command(subcommand)]
client: Client,
#[arg(long, help = "Desired throughput in Gbps", default_value = "10.0")]
#[arg(
long,
help = "Desired throughput in Gbps",
default_value_t = 10.0,
visible_alias = "maximum-throughput-gbps"
)]
throughput_target_gbps: f64,
#[arg(long, help = "Part size for multi-part GET", default_value = "8388608")]
part_size: usize,
Expand All @@ -117,9 +128,17 @@ fn main() {
let args = CliArgs::parse();

match args.client {
Client::Real { bucket, key, region } => {
Client::Real {
bucket,
key,
region,
bind,
} => {
let mut config = S3ClientConfig::new().endpoint_config(EndpointConfig::new(&region));
config = config.throughput_target_gbps(args.throughput_target_gbps);
if let Some(interfaces) = &bind {
config = config.network_interface_names(interfaces.clone());
}
config = config.part_size(args.part_size);
let client = S3CrtClient::new(config).expect("couldn't create client");

Expand Down
19 changes: 15 additions & 4 deletions mountpoint-s3-crt/examples/download_crt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ struct CrtClientConfig {
region: String,
throughput_target_gbps: f64,
part_size: usize,
network_interface_names: Option<Vec<String>>,
}

impl CrtClient {
Expand Down Expand Up @@ -123,6 +124,9 @@ impl CrtClient {
.retry_strategy(retry_strategy);
client_config.throughput_target_gbps(config.throughput_target_gbps);
client_config.part_size(config.part_size);
if let Some(ref network_interface_names) = config.network_interface_names {
client_config.network_interface_names(network_interface_names.clone());
}

let client = Client::new(&allocator, client_config)?;

Expand Down Expand Up @@ -199,13 +203,19 @@ struct CliArgs {
region: String,
#[arg(
long,
help = "max throughput (gigabits/second)",
help = "Target throughput (gigabits/second)",
value_name = "GBPS",
default_value = "10.0"
visible_alias = "maximum-throughput-gbps"
)]
maximum_throughput_gbps: f64,
throughput_target_gbps: f64,
#[arg(long, help = "part size (bytes)", default_value = "8388608")]
part_size: usize,
#[clap(
long,
help = "One or more network interfaces to use when accessing S3. Requires Linux 5.7+ or running as root.",
value_name = "NETWORK_INTERFACE"
)]
bind: Option<Vec<String>>,
#[arg(long, help = "number of times to download", default_value = "1")]
iterations: usize,
}
Expand All @@ -218,8 +228,9 @@ fn main() -> anyhow::Result<()> {

let config = CrtClientConfig {
region: args.region,
throughput_target_gbps: args.maximum_throughput_gbps,
throughput_target_gbps: args.throughput_target_gbps,
part_size: args.part_size,
network_interface_names: args.bind,
};
let client = CrtClient::new(config)?;

Expand Down
2 changes: 1 addition & 1 deletion mountpoint-s3/examples/fs_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub struct CliArgs {

#[clap(
long,
help = "Target throughput in gibibits per second",
help = "Target throughput in gigabits per second",
value_name = "N",
value_parser = value_parser!(u64).range(1..),
alias = "throughput-target-gbps",
Expand Down
14 changes: 12 additions & 2 deletions mountpoint-s3/examples/prefetch_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub struct CliArgs {
value_parser = value_parser!(u64).range(1..),
alias = "throughput-target-gbps",
)]
pub maximum_throughput_gbps: Option<f64>,
pub maximum_throughput_gbps: Option<u64>,

#[clap(
long,
Expand Down Expand Up @@ -87,6 +87,13 @@ pub struct CliArgs {

#[arg(long, help = "Number of concurrent downloads", default_value_t = 1, value_name = "N")]
downloads: usize,

#[clap(
long,
help = "One or more network interfaces to use when accessing S3. Requires Linux 5.7+ or running as root.",
value_name = "NETWORK_INTERFACE"
)]
pub bind: Option<Vec<String>>,
}

fn main() {
Expand All @@ -103,11 +110,14 @@ fn main() {
.read_backpressure(true)
.initial_read_window(initial_read_window_size);
if let Some(throughput_target_gbps) = args.maximum_throughput_gbps {
config = config.throughput_target_gbps(throughput_target_gbps);
config = config.throughput_target_gbps(throughput_target_gbps as f64);
}
if let Some(part_size) = args.part_size {
config = config.part_size(part_size as usize);
}
if let Some(interfaces) = &args.bind {
config = config.network_interface_names(interfaces.clone());
}
let client = Arc::new(S3CrtClient::new(config).expect("couldn't create client"));

let max_memory_target = if let Some(target) = args.max_memory_target {
Expand Down
Loading