Bump the CHUNKSIZE to use CPU more efficiently

The chunk size used for downloading images was 64KiB for some time. That
is okay for relatively small images but the client side of CPU can be a
bottleneck especially for large images. Bump the default chunk size from
64KiB to 1MiB so we can use the client side CPU more efficiently.

[64KiB chunk size - current]
INFO cinder.image.image_utils Image download 1907.35 MB at 68.61 MB/s
-> ~ 549 Mbps

[1MiB chunk size - patched]
INFO cinder.image.image_utils Image download 1907.35 MB at 132.10 MB/s
-> 1,057 Mbps

Closes-Bug: #2020139
Change-Id: I8b6e19621fc989526b02319d88fcfde88a17eee0
(cherry picked from commit 7d78cc4b9d43f5abdf8c7fa05e37ab8c8122c325)
This commit is contained in:
Nobuto Murata 2023-05-19 09:36:49 +09:00 committed by Rajat Dhasmana
parent d94f563363
commit 3a2ef8b105

@ -40,7 +40,7 @@ osprofiler_web = importutils.try_import("osprofiler.web")
LOG = logging.getLogger(__name__)
USER_AGENT = 'python-glanceclient'
CHUNKSIZE = 1024 * 64 # 64kB
CHUNKSIZE = 1024 * 1024 # 1MiB
REQ_ID_HEADER = 'X-OpenStack-Request-ID'
TOKEN_HEADERS = ['X-Auth-Token', 'X-Service-Token']