Best way to use an HTTP client in a parallel application

First I will describe my case. I have to make HTTPS requests to several APIs from my application, and they should be run at the same time. I want to know if I should use a separate HTTP client for one goroutine, or I can share one client across all goroutines. Of course, I would like to use the reuse / union of connections offered by the HTTP client, but am I worried that this is (aka goroutine) -safe flow and if the client will start the requests at the same time or will they actually be ordered?

+4
source share
1 answer

Http clients are thread safe according to the docs ( https://golang.org/src/net/http/client.go ):

Clients are safe for simultaneous use by multiple larynxes.

+14
source

All Articles