"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
Add --buffer-size parameter to control buffer size for copy
Nick Craig-Wood493da54113b6
diff --git a/docs/content/docs.md b/docs/content/docs.mdindex 901c690b3..9bcbacdce 100644--- a/docs/content/docs.md+++ b/docs/content/docs.md@@ -261,6 +261,13 @@ you have a 10 Mbit/s connection and you wish rclone to use half of it- 5 Mbit/s. This is 5/8 = 0.625MByte/s so you would use a `--bwlimit0.625M` parameter for rclone.+### --buffer-size=SIZE ###++Use this sized buffer to speed up file transfers. Each `--transfer`+will use this much memory for buffering.++Set to 0 to disable the buffering for the minimum memory use.+### --checkers=N ###The number of checkers to run in parallel. Checkers do the equalitydiff --git a/fs/accounting.go b/fs/accounting.goindex 72b4db762..217fe6eed 100644--- a/fs/accounting.go+++ b/fs/accounting.go@@ -348,11 +348,15 @@ func NewAccount(in io.ReadCloser, obj Object) *Account {//// If the file is above a certain size it adds an Async readerfunc NewAccountSizeNameWithBuffer(in io.ReadCloser, size int64, name string) *Account {+ const bufSize = 128 * 1024+ var buffers int+ if size >= int64(Config.BufferSize) {+ buffers = int(int64(Config.BufferSize) / bufSize)+ } else {+ buffers = int(size / bufSize)+ }// On big files add a buffer- if size > 10<<20 {- const memUsed = 16 * 1024 * 1024- const bufSize = 128 * 1024- const buffers = memUsed / bufSize+ if buffers > 0 {newIn, err := newAsyncReader(in, buffers, bufSize)if err != nil {Errorf(name, "Failed to make buffer: %v", err)diff --git a/fs/config.go b/fs/config.goindex 78695aa66..f3e684962 100644--- a/fs/config.go+++ b/fs/config.go@@ -91,6 +91,7 @@ var (backupDir = StringP("backup-dir", "", "", "Make backups into hierarchy based in DIR.")suffix = StringP("suffix", "", "", "Suffix for use with --backup-dir.")bwLimit BwTimetable+ bufferSize SizeSuffix = 16 << 20// Key to use for password en/decryption.// When nil, no encryption will be used for saving.@@ -99,6 +100,7 @@ var (func init() {VarP(&bwLimit, "bwlimit", "", "Bandwidth limit in kBytes/s, or use suffix b|k|M|G or a full timetable.")+ VarP(&bufferSize, "buffer-size", "", "Buffer size when copying files.")}// crypt internals@@ -213,6 +215,7 @@ type ConfigInfo struct {DataRateUnit stringBackupDir stringSuffix string+ BufferSize SizeSuffix}// Return the path to the configuration file@@ -358,6 +361,7 @@ func LoadConfig() {Config.NoUpdateModTime = *noUpdateModTimeConfig.BackupDir = *backupDirConfig.Suffix = *suffix+ Config.BufferSize = bufferSizeConfigPath = *configFile