From 972588ed14dbcca546d9395c8471950d953ad784 Mon Sep 17 00:00:00 2001 From: Weston Pace Date: Mon, 13 Dec 2021 10:38:17 +0100 Subject: [PATCH] ARROW-15036: [C++] Automatically configure S3 SDK configuration parameter "maxConnections" This should allow uses cases where the user wants more than 25 threads in the I/O thread pool because they are doing highly concurrent S3 work. See ARROW-14965 Closes #11929 from westonpace/feature/ARROW-15036--expose-max-connections-param Authored-by: Weston Pace Signed-off-by: Antoine Pitrou --- cpp/src/arrow/filesystem/s3fs.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cpp/src/arrow/filesystem/s3fs.cc b/cpp/src/arrow/filesystem/s3fs.cc index 34fccd4c9d04b..5625a0f9c1fba 100644 --- a/cpp/src/arrow/filesystem/s3fs.cc +++ b/cpp/src/arrow/filesystem/s3fs.cc @@ -690,7 +690,8 @@ class ClientBuilder { Aws::Client::ClientConfiguration* mutable_config() { return &client_config_; } - Result> BuildClient() { + Result> BuildClient( + util::optional io_context = util::nullopt) { credentials_provider_ = options_.credentials_provider; if (!options_.region.empty()) { client_config_.region = ToAwsString(options_.region); @@ -742,6 +743,11 @@ class ClientBuilder { client_config_.proxyPassword = ToAwsString(options_.proxy_options.password); } + if (io_context) { + // TODO: Once ARROW-15035 is done we can get rid of the "at least 25" fallback + client_config_.maxConnections = std::max(io_context->executor()->GetCapacity(), 25); + } + auto client = std::make_shared( credentials_provider_, client_config_, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy::Never, @@ -1617,7 +1623,7 @@ class S3FileSystem::Impl : public std::enable_shared_from_this