I have some questions when using http.Transport to setup http client
Assume we have MaxIdleConns=10
, MaxIdleConnsPerHost=2
, five different hosts each of which has two keep-live connections and that means the number of connections reach MaxIdleConns
.
- What will client do when a new connection whose target host maybe one of the five hosts is needed?
- What will client do when a new different host connection is needed?
By the way, if I have an server using http.ListenAndServe
, how to configure it, like when to close keep-live connections? I would be grateful if there were any example codes.