Skip to content

Commit 167d347

Browse files
Update default S3 CRT client config
1 parent f67b109 commit 167d347

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

generated/src/aws-cpp-sdk-s3-crt/include/aws/s3-crt/S3CrtClientConfiguration.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,24 +90,29 @@ namespace Aws
9090
std::shared_ptr<Aws::Crt::Io::ClientBootstrap> clientBootstrap;
9191

9292
/** Size of parts the files will be downloaded or uploaded in. Useful for Put/GetObject APIs
93-
* defaults to 5MB, if user set it to be less than 5MB, SDK will set it to 5MB.
93+
* defaults to 8MB, if user set it to be less than 5MB, CRT will set it to 5MB.
9494
*/
95-
size_t partSize = 5 * 1024 * 1024;
95+
size_t partSize = 8 * 1024 * 1024;
9696

9797
/** TLS Options to be used for each connection.
9898
* If scheme is Https and tlsConnectionOptions is null, SDK will create a default one for you.
9999
*/
100100
std::shared_ptr<Aws::Crt::Io::TlsConnectionOptions> tlsConnectionOptions;
101101

102102
/* Throughput target in Gbps that we are trying to reach. Normally it's the NIC's throughput */
103-
double throughputTargetGbps = 2.0;
103+
double throughputTargetGbps = 10.0;
104104

105105
/** Control the maximum memory used by downloads.
106106
* When set to a value > 0, the SDK uses flow control to bring the memory usage very close
107107
* to the specified window. Without this cap, memory usage grows proportional to file size.
108108
*/
109109
size_t downloadMemoryUsageWindow = 0;
110110

111+
/**
112+
* How much memory S3 CRT implementation will use. This will be capped to SIZE_MAX (max platform value of size_t)
113+
*/
114+
uint64_t memoryLimitBytes = 0;
115+
111116
/* Callback and associated user data for when the client has completed its shutdown process. */
112117
std::function<void(void*)> clientShutdownCallback;
113118
void *shutdownCallbackUserData = nullptr;

generated/src/aws-cpp-sdk-s3-crt/source/S3CrtClient.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,9 @@ void S3CrtClient::init(const S3Crt::ClientConfiguration& config,
318318
s3CrtConfig.enable_read_backpressure = (config.downloadMemoryUsageWindow > 0);
319319
s3CrtConfig.initial_read_window = config.downloadMemoryUsageWindow;
320320

321+
// Memory usage config:
322+
s3CrtConfig.memory_limit_in_bytes = config.memoryLimitBytes;
323+
321324
aws_s3_tcp_keep_alive_options tcp_keep_alive_options;
322325
if (config.enableTcpKeepAlive) {
323326
uint16_t configKeepAliveS = static_cast<uint16_t>(std::min(static_cast<unsigned long>(std::numeric_limits<uint16_t>::max()), config.tcpKeepAliveIntervalMs / 1000ul));
@@ -376,7 +379,7 @@ void S3CrtClient::init(const S3Crt::ClientConfiguration& config,
376379
m_s3CrtSigningConfig.flags.use_double_uri_encode = false;
377380
s3CrtConfig.signing_config = &m_s3CrtSigningConfig;
378381

379-
static const size_t DEFAULT_PART_SIZE = 5 * 1024 * 1024; // 5MB
382+
static const size_t DEFAULT_PART_SIZE = 8 * 1024 * 1024; // 8MB
380383
s3CrtConfig.part_size = config.partSize < DEFAULT_PART_SIZE ? DEFAULT_PART_SIZE : config.partSize;
381384

382385
Aws::Crt::Io::TlsConnectionOptions *rawPTlsConnectionOptions = nullptr;

tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/S3CrtClientConfigHeader.vm

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,29 @@
2323
std::shared_ptr<Aws::Crt::Io::ClientBootstrap> clientBootstrap;
2424

2525
/** Size of parts the files will be downloaded or uploaded in. Useful for Put/GetObject APIs
26-
* defaults to 5MB, if user set it to be less than 5MB, SDK will set it to 5MB.
26+
* defaults to 8MB, if user set it to be less than 5MB, CRT will set it to 5MB.
2727
*/
28-
size_t partSize = 5 * 1024 * 1024;
28+
size_t partSize = 8 * 1024 * 1024;
2929

3030
/** TLS Options to be used for each connection.
3131
* If scheme is Https and tlsConnectionOptions is null, SDK will create a default one for you.
3232
*/
3333
std::shared_ptr<Aws::Crt::Io::TlsConnectionOptions> tlsConnectionOptions;
3434

3535
/* Throughput target in Gbps that we are trying to reach. Normally it's the NIC's throughput */
36-
double throughputTargetGbps = 2.0;
36+
double throughputTargetGbps = 10.0;
3737

3838
/** Control the maximum memory used by downloads.
3939
* When set to a value > 0, the SDK uses flow control to bring the memory usage very close
4040
* to the specified window. Without this cap, memory usage grows proportional to file size.
4141
*/
4242
size_t downloadMemoryUsageWindow = 0;
4343

44+
/**
45+
* How much memory S3 CRT implementation will use. This will be capped to SIZE_MAX (max platform value of size_t)
46+
*/
47+
uint64_t memoryLimitBytes = 0;
48+
4449
/* Callback and associated user data for when the client has completed its shutdown process. */
4550
std::function<void(void*)> clientShutdownCallback;
4651
void *shutdownCallbackUserData = nullptr;

tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/S3CrtServiceClientSourceInit.vm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,9 @@ void ${className}::init(const ${clientConfigurationNamespace}::ClientConfigurati
345345
s3CrtConfig.enable_read_backpressure = (config.downloadMemoryUsageWindow > 0);
346346
s3CrtConfig.initial_read_window = config.downloadMemoryUsageWindow;
347347

348+
// Memory usage config:
349+
s3CrtConfig.memory_limit_in_bytes = config.memoryLimitBytes;
350+
348351
aws_s3_tcp_keep_alive_options tcp_keep_alive_options;
349352
if (config.enableTcpKeepAlive) {
350353
uint16_t configKeepAliveS = static_cast<uint16_t>(std::min(static_cast<unsigned long>(std::numeric_limits<uint16_t>::max()), config.tcpKeepAliveIntervalMs / 1000ul));
@@ -403,7 +406,7 @@ void ${className}::init(const ${clientConfigurationNamespace}::ClientConfigurati
403406
m_s3CrtSigningConfig.flags.use_double_uri_encode = false;
404407
s3CrtConfig.signing_config = &m_s3CrtSigningConfig;
405408

406-
static const size_t DEFAULT_PART_SIZE = 5 * 1024 * 1024; // 5MB
409+
static const size_t DEFAULT_PART_SIZE = 8 * 1024 * 1024; // 8MB
407410
s3CrtConfig.part_size = config.partSize < DEFAULT_PART_SIZE ? DEFAULT_PART_SIZE : config.partSize;
408411

409412
Aws::Crt::Io::TlsConnectionOptions *rawPTlsConnectionOptions = nullptr;

0 commit comments

Comments
 (0)