⚡ http client defer CloseIdleConnections by cuisongliu · Pull Request #1513 · prometheus/client_golang (original) (raw)

Currently, doing an HTTP probe requiring allocating a new http.Client and http.Transport, and the underlying connections managed by http.Transport might be ESTABLISHED indefinitely if no parties (client or server) directly close them. As a result, if the probes continuously happen, we can see TCP connections opened by one process
drastically increase.

I understand that there may be such a problem in high concurrency. Even if it is reused, the connection is limited and cannot meet the requirements. In this case, the connection may be occupied and new connections cannot be applied for. As a result, the connection request cannot be continued.

PS. I appeared in a high-concurrency scenario, with about 10000 of concurrencies.