-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement bandwidth limiting for
barman-cloud-backup
Limits the average bandwidth used by `barman-cloud-backup` when backing up to either AWS S3 or Azure Blob Storage according to the value set by a new CLI option `--max-bandwidth`. This is implemented by throttling the rate at which chunks are enqueued for upload. Rate limiting is applied by calculating the minimum time before a new chunk can be uploaded based on the size of the last uploaded chunk and the requested maximum bandwidth. The remaining time to wait is then calculated from this value and the elapsed time since the last upload. If the minimum time has already elapsed then no waiting occurs. The throttling happens just before a new part is uploaded so that any time spent compressing data or flushing the buffer to disk has already happened before we calculate how long we must wait. If `--max-bandwidth` is not set then no throttling is applied. Because we throttle the upload rate in the parent rather than the workers, it is not guaranteed that we will always stay under `--max-bandwidth`. For example, if there is a period of network saturation which allows queued chunks to accumulate on disk, when that saturation clears the workers will upload the queued chunks as fast as they possibly can. The size of this spike will be limited by the size of the queue and, given the queue size is currently limited to 2 * the number of workers, the practical impact of such a spike will be low. Note that because bandwidth limiting is implemented for multipart uploads and backups to Google Cloud Storage do not currently use multipart uploads, the `--max-bandwidth` option will have no effect when used with `--cloud-provider=google-cloud-storage`. Closes BAR-114.
- Loading branch information
1 parent
b0b8789
commit 6e9a7f9
Showing
6 changed files
with
356 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.