global http client or defaultclient

121 views
Skip to first unread message

jun min

unread,
Nov 30, 2020, 1:01:14 PM11/30/20
to golang-nuts
I'm make a simple http request with immutable header, immutable request timeout

Which is prefered when writing a program with http client

1. request concurrently with a global http client
2. request concurrently with `http.DefaultClient.Do(req)`

They seems both cache and reuse http connection. Are there any performance difference between them?

Andy Balholm

unread,
Nov 30, 2020, 4:37:18 PM11/30/20
to jun min, golang-nuts

I would be surprised if there were any performance differences (unless you configured the client differently), since the only difference is whether you're using a global client that you created or one that the http package created.

Andy

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/8257cf94-7155-4da6-aa4d-a4e76cd7619bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages