Gorouter buffering behavior for HTTP requests and responses
search cancel

Gorouter buffering behavior for HTTP requests and responses

book

Article ID: 297603

calendar_today

Updated On:

Products

VMware Tanzu Application Service for VMs

Environment


Resolution

  1. Does the Gorouter wait to receive all the incoming request's HTTP headers before it routes the incoming request to the target Diego container?
The Gorouter needs all of the headers before sending anything to the backend container.
 
  1. When relaying incoming request traffic to the backend container does the Gorouter buffer or wait for a certain size before it flushes or sends the TCP packets to the backend container or does it send each TCP packet as they come in?

Pivotal Engineering reviewed the RFC/golang implementation and believe that the body can be `chunked` and then will be sent by chunk to the backend container (RFC). We haven't explicitly tried this but it's what we're seeing in the docs.
 

  1. Likewise for the response from the backend container:
  • Does the Gorouter wait to receive all the HTTP headers from the response from the backend container before transmitting the response back to the client?
  • Yes. The behavior is the same as what's defined in answer #1 above.
     
  1. Does the Gorouter immediately relay each TCP packet of the response or does it buffer them?  If buffered then what is the size?

There is a FlushInterval of 50ms, which you can see in the code here.
 

  1. If there is some intermittent TCP delay or TCP error in the client to either transmit the entire request or accept the entire response, what is the retry or recovery behavior of the Gorouter?

If there is a TCP dial error, then the Gorouter will retry another backend up to three tries. This is explained in detail here.