Reputation: 20412
In case of 100 concurrent connections with the same host, which could be repeating in time, would it make sense to set MaxIdleConnsPerHost to 100?
What could be a suitable value in order to avoid a big amount on unreusable TIME_WAIT status on the connection?
Upvotes: 0
Views: 1887
Reputation: 109331
As I mentioned, TIME_WAIT is't something you shouldn't worry about in this context. It's also usually not something you worry about until you actually need to, and a few systems setting usually take care of that outside of your code.
If your service is very busy, you're going to be best served by making your software as efficient as possible regardless. HTTP1.1 keepalive connections are one way to do this if you make many repeated calls to the same hosts. That said, 100 idle connections might be just fine for what you need; or it might be more than the remote service is willing to let you keep open (unless you control that too).
Measure, test, and benchmark, then figure out what sort of capacity you're going to need.
Upvotes: 2