HTTP CONNETCT_TIMEOUT和 SO_TIMEOUT区别
我们的web应用,依赖于底层的服务。通过http协议通信,当底层服务宕机之后。用户的请求量还是很大,http client 超时了,因为每个请求一个线程,会导致resin的线程用完,即使底层服务恢复,resin依然不能恢复。所以调整http Client 参数 so_timeout和connection_timeout, 把connection_timeout 设置为1000,so_timeout仍然保持5000不变。单位是毫秒。
关于HTTPCONNETCT_TIMEOUT和 SO_TIMEOUT区别如下:
·CoreConnectionPNames.SO_TIMEOUT
='http.socket.timeout': definesthe socket timeout (SO_TIMEOUT
) in milliseconds, which is thetimeout for waiting for data or, put differently, a maximum period
inactivitybetween two consecutive data packets). A timeout value of zero is interpretedas an infinite timeout. This parameter expects a value of type
java.lang.Integer
.If this parameter is not set, read operations will not time out (infinitetimeout).
·CoreConnectionPNames.TCP_NODELAY
='http.tcp.nodelay': determineswhether Nagle's algorithm is to be used. Nagle's algorithm tries to conservebandwidth
by minimizing the number of segments that are sent. When applicationswish to decrease network latency and increase performance, they can disableNagle's algorithm (that is enable
TCP_NODELAY
. Data will be sentearlier, at the cost of an increase in bandwidth consumption. This parameterexpects a value of type
java.lang.Boolean
. If this parameter isnot set, TCP_NODELAY
will be enabled (no delay).
·CoreConnectionPNames.SOCKET_BUFFER_SIZE
='http.socket.buffer-size':determines the size of the internal socket buffer used to
buffer data whilereceiving / transmitting HTTP messages. This parameter expects a value of type
java.lang.Integer
.If this parameter is not set, HttpClient will allocate 8192 byte socketbuffers.
·CoreConnectionPNames.SO_LINGER
='http.socket.linger': sets
SO_LINGER
with the specified linger time in seconds. The maximum timeout value isplatform specific. Value 0 implies that the option is disabled. Value -1implies that the JRE default is used. The setting only affects the socket closeoperation. If
this parameter is not set, the value -1 (JRE default) will beassumed.
·CoreConnectionPNames.CONNECTION_TIMEOUT
='http.connection.timeout':determines the timeout in milliseconds until a connection
is established. Atimeout value of zero is interpreted as an infinite timeout. This parameterexpects a value of type
java.lang.Integer
. If this parameter isnot set, connect operations will not time out (infinite timeout).
BSD connection timeout
connect函数将激发TCP的三次握手过程,在连接建立成功或者出错时返回,出错可能是下列这种情况:
若TCP客户没有收到SYN分节的响应,则返回ETIMEOUT错误,,举例来说,调用connect函数时,BSD内核发送一个SYN,若无响应6s后再发送一个,若仍然无响应则等待24s后再发送一个,若等待了75s仍未响应则返回本错误。有些系统提供对超时值的管理性控制。
windows connection timeout
In Windows the value is dynamic forestablished conections, though the default for initial connections is 72
http://serverfault.com/questions/193160/which-is-the-default-tcp-connect-timeout-in-windows
但是经过我时间测试为21s左右,具体办法是telnet 一个存在的主机和不存在的端口。如果telent一个不存在的主机,那么直接返回主机不可到达。
一篇好贴:http://topic.csdn.net/t/20020915/17/1025424.html
Linux connection timeout
好像没有发现connection timeout的设置,最后才发现是这一个参数:可以通过sysctl
命令显示。接近180s。
tcp_syn_retries
The maximum numberof times initial SYNs for an active TCP connection attempt will beretransmitted. This value should not be higher than 255. The default value is5, which corresponds to approximately 180 seconds.
具体的时间间隔:The intervals arecontrolled by values called rtoMin,rtoMax and rtoInitial where rto stands forRound Trip Timeout. Basically, it denotes the time it would take for a packetto do a round trip. So, if when TCP sends the first msg, it would
wait forrtoInitial time. If it fails to get a response, it will double the rto (and addsome jitter value) and then try again. This will continue till maxRetries. Thecurrent rto value will never go past rtoMax.
参考:http://linux.about.com/od/commands/l/blcmdl7_tcp.htm
Java 调用
地址:http://www.javacoffeebreak.com/articles/network_timeouts/
分享到:
相关推荐
MySQL数据库连接超时(Wait_timeout)问题总结.pdfMySQL数据库连接超时(Wait_timeout)问题总结.pdfMySQL数据库连接超时(Wait_timeout)问题总结.pdfMySQL数据库连接超时(Wait_timeout)问题总结.pdfMySQL数据库连接超时...
关于MySQL的wait_timeout连接超时问题报错详细解决方案
php日志中有一条超时的日志,但是我request_terminate_timeout中设置的是0,理论上应该没有超时时间才对。 PHP Fatal error: Maximum execution time of 30 seconds exceeded in ... The timeout for serving a single
timeout 又可以细分为 connect timeout、read timeout、write timeout 怎样修改linux操作系统的tcp connect timeout
func_timeout Python模块支持以给定的超时时间运行任何现有功能。 功能超时 func_timeout 这是您传递超时,要调用的函数以及所有参数的函数,并且它最多运行#timeout#秒,并且将返回/引发传递的函数否则将返回或...
user: ‘root’ host: `localhost’ (Got timeout reading communication packets) MYSQL server has gone away 引起这个原因是不可怕的.原因是更改了系统的断开时间. mysql>show gloable variables like “%time...
离线安装包,亲测可用
在用mysql客户端对数据库进行操作时,打开终端窗口,如果一段时间没有操作,再次操作时,常常会报如下错误: ERROR 2013 (HY000): Lost ...其实,这个与interactive_timeout和wait_timeout的设置有关。 首先,看
nginx优化之request_time 和upstream_response_time差别笔者在根据nginx的accesslog中$request_time
用下面方法解决(管理mysql用的是navicat).,设置以下几个参数的值后就正常了,以下语句也可以在mysql的控制台上执行 . 代码如下: show variables like ‘%timeout... — wait_timeout=2880000 — interactive_timeout=288
dump_tcp_timeout_64964.txt
time out using software in eclipse progaming from Mr. A. Hendry
zltc_timeout_alarm.py
public static final String SCREEN_OFF_TIMEOUT = screen_off_timeout; private final int SCREEN_TIMEOUT_VALUE_NONE = Integer.MAX_VALUE;//永不休眠 private DreamBackend mBackend;//屏保管理类 @Override ...
主要介绍了MySQL slave_net_timeout参数解决的一个集群问题案例,问题日志请见正文,本文使用slave_net_timeout参数解决了这个问题,需要的朋友可以参考下
还支持获取和设置TCP_USER_TIMEOUT (Linux :penguin: 仅)选项,这与保持活动密切相关。安装npm install --save net-keepalive文献资料您可以在我们的github页面上找到 。 该项目包括TypeScript定义文件
在python开发中经常要执行一些外部的小程序,可恶的是这小程序经常阻塞了,我们在python中只看到python程序不动了还不知道程序跑到哪里。
python库。资源全名:pytest_timeout-2.0.0-py3-none-any.whl