From f266741f406d14f11142878d6040cbe03015585d Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sat, 11 Feb 2017 10:40:51 +0100 Subject: [PATCH] s3/rest: raise connection limit to 40 --- src/restic/backend/rest/rest.go | 2 +- src/restic/backend/s3/s3.go | 19 +++---------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/restic/backend/rest/rest.go b/src/restic/backend/rest/rest.go index 7121de945..2c133872b 100644 --- a/src/restic/backend/rest/rest.go +++ b/src/restic/backend/rest/rest.go @@ -17,7 +17,7 @@ import ( "restic/backend" ) -const connLimit = 10 +const connLimit = 40 // make sure the rest backend implements restic.Backend var _ restic.Backend = &restBackend{} diff --git a/src/restic/backend/s3/s3.go b/src/restic/backend/s3/s3.go index bd79dda13..2c7c02c60 100644 --- a/src/restic/backend/s3/s3.go +++ b/src/restic/backend/s3/s3.go @@ -3,12 +3,10 @@ package s3 import ( "bytes" "io" - "net" "net/http" "path" "restic" "strings" - "time" "restic/backend" "restic/errors" @@ -18,7 +16,7 @@ import ( "restic/debug" ) -const connLimit = 10 +const connLimit = 40 // s3 is a backend which stores the data on an S3 endpoint. type s3 struct { @@ -40,19 +38,8 @@ func Open(cfg Config) (restic.Backend, error) { be := &s3{client: client, bucketname: cfg.Bucket, prefix: cfg.Prefix} - t := &http.Transport{ - Proxy: http.ProxyFromEnvironment, - DialContext: (&net.Dialer{ - Timeout: 30 * time.Second, - KeepAlive: 30 * time.Second, - }).DialContext, - MaxIdleConns: 100, - MaxIdleConnsPerHost: 30, - IdleConnTimeout: 90 * time.Second, - TLSHandshakeTimeout: 10 * time.Second, - ExpectContinueTimeout: 1 * time.Second, - } - client.SetCustomTransport(t) + tr := &http.Transport{MaxIdleConnsPerHost: connLimit} + client.SetCustomTransport(tr) be.createConnections()