Skip to content

Commit

Permalink
Remove download changes, add bind arg to client_benchmark
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Carl Jones <[email protected]>
  • Loading branch information
dannycjones committed Feb 28, 2025
1 parent 6123df6 commit 146cd79
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 26 deletions.
16 changes: 15 additions & 1 deletion 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 Down Expand Up @@ -122,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
27 changes: 2 additions & 25 deletions mountpoint-s3-client/examples/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,6 @@ pub struct CliArgs {
value_parser = parse_range,
)]
pub range: Option<Range<u64>>,

#[arg(
long,
help = "Configure S3 client's desired throughput in Gbps",
default_value_t = 10.0,
visible_alias = "maximum-throughput-gbps",
value_name = "GBPS"
)]
throughput_target_gbps: f64,

#[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>>,
}

/// Empty error type, since we don't care too much for an example.
Expand Down Expand Up @@ -96,15 +80,8 @@ fn main() {
let region = &args.region;
let range = args.range;

let mut config = S3ClientConfig::new();

config = config.endpoint_config(EndpointConfig::new(region));
config = config.throughput_target_gbps(args.throughput_target_gbps);
if let Some(interfaces) = &args.bind {
config = config.network_interface_names(interfaces.clone());
}

let client = S3CrtClient::new(config).expect("couldn't create client");
let client = S3CrtClient::new(S3ClientConfig::new().endpoint_config(EndpointConfig::new(region)))
.expect("couldn't create client");

let last_offset = Arc::new(Mutex::new(None));
let last_offset_clone = Arc::clone(&last_offset);
Expand Down

0 comments on commit 146cd79

Please sign in to comment.