Skip to content

Commit 4ad4e08

Browse files
authored
test(storage): benchmark option to disable retry loop (#9597)
1 parent 79fbf91 commit 4ad4e08

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

google/cloud/storage/benchmarks/storage_throughput_vs_cpu_benchmark.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@ gcs_bm::ClientProvider BaseProvider(ThroughputOptions const& options) {
297297
options.download_stall_timeout)
298298
.set<gcs::TransferStallTimeoutOption>(
299299
options.transfer_stall_timeout);
300+
if (!options.enable_retry_loop) {
301+
opts.set<gcs::RetryPolicyOption>(
302+
gcs::LimitedErrorCountRetryPolicy(0).clone());
303+
}
300304
if (options.target_api_version_path.has_value()) {
301305
opts.set<google::cloud::storage::internal::TargetApiVersionOption>(
302306
*options.target_api_version_path);

google/cloud/storage/benchmarks/throughput_options.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,10 @@ google::cloud::StatusOr<ThroughputOptions> ParseThroughputOptions(
396396
[&options](std::string const& val) {
397397
options.grpc_background_threads = std::stoi(val);
398398
}},
399+
{"--enable-retry-loop", "use the client library retry loop",
400+
[&options](std::string const& val) {
401+
options.enable_retry_loop = ParseBoolean(val).value_or(true);
402+
}},
399403
};
400404
auto usage = BuildUsage(desc, argv[0]);
401405

google/cloud/storage/benchmarks/throughput_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ struct ThroughputOptions {
7171
std::int64_t read_size_quantum = 128 * kKiB;
7272
absl::optional<std::string> target_api_version_path;
7373
absl::optional<int> grpc_background_threads;
74+
bool enable_retry_loop = true;
7475
};
7576

7677
google::cloud::StatusOr<ThroughputOptions> ParseThroughputOptions(

google/cloud/storage/benchmarks/throughput_options_test.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ TEST(ThroughputOptions, Basic) {
6666
"--read-size-quantum=16KiB",
6767
"--target-api-version-path=vN",
6868
"--grpc-background-threads=16",
69+
"--enable-retry-loop=false",
6970
});
7071
ASSERT_STATUS_OK(options);
7172
EXPECT_EQ("test-project", options->project_id);
@@ -103,6 +104,7 @@ TEST(ThroughputOptions, Basic) {
103104
EXPECT_EQ(std::chrono::milliseconds(250), options->minimum_sample_delay);
104105
EXPECT_EQ("vN", options->target_api_version_path.value_or(""));
105106
EXPECT_EQ(16, options->grpc_background_threads.value_or(0));
107+
EXPECT_FALSE(options->enable_retry_loop);
106108
}
107109

108110
TEST(ThroughputOptions, Description) {

0 commit comments

Comments
 (0)