From 1cdc1319d6cbfc4087551e5bf0a9875c016eca1c Mon Sep 17 00:00:00 2001 From: Jordan Pittier Date: Mon, 9 Jan 2017 15:40:59 +0100 Subject: [PATCH] Make 'object save' fast again 'openstack object save' is critically slow to download big objects. While we 'stream' (chunked download) the data, the default chunks_size is 1 byte [1], which is terribly inefficient. [1] : http://docs.python-requests.org/en/master/api/#requests.Response.iter_content Closes-Bug: 1654645 Change-Id: I2223e5897346acd2f2c1fae638d1193cff833c19 --- openstackclient/api/object_store_v1.py | 2 +- releasenotes/notes/speedup-object-save-6bd59e678a31c3e8.yaml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/speedup-object-save-6bd59e678a31c3e8.yaml diff --git a/openstackclient/api/object_store_v1.py b/openstackclient/api/object_store_v1.py index 184814c610..74c4a46f20 100644 --- a/openstackclient/api/object_store_v1.py +++ b/openstackclient/api/object_store_v1.py @@ -380,7 +380,7 @@ class APIv1(api.BaseAPI): if len(os.path.dirname(file)) > 0: os.makedirs(os.path.dirname(file)) with open(file, 'wb') as f: - for chunk in response.iter_content(): + for chunk in response.iter_content(64 * 1024): f.write(chunk) def object_set( diff --git a/releasenotes/notes/speedup-object-save-6bd59e678a31c3e8.yaml b/releasenotes/notes/speedup-object-save-6bd59e678a31c3e8.yaml new file mode 100644 index 0000000000..b7ad094023 --- /dev/null +++ b/releasenotes/notes/speedup-object-save-6bd59e678a31c3e8.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Makes ``openstack object save`` much faster when saving an object to disk. + [Bug `1654645 `_]