Skip to content

Commit 1cdc131

Browse files
Jordan Pittierstevemar
authored andcommitted
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
1 parent 1957690 commit 1cdc131

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

openstackclient/api/object_store_v1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def object_save(
380380
if len(os.path.dirname(file)) > 0:
381381
os.makedirs(os.path.dirname(file))
382382
with open(file, 'wb') as f:
383-
for chunk in response.iter_content():
383+
for chunk in response.iter_content(64 * 1024):
384384
f.write(chunk)
385385

386386
def object_set(
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
Makes ``openstack object save`` much faster when saving an object to disk.
5+
[Bug `1654645 <https://bugs.launchpad.net/bugs/1654645>`_]

0 commit comments

Comments
 (0)