Skip to content

Commit

Permalink
add configuration for MPU threshold for CRT
Browse files Browse the repository at this point in the history
  • Loading branch information
sbiscigl committed Sep 25, 2024
1 parent f2f935a commit 8410795
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@ namespace Aws
uint32_t maxBackoffSecs = 20;
} config;
} crtRetryStrategyConfig;

/**
* Optional.
* The size threshold in bytes for when to use multipart uploads.
* Uploads larger than this will use the multipart upload strategy.
* Uploads smaller or equal to this will use a single HTTP request.
* If set, this should be at least `partSize`.
* If not set, the max of `partSize` and 5 MiB will be used.
*/
Crt::Optional<size_t> multipartUploadThreshold{};
/* End of S3 CRT specifics */
private:
void LoadS3CrtSpecificConfig(const Aws::String& profileName);
Expand Down
4 changes: 4 additions & 0 deletions generated/src/aws-cpp-sdk-s3-crt/source/S3CrtClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ void S3CrtClient::init(const S3Crt::ClientConfiguration& config,

static const size_t DEFAULT_PART_SIZE = 8 * 1024 * 1024; // 8MB
s3CrtConfig.part_size = config.partSize < DEFAULT_PART_SIZE ? DEFAULT_PART_SIZE : config.partSize;
static const uint64_t FIVE_MB = 5 * 1024 * 1024;
s3CrtConfig.multipart_upload_threshold = config.multipartUploadThreshold.has_value() ?
config.multipartUploadThreshold.value() :
std::max(s3CrtConfig.part_size, FIVE_MB);

Aws::Crt::Io::TlsConnectionOptions *rawPTlsConnectionOptions = nullptr;
if (config.tlsConnectionOptions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,14 @@
uint32_t maxBackoffSecs = 20;
} config;
} crtRetryStrategyConfig;

/**
* Optional.
* The size threshold in bytes for when to use multipart uploads.
* Uploads larger than this will use the multipart upload strategy.
* Uploads smaller or equal to this will use a single HTTP request.
* If set, this should be at least `partSize`.
* If not set, the max of `partSize` and 5 MiB will be used.
*/
Crt::Optional<size_t> multipartUploadThreshold{};
/* End of S3 CRT specifics */
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,10 @@ void ${className}::init(const ${clientConfigurationNamespace}::ClientConfigurati

static const size_t DEFAULT_PART_SIZE = 8 * 1024 * 1024; // 8MB
s3CrtConfig.part_size = config.partSize < DEFAULT_PART_SIZE ? DEFAULT_PART_SIZE : config.partSize;
static const uint64_t FIVE_MB = 5 * 1024 * 1024;
s3CrtConfig.multipart_upload_threshold = config.multipartUploadThreshold.has_value() ?
config.multipartUploadThreshold.value() :
std::max(s3CrtConfig.part_size, FIVE_MB);

Aws::Crt::Io::TlsConnectionOptions *rawPTlsConnectionOptions = nullptr;
if (config.tlsConnectionOptions)
Expand Down

0 comments on commit 8410795

Please sign in to comment.