http.Transport -> WriteBufferSize & ReadBufferSize not working for http2

190 Views Asked by At

I am trying to increase the write buffers of my http2 client, but it is not working.

I am setting it like below (at client side):

    httpTransport := &http.Transport {
       WriteBufferSize: 83000000,
       ReadBufferSize: 83000000,
   }
   http2Transport, err := http2.ConfigureTransports(httpTransport)
   if err != nil {
       return nil, fmt.Errorf("Failed to ConfigureTransports, %v", err)
   }

   http2Transport.AllowHTTP = true // So http2.Transport doesn't complain the URL scheme isn't 'https'
   http2Transport.TLSClientConfig = tlsCfg
   http2Transport.DialTLS = dialTls

   conn = &Client{
                   Client: &http.Client{
                       Transport: http2Transport,
                       Timeout: timeout,
                   },
                 }

I am using 'http2.Transport' (returned by http2.ConfigureTransports) to use http2 protocol.

But, with this change, the connection are not coming up, giving below error: http2: no cached connection was available

Please suggest if I am doing something wrong, or any other information required (to understand the problem/situation better). I want to increase the outgoing buffers of http2 client.

Complete problem is reported here: https://github.com/golang/go/issues/61545

I tried as mentioned above, and I was expecting http2 client side outgoing buffer to get increased (to improve through put), but with WriteBufferSize & ReadBufferSize change, even connects are not coming up. Please suggest a sample working code to increase outgoing bufferrs for http2 client.

0

There are 0 best solutions below