Skip to content

Commit efc1154

Browse files
committed
Expose io_chunksize S3 transfer config
1 parent 9a3a026 commit efc1154

File tree

5 files changed

+34
-1
lines changed

5 files changed

+34
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "enhancement",
3+
"category": "``s3``",
4+
"description": "Expose S3 transfer config's ``io_chunksize`` in shared config file"
5+
}

awscli/customizations/s3/transferconfig.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ class RuntimeConfig:
4545
'max_queue_size',
4646
'max_bandwidth',
4747
'target_bandwidth',
48+
'io_chunksize',
4849
]
49-
HUMAN_READABLE_SIZES = ['multipart_chunksize', 'multipart_threshold']
50+
HUMAN_READABLE_SIZES = ['multipart_chunksize', 'multipart_threshold', 'io_chunksize']
5051
HUMAN_READABLE_RATES = ['max_bandwidth', 'target_bandwidth']
5152
SUPPORTED_CHOICES = {
5253
'preferred_transfer_client': [
@@ -206,6 +207,7 @@ def create_transfer_config_from_runtime_config(runtime_config):
206207
'multipart_threshold': 'multipart_threshold',
207208
'multipart_chunksize': 'multipart_chunksize',
208209
'max_bandwidth': 'max_bandwidth',
210+
'io_chunksize': 'io_chunksize',
209211
}
210212
kwargs = {}
211213
for key, value in runtime_config.items():

awscli/topics/s3-config.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ command set:
3030
size that the CLI uses for multipart transfers of individual files.
3131
* ``max_bandwidth`` - The maximum bandwidth that will be consumed for uploading
3232
and downloading data to and from Amazon S3.
33+
* ``io_chunksize`` - The maximum size of read parts that can be queued in-memory
34+
to be written for a download.
3335

3436
For experimental ``s3`` configuration values, see the the
3537
`Experimental Configuration Values <#experimental-configuration-values>`__
@@ -208,6 +210,26 @@ threads having to wait unnecessarily which can lead to excess resource
208210
consumption and connection timeouts.
209211

210212

213+
io_chunksize
214+
------------
215+
216+
**Default** - ``256KB``
217+
218+
When a GET request is called for downloads, the response contains a file-like
219+
object that streams data fetched from S3. Chunks are read from the stream and
220+
queued in-memory for writes. ``io_chunksize`` configures the maximum size of
221+
elements in the IO queue. This value can be specified using the same semantics
222+
as ``multipart_threshold``, that is either as the number of bytes as an
223+
integer, or using a size suffix.
224+
225+
Increasing this value may result in higher overall throughput by preventing
226+
blocking in cases where large objects are downloaded in environments where
227+
network speed exceeds disk write speed. It is recommended to only configure
228+
``io_chunksize`` if overall download throughput is constrained by writes.
229+
In cases where network IO is the bottleneck, it is recommended to configure
230+
``max_concurrent_requests`` instead.
231+
232+
211233
use_accelerate_endpoint
212234
-----------------------
213235

tests/unit/customizations/s3/test_factory.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ def test_proxies_transfer_config_to_default_transfer_manager(self):
231231
max_concurrent_requests=20,
232232
max_queue_size=5000,
233233
max_bandwidth=10 * MB,
234+
io_chunksize=1 * MB,
234235
)
235236
transfer_manager = self.factory.create_transfer_manager(
236237
self.params, self.runtime_config
@@ -240,6 +241,7 @@ def test_proxies_transfer_config_to_default_transfer_manager(self):
240241
self.assertEqual(transfer_manager.config.max_request_concurrency, 20)
241242
self.assertEqual(transfer_manager.config.max_request_queue_size, 5000)
242243
self.assertEqual(transfer_manager.config.max_bandwidth, 10 * MB)
244+
self.assertEqual(transfer_manager.config.io_chunksize, 1 * MB)
243245
# These configurations are hardcoded and not configurable but
244246
# we just want to make sure they are being set by the factory.
245247
self.assertEqual(

tests/unit/customizations/s3/test_transferconfig.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def test_convert(self):
149149
'max_bandwidth': 1024 * 1024,
150150
'addressing_style': 'path',
151151
'use_accelerate_endpoint': True,
152+
'io_chunksize': 1024 * 1024,
152153
# This is a TransferConfig only option, it should
153154
# just be ignored if it's in the ~/.aws/config for now.
154155
'max_in_memory_upload_chunks': 1000,
@@ -161,4 +162,5 @@ def test_convert(self):
161162
assert result.max_request_concurrency == 3
162163
assert result.max_request_queue_size == 4
163164
assert result.max_bandwidth == 1024 * 1024
165+
assert result.io_chunksize == 1024 * 1024
164166
assert result.max_in_memory_upload_chunks != 1000

0 commit comments

Comments
 (0)