1
0
mirror of https://github.com/offen/docker-volume-backup.git synced 2025-11-29 05:46:50 +02:00

Performance optimization for sshStorage (#313)

* Performance optimization for sshStorage

* go fmt
This commit is contained in:
İbrahim Akyel
2023-12-05 23:38:33 +03:00
committed by GitHub
parent 84990ed6bd
commit 58573e6733

View File

@@ -81,7 +81,11 @@ func NewStorageBackend(opts Config, logFunc storage.Log) (storage.Backend, error
return nil, err
}
sftpClient, err := sftp.NewClient(sshClient)
sftpClient, err := sftp.NewClient(sshClient,
sftp.UseConcurrentReads(true),
sftp.UseConcurrentWrites(true),
sftp.MaxConcurrentRequestsPerFile(64),
)
if err != nil {
return nil, fmt.Errorf("NewStorageBackend: error creating sftp client: %w", err)
}
@@ -117,7 +121,7 @@ func (b *sshStorage) Copy(file string) error {
}
defer destination.Close()
chunk := make([]byte, 1000000)
chunk := make([]byte, 1e9)
for {
num, err := source.Read(chunk)
if err == io.EOF {