-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add read stats for split cars & speed up loading (#91)
* Add read stats for split cars * Add same speed improvements to split car fetching as for remote car (single file). * Improve errors
- Loading branch information
1 parent
e183b93
commit 97bc2fd
Showing
9 changed files
with
242 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1 @@ | ||
package main | ||
|
||
import ( | ||
"net" | ||
"net/http" | ||
"time" | ||
|
||
"github.com/klauspost/compress/gzhttp" | ||
) | ||
|
||
var ( | ||
defaultMaxIdleConnsPerHost = 100 | ||
defaultTimeout = 1000 * time.Second | ||
defaultKeepAlive = 180 * time.Second | ||
) | ||
|
||
func newHTTPTransport() *http.Transport { | ||
return &http.Transport{ | ||
IdleConnTimeout: time.Minute, | ||
MaxConnsPerHost: defaultMaxIdleConnsPerHost, | ||
MaxIdleConnsPerHost: defaultMaxIdleConnsPerHost, | ||
MaxIdleConns: defaultMaxIdleConnsPerHost, | ||
Proxy: http.ProxyFromEnvironment, | ||
DialContext: (&net.Dialer{ | ||
Timeout: defaultTimeout, | ||
KeepAlive: defaultKeepAlive, | ||
}).DialContext, | ||
ForceAttemptHTTP2: true, | ||
// MaxIdleConns: 100, | ||
TLSHandshakeTimeout: 10 * time.Second, | ||
// ExpectContinueTimeout: 1 * time.Second, | ||
} | ||
} | ||
|
||
// newHTTPClient returns a new Client from the provided config. | ||
// Client is safe for concurrent use by multiple goroutines. | ||
func newHTTPClient() *http.Client { | ||
tr := newHTTPTransport() | ||
|
||
return &http.Client{ | ||
Timeout: defaultTimeout, | ||
Transport: gzhttp.Transport(tr), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package main | ||
package rangecache | ||
|
||
import ( | ||
"context" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package main | ||
package rangecache | ||
|
||
import ( | ||
"bytes" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.