@@ -98,18 +98,8 @@ func WithAWS(fs *flag.FlagSet, cb func() (*zap.Logger, bool)) imagor.Option {
9898 s3StorageClass = fs .String ("s3-storage-class" , "STANDARD" ,
9999 "S3 File Storage Class. Available values: REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE. Default: STANDARD." )
100100
101- s3HTTPMaxIdleConns = fs .Int ("s3-http-max-idle-conns" , 100 ,
102- "S3 HTTP client max idle connections across all hosts" )
103101 s3HTTPMaxIdleConnsPerHost = fs .Int ("s3-http-max-idle-conns-per-host" , 100 ,
104- "S3 HTTP client max idle connections per host. Increase for high-throughput workloads" )
105- s3HTTPMaxConnsPerHost = fs .Int ("s3-http-max-conns-per-host" , 0 ,
106- "S3 HTTP client max connections per host. 0 means unlimited" )
107- s3HTTPIdleConnTimeout = fs .Duration ("s3-http-idle-conn-timeout" , 90 * time .Second ,
108- "S3 HTTP client idle connection timeout" )
109- s3HTTPResponseHeaderTimeout = fs .Duration ("s3-http-response-header-timeout" , 0 ,
110- "S3 HTTP client response header timeout. 0 means no timeout" )
111- s3HTTPDisableKeepAlives = fs .Bool ("s3-http-disable-keep-alives" , false ,
112- "S3 HTTP client disable keep-alives. Not recommended for production" )
102+ "S3 HTTP client max idle connections per host (Go default is 2, increase for high-throughput workloads)" )
113103
114104 _ , _ = cb ()
115105 )
@@ -120,14 +110,7 @@ func WithAWS(fs *flag.FlagSet, cb func() (*zap.Logger, bool)) imagor.Option {
120110
121111 ctx := context .Background ()
122112
123- httpClient := createHTTPClient (
124- * s3HTTPMaxIdleConns ,
125- * s3HTTPMaxIdleConnsPerHost ,
126- * s3HTTPMaxConnsPerHost ,
127- * s3HTTPIdleConnTimeout ,
128- * s3HTTPResponseHeaderTimeout ,
129- * s3HTTPDisableKeepAlives ,
130- )
113+ httpClient := createHTTPClient (* s3HTTPMaxIdleConnsPerHost )
131114
132115 var loaderCfg , storageCfg , resultStorageCfg aws.Config
133116 var err error
@@ -243,28 +226,18 @@ func WithAWS(fs *flag.FlagSet, cb func() (*zap.Logger, bool)) imagor.Option {
243226 }
244227}
245228
246- func createHTTPClient (
247- maxIdleConns int ,
248- maxIdleConnsPerHost int ,
249- maxConnsPerHost int ,
250- idleConnTimeout time.Duration ,
251- responseHeaderTimeout time.Duration ,
252- disableKeepAlives bool ,
253- ) * http.Client {
229+ func createHTTPClient (maxIdleConnsPerHost int ) * http.Client {
254230 transport := & http.Transport {
255231 Proxy : http .ProxyFromEnvironment ,
256232 DialContext : (& net.Dialer {
257233 Timeout : 30 * time .Second ,
258234 KeepAlive : 30 * time .Second ,
259235 }).DialContext ,
260- MaxIdleConns : maxIdleConns ,
236+ MaxIdleConns : 100 ,
261237 MaxIdleConnsPerHost : maxIdleConnsPerHost ,
262- MaxConnsPerHost : maxConnsPerHost ,
263- IdleConnTimeout : idleConnTimeout ,
238+ IdleConnTimeout : 90 * time .Second ,
264239 TLSHandshakeTimeout : 10 * time .Second ,
265240 ExpectContinueTimeout : 1 * time .Second ,
266- ResponseHeaderTimeout : responseHeaderTimeout ,
267- DisableKeepAlives : disableKeepAlives ,
268241 ForceAttemptHTTP2 : true ,
269242 }
270243
0 commit comments