What is the cost of many TIME_WAIT on the server side?

后端 未结 6 447
一整个雨季
一整个雨季 2020-11-27 10:50

Let\'s assume there is a client that makes a lot of short-living connections to a server.

If the client closes the connection, there will be many ports in TIME

6条回答
  •  半阙折子戏
    2020-11-27 11:15

    In my scenario i ran a script which schedules files repeatedly,my product do some computations and sends response to client ie client is making a repetitive http call to get the response of each file.When around 150 files are scheduled socket ports in my server goes in time_wait state and an exception is thrown in client which opens a http connection ie

     Error : [Errno 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted
    

    The result was that my application hanged.I do not know may be threadshave gone in wait state or what has happened but i need to kill all processes or restart my application to make it work again.

    I tried reducing wait time to 30 seconds since it is 240 seconds by default but it did not work.

    So basically overall impact was critical as it made my application non-responsive

提交回复
热议问题