How to avoid a NoRouteToHostException?

后端 未结 6 1859
傲寒
傲寒 2020-12-02 06:09

Disclosure: the code I\'m working on is for university coursework.

Background: The task I\'m trying to complete is to report on the effect of different threading tec

6条回答
  •  情深已故
    2020-12-02 06:28

    If you are closing 500 connection per second you will run out of sockets. If you are connecting to the same locations (web servers) that use keepalive you can implement connection pools, so you don't close and reopen sockets.

    This will save cpu too.

    Use of tcp_tw_recycle and tcp_tw_reuse can result in packets coming in from the previous connecction, that is why there is a 1 minute wait for the packets to clear.

提交回复
热议问题