ChunkedBackupDriver: Freeing memory on restore
When restoring many backups, the backup service uses a lot of memory and when we do many concurrent restores the backup service ends up getting killed becase the system runs out of memory. This patch reduces the ref count to the data as soon as possible to let Python garbage collect it instead of hogging it for the whole chunk restore. Related-Bug: #1865011 Change-Id: I942d9d8b3976232ae1cf82b698fb27285fbef13a
This commit is contained in:
parent
a154a1360b
commit
69462315bc
|
@ -717,9 +717,12 @@ class ChunkedBackupDriver(driver.BackupDriver):
|
|||
LOG.debug('decompressing data using %s algorithm',
|
||||
compression_algorithm)
|
||||
decompressed = decompressor.decompress(body)
|
||||
body = None # Allow Python to free it
|
||||
volume_file.write(decompressed)
|
||||
decompressed = None # Allow Python to free it
|
||||
else:
|
||||
volume_file.write(body)
|
||||
body = None # Allow Python to free it
|
||||
|
||||
# force flush every write to avoid long blocking write on close
|
||||
volume_file.flush()
|
||||
|
|
Loading…
Reference in New Issue