码迷,mamicode.com
首页 > 系统相关 > 详细

linux 异常

时间:2015-03-13 20:33:02      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:

1. NoRouteToHostException异常问题的原因及解决 (转自:http://performtest163.blog.163.com/blog/static/14007696420115295119462)

    1). 根据TCP/IP协议,连接断开之后,端口不会立刻被释放,而是处于TIME_WAIT状态,等待两分钟半后,才会被释放掉,才能被新连接使用。

         而性能测试并发了3W连接,在3W连接因超时而关闭后,grinder又迅速请求3W连接,这时,已被占用的端口号未被释放,部分新建连接因为

         无法分配到端口号而失败。

     2). 通过配置TCP_TW_REUSE参数,来释放TIME_WAIT状态的端口号给新连接使用

          TCP_TW_REUSE

          This allows reusing sockets in TIME_WAIT state for new connections when it is safe from protocol viewpoint. Default value is

          0 (disabled). It is generally a safer alternative to tcp_tw_recycle 

          参考资料:http://www.speedguide.net/articles/linux-tweaking-121

      3). 在/etc/sysctl.conf中设置参数:net.ipv4.tcp_tw_reuse=1 。设置参数后,重新测试,不再出现异常情况。

linux 异常

标签:

原文地址:http://www.cnblogs.com/Jtianlin/p/4335815.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!