0

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?

2
  • You really need to stop worrying about TIME_WAIT ;) It's a red herring. Plus MaxIdleConnsPerHost is a client config option, not a server. Commented Mar 19, 2014 at 20:38
  • Hi @JimB :) actually this time I am talking about the http requests I am making to the external server. I am doing many cuncurrently, and TIME_WAITs add up. So I was wondering if it makes sense to raise the MaxIdleConnsPerHost value. Commented Mar 19, 2014 at 20:50

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.