The http.Transport caches connections for future re-use
https://golang.org/pkg/net/http/#Transport

Are requests sent serially by which I mean only one request and response 
can be handled by this persistent connection at a time, so that other 
concurrent requests to the same host are blocked until a response is 
received and closed?

If I forget to Close() a Response.Body, does that leave the connection open 
so that it can't be shared? Do other concurrent requests open a new 
connection during that time? 

And if I do forget, by default the Transport.IdleConnTimeout will close any 
connections automatically for me right?

I understand that persistent connections save on protocol overhead, but if 
it can only handle one request at a time wouldn't in some cases it be 
better to have a pool of clients each with their own persistent connection 
to the same host to allow for parallel requests?

Alternatively, I could increase the Transport.MaxIdleConns or 
Transport.MaxIdleConnsPerHost right? Which would trade throughput for 
server resources to maintain those connections.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to