2

Is there any relationship with http.Agent.maxSockets and the number of sockets created on the server?

I set maxSockets to 30 using http.Agent(), but there are still TIME_WAIT signals a lot. It seems like more than 30.

Is that impossible to control socket number by http.Agent()? How can I reduce the number of TIME_WAIT?

user2884721
  • 217
  • 1
  • 3
  • 8
  • I'd suggest reading this which will explain the TIME_WAIT state: http://www.softlab.ntua.gr/facilities/documentation/unix/unix-socket-faq/unix-socket-faq-2.html#time_wait. It just means that close() for a socket has been called, but the system is waiting for the last pieces of data that were sent to be finished and acked before actually closing the socket. – jfriend00 Feb 02 '15 at 02:23

1 Answers1

2

TIME_WAIT isn't a problem. It's a natural state of how TCP works, and you're not going to be able to reduce it by changing sockets on your HTTP client's agent. You're looking at two completely different things.

See also:

Community
  • 1
  • 1
Brad
  • 159,648
  • 54
  • 349
  • 530