Connection timeout and socket timeout advice

前端 未结 1 594
半阙折子戏
半阙折子戏 2021-01-13 14:03

I\'m currently doing some research into connection and socket timeout settings but I\'m fairly new to this stuff.

As a stab in the dark we are thinking of adding 40

相关标签:
1条回答
  • There's no reason whatsoever why they should be equal. Considering each condition separately, you want to set it high enough that a timeout will indicate a genuine problem rather than just a temporary overload, and low enough that you maintain responsiveness of the application.

    As a rule, 40 seconds is far too long for a connect timeout. I would view anything in double figures with suspicion. A server should be able to accept tens or hundreds of connections per second.

    Read timeouts are a completely different matter. The 'correct' value, if there is such a thing, depends entirely on the average service time for the request and on its variance. As a starting point, you might want to set it to double the expected service time, or the average service time plus two or three standard deviations, depending entirely on your service level requirements and the performance of your server and its variance. There is no hard and fast rule about this. Many contractual service level agreements (SLAs) specify a 'normal' response time of two seconds, which may inform your deliberations. But it's your decision.

    0 讨论(0)
提交回复
热议问题