2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 14:56:29 +00:00

s3/rest: raise connection limit to 40

This commit is contained in:
Alexander Neumann 2017-02-11 10:40:51 +01:00
parent 21b358c742
commit f266741f40
2 changed files with 4 additions and 17 deletions

View File

@ -17,7 +17,7 @@ import (
"restic/backend" "restic/backend"
) )
const connLimit = 10 const connLimit = 40
// make sure the rest backend implements restic.Backend // make sure the rest backend implements restic.Backend
var _ restic.Backend = &restBackend{} var _ restic.Backend = &restBackend{}

View File

@ -3,12 +3,10 @@ package s3
import ( import (
"bytes" "bytes"
"io" "io"
"net"
"net/http" "net/http"
"path" "path"
"restic" "restic"
"strings" "strings"
"time"
"restic/backend" "restic/backend"
"restic/errors" "restic/errors"
@ -18,7 +16,7 @@ import (
"restic/debug" "restic/debug"
) )
const connLimit = 10 const connLimit = 40
// s3 is a backend which stores the data on an S3 endpoint. // s3 is a backend which stores the data on an S3 endpoint.
type s3 struct { type s3 struct {
@ -40,19 +38,8 @@ func Open(cfg Config) (restic.Backend, error) {
be := &s3{client: client, bucketname: cfg.Bucket, prefix: cfg.Prefix} be := &s3{client: client, bucketname: cfg.Bucket, prefix: cfg.Prefix}
t := &http.Transport{ tr := &http.Transport{MaxIdleConnsPerHost: connLimit}
Proxy: http.ProxyFromEnvironment, client.SetCustomTransport(tr)
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)
be.createConnections() be.createConnections()