Skip to content

Commit

Permalink
http conn mucking
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Elliott <number101010@gmail.com>
  • Loading branch information
joe-elliott committed Sep 11, 2021
1 parent ab35148 commit 4b1e3cd
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tempodb/backend/gcs/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"crypto/tls"
"io"
"io/ioutil"
"net"
"net/http"
"path"
"strings"
Expand Down Expand Up @@ -214,7 +215,21 @@ func (rw *readerWriter) readRange(ctx context.Context, name string, offset int64

func createBucket(ctx context.Context, cfg *Config, hedge bool) (*storage.BucketHandle, error) {
// start with default transport
customTransport := http.DefaultTransport.(*http.Transport).Clone()
//customTransport := http.DefaultTransport.(*http.Transport).Clone()
customTransport := &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).DialContext,
ForceAttemptHTTP2: true,
MaxIdleConns: 1000,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
ReadBufferSize: 10 * 1024 * 1024,
MaxIdleConnsPerHost: 200,
}

// add google auth
transportOptions := []option.ClientOption{
Expand Down Expand Up @@ -249,6 +264,7 @@ func createBucket(ctx context.Context, cfg *Config, hedge bool) (*storage.Bucket
if cfg.Endpoint != "" {
storageClientOptions = append(storageClientOptions, option.WithEndpoint(cfg.Endpoint))
}
storageClientOptions = append(storageClientOptions, option.WithTelemetryDisabled())
client, err := storage.NewClient(ctx, storageClientOptions...)
if err != nil {
return nil, errors.Wrap(err, "creating storage client")
Expand Down

0 comments on commit 4b1e3cd

Please sign in to comment.