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

ARROW-15036: [C++] Automatically configure S3 SDK configuration parameter "maxConnections" #11929

Closed
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
10 changes: 8 additions & 2 deletions cpp/src/arrow/filesystem/s3fs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,8 @@ class ClientBuilder {

Aws::Client::ClientConfiguration* mutable_config() { return &client_config_; }

Result<std::shared_ptr<S3Client>> BuildClient() {
Result<std::shared_ptr<S3Client>> BuildClient(
util::optional<io::IOContext> io_context = util::nullopt) {
credentials_provider_ = options_.credentials_provider;
if (!options_.region.empty()) {
client_config_.region = ToAwsString(options_.region);
Expand Down Expand Up @@ -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<S3Client>(
credentials_provider_, client_config_,
Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy::Never,
Expand Down Expand Up @@ -1617,7 +1623,7 @@ class S3FileSystem::Impl : public std::enable_shared_from_this<S3FileSystem::Imp
explicit Impl(S3Options options, io::IOContext io_context)
: builder_(std::move(options)), io_context_(io_context) {}

Status Init() { return builder_.BuildClient().Value(&client_); }
Status Init() { return builder_.BuildClient(io_context_).Value(&client_); }

const S3Options& options() const { return builder_.options(); }

Expand Down