[Kimchi-devel] [PATCH] Increase read chunk size to 1MB while uploading file
Aline Manera
alinefm at linux.vnet.ibm.com
Wed Sep 10 03:03:41 UTC 2014
With a small chunk size (the previous chunk size was 8k), the server needs to
make many read/write operations which was consuming a lot of memory from
Kimchi server for larger files. So increase it to 1MB to do not overload
the server.
Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
src/kimchi/model/storagevolumes.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/kimchi/model/storagevolumes.py b/src/kimchi/model/storagevolumes.py
index ef8e684..4d0c231 100644
--- a/src/kimchi/model/storagevolumes.py
+++ b/src/kimchi/model/storagevolumes.py
@@ -41,7 +41,7 @@ VOLUME_TYPE_MAP = {0: 'file',
3: 'network'}
-DOWNLOAD_CHUNK_SIZE = 1048576 # 1 MiB
+READ_CHUNK_SIZE = 1048576 # 1 MiB
class StorageVolumesModel(object):
@@ -97,7 +97,7 @@ class StorageVolumesModel(object):
size = 0
with open(file_path, 'wb') as f:
while True:
- data = upload_file.file.read(8192)
+ data = upload_file.file.read(READ_CHUNK_SIZE)
if not data:
break
size += len(data)
@@ -175,7 +175,7 @@ class StorageVolumesModel(object):
try:
while True:
- chunk_data = response.read(DOWNLOAD_CHUNK_SIZE)
+ chunk_data = response.read(READ_CHUNK_SIZE)
if not chunk_data:
break
--
1.9.3
More information about the Kimchi-devel
mailing list