I run tons of traffic over SSL. I was thinking of speeding up these calls by using a http2 client. However, I'm hesitant to do so because it feels like i have less control on how it behaves.
Here is a production client using Go's basic net/http
ClientHTTP := &http.Client{
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
Dial: (&net.Dialer{
Timeout: timeout * time.Second,
KeepAlive: 1 * time.Minute,
}).Dial,
TLSHandshakeTimeout: timeout * time.Second,
MaxIdleConns: 3000,
MaxIdleConnsPerHost: 3000,
IdleConnTimeout: 60 * time.Second,
},
Timeout: timeout * time.Second,
}
As far as I can tell I have way less control on the transport.
ClientHTTP2 := &http.Client{
Transport: &http2.Transport{
AllowHTTP: true,
},
Timeout: timeout * time.Second,
}
Is there anything I'm missing? Is http2 production ready? I understand that http2 uses a single TCP connection and therefore things likes pools go away. Yet it somehow feels incomplete. Will these behave the same way as the production client? Is there a better way to implement ClientHTTP2
and lastly, AllowHTTP
doesn't seem to do anything. In the case where there might be an http call I thought I'd be able to able it safely, but instead it errors out.