Skip to content

Commit fd2679c

Browse files
authored
test(storage): benchmark options to tune stall timeouts (#9598)
1 parent 4ad4e08 commit fd2679c

File tree

4 files changed

+33
-3
lines changed

4 files changed

+33
-3
lines changed

google/cloud/storage/benchmarks/storage_throughput_vs_cpu_benchmark.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,14 @@ gcs_bm::ClientProvider BaseProvider(ThroughputOptions const& options) {
305305
opts.set<google::cloud::storage::internal::TargetApiVersionOption>(
306306
*options.target_api_version_path);
307307
}
308+
if (options.transfer_stall_minimum_rate.has_value()) {
309+
opts.set<gcs_ex::TransferStallMinimumRateOption>(
310+
*options.transfer_stall_minimum_rate);
311+
}
312+
if (options.download_stall_minimum_rate.has_value()) {
313+
opts.set<gcs_ex::DownloadStallMinimumRateOption>(
314+
*options.download_stall_minimum_rate);
315+
}
308316
#if GOOGLE_CLOUD_CPP_STORAGE_HAVE_GRPC
309317
using ::google::cloud::storage_experimental::DefaultGrpcClient;
310318
if (options.grpc_background_threads.has_value()) {

google/cloud/storage/benchmarks/throughput_options.cc

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,14 +332,22 @@ google::cloud::StatusOr<ThroughputOptions> ParseThroughputOptions(
332332
options.direct_path_endpoint = val;
333333
}},
334334
{"--transfer-stall-timeout",
335-
"configure the storage::TransferStallTimeoutOption: the maximum time"
336-
" allowed for data to 'stall' (make no progress) on all operations,"
337-
" except for downloads (see --download-stall-timeout)."
335+
"configure `storage::TransferStallTimeoutOption`: the maximum time"
336+
" allowed for data to 'stall' (make insufficient progress) on all"
337+
" operations, except for downloads (see --download-stall-timeout)."
338338
" This option is intended for troubleshooting, most of the time the"
339339
" value is not expected to change the library performance.",
340340
[&options](std::string const& val) {
341341
options.transfer_stall_timeout = ParseDuration(val);
342342
}},
343+
{"--transfer-stall-minimum-rate",
344+
"configure `storage::TransferStallMinimumRateOption`: the transfer"
345+
" is aborted if the average transfer rate is below this limit for"
346+
" the period set via `storage::TransferStallTimeoutOption`.",
347+
[&options](std::string const& val) {
348+
options.transfer_stall_minimum_rate =
349+
static_cast<std::uint32_t>(ParseBufferSize(val));
350+
}},
343351
{"--download-stall-timeout",
344352
"configure the storage::DownloadStallTimeoutOption: the maximum time"
345353
" allowed for data to 'stall' during a download."
@@ -348,6 +356,14 @@ google::cloud::StatusOr<ThroughputOptions> ParseThroughputOptions(
348356
[&options](std::string const& val) {
349357
options.download_stall_timeout = ParseDuration(val);
350358
}},
359+
{"--download-stall-minimum-rate",
360+
"configure `storage::DownloadStallMinimumRateOption`: the download"
361+
" is aborted if the average transfer rate is below this limit for"
362+
" the period set via `storage::DownloadStallTimeoutOption`.",
363+
[&options](std::string const& val) {
364+
options.download_stall_minimum_rate =
365+
static_cast<std::uint32_t>(ParseBufferSize(val));
366+
}},
351367
{"--minimum-sample-delay",
352368
"configure the minimum time between samples."
353369
" Sometimes we only want to collect a few samples per second."

google/cloud/storage/benchmarks/throughput_options.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ struct ThroughputOptions {
6161
std::string grpc_endpoint = "storage.googleapis.com";
6262
std::string direct_path_endpoint = "google-c2p:///storage.googleapis.com";
6363
std::chrono::seconds transfer_stall_timeout{};
64+
absl::optional<std::uint32_t> transfer_stall_minimum_rate;
6465
std::chrono::seconds download_stall_timeout{};
66+
absl::optional<std::uint32_t> download_stall_minimum_rate;
6567
std::chrono::milliseconds minimum_sample_delay{};
6668
std::int64_t minimum_read_offset = 0;
6769
std::int64_t maximum_read_offset = 0;

google/cloud/storage/benchmarks/throughput_options_test.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ TEST(ThroughputOptions, Basic) {
5656
"--grpc-endpoint=test-only-grpc",
5757
"--direct-path-endpoint=test-only-direct-path",
5858
"--transfer-stall-timeout=86400s",
59+
"--transfer-stall-minimum-rate=7KiB",
5960
"--download-stall-timeout=86401s",
61+
"--download-stall-minimum-rate=9KiB",
6062
"--minimum-sample-delay=250ms",
6163
"--minimum-read-offset=32KiB",
6264
"--maximum-read-offset=48KiB",
@@ -100,7 +102,9 @@ TEST(ThroughputOptions, Basic) {
100102
EXPECT_EQ("test-only-grpc", options->grpc_endpoint);
101103
EXPECT_EQ("test-only-direct-path", options->direct_path_endpoint);
102104
EXPECT_EQ(std::chrono::seconds(86400), options->transfer_stall_timeout);
105+
EXPECT_EQ(7 * kKiB, options->transfer_stall_minimum_rate);
103106
EXPECT_EQ(std::chrono::seconds(86401), options->download_stall_timeout);
107+
EXPECT_EQ(9 * kKiB, options->download_stall_minimum_rate);
104108
EXPECT_EQ(std::chrono::milliseconds(250), options->minimum_sample_delay);
105109
EXPECT_EQ("vN", options->target_api_version_path.value_or(""));
106110
EXPECT_EQ(16, options->grpc_background_threads.value_or(0));

0 commit comments

Comments
 (0)