Skip to content

Conversation

@L-Applin
Copy link
Contributor

Add CRT "shouldStream" config as "CRT_MEMORY_BUFFER_DISABLED" SDK advanced client option

Motivation and Context

Add the ability to configure the FileIO config available for the CRT client.

Modifications

Added support for advanced options methods for the S3CrtAsyncClientBuilder

Testing

  • Added unit test
  • Added integ test
  • Manual testing with 80MiB file

@L-Applin L-Applin requested a review from a team as a code owner November 21, 2025 18:27
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
76.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Optional.ofNullable(s3NativeClientConfiguration.httpMonitoringOptions())
.ifPresent(options::withHttpMonitoringOptions);
Optional.ofNullable(s3NativeClientConfiguration.memoryBufferDisabled())
.ifPresent(memoryBufferDisabled -> options.withFileIoOptions(new FileIoOptions(memoryBufferDisabled, 0.0, false)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be setting the other FileIOptions here? I think the diskThroughputGbps (the 0.0?) applies only shouldStream/memoryBufferDisabled is true - so what if the user has set memoryBufferDisabled=true and we now set the diskThroughput to 0?

Ditto on setting directIO - I assume false is the default and we don't expose configuration for this anywhere else?

Copy link
Contributor Author

@L-Applin L-Applin Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when disk throughput is set to 0, it uses the default value, which is the same as the throughputTargetGbps config. We decided to only expose shouldStream/memoryBufferDisabled so I am just setting the default value s here for he other FileIoOptions as they can't be left null.

The default for directIO is indeed false and yes we don't expose it.


/**
* Advanced configuration for the native S3CrtAsyncClient which only applies for multipart uploads. When set to true,
* the client will skip buffering the part in native memory before sending the request. Default to false on small objects,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this a little hard to parse and I'm not quite sure I understand the actual behavior... what about:

When set to true the the client will never buffer parts in native memory before sending the request.  When set to false the client will buffer parts for large objects.  Parts for small objects are never buffered. 

* and true when the object size exceed a certain threshold. When set to true, the client will also skip
* buffering for small objects.
*/
public static final SdkAdvancedAsyncClientOption<Boolean> CRT_MEMORY_BUFFER_DISABLED =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there as reason this should be on SdkAdvanced options? That seems to imply that it might apply to any async client rather than specifically to S3 CRT only?

Is there a reason to not put it on S3CrtAsyncClientBuilder only? I assume its because we want to "hide" it in "advanced" options rather than increasing the discoverability by having it on the S3 CRT client's builder direclty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exactly, we don't want this to be as discoverable as other options. This is what we decided when we discussed about it this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants