firefox skills - hanyong/note GitHub Wiki
firefox 使用技巧
配置 TCP KEEPALIVE
LVS 进行 TCP 转发时, 连接空闲一段时间 (90s) 后就会被关闭, 客户端与服务器均收到 TCP RESET 包中断 TCP 连接。 这时发现 firefox 会重发请求, 导致服务器重复收到请求。 搜索了一下发现这时 HTTP/1.1 标准定义的行为: https://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.2.4 。 TCP 空闲时发送 KEEPALIVE 心跳包可避免 TCP 空闲被 RESET。 查了下 firefox 默认长连接超过 60s 后发送 KEEPALIVE 间隔是 600s, 修改为 60s 即可解决问题。
搜到一个链接 https://bugzilla.mozilla.org/show_bug.cgi?id=444328 对相关配置解释如下:
v2.0 Enable TCP Keepalive for short and long-lived HTTP Connections
Enable Keepalives by default for HTTP connections (except SPDY).
HTTP Idle/'Short-lived' (i.e. first 60s after request is sent):
-- Idle time: 10s (until first probe; between successful probes).
-- Retry interval: 1 RTT (as measured at TCP connection time); minimum 1 sec.
WebSockets/'Long-lived' (i.e. after first 60s).
-- Idle time: 10 mins.
-- Retry interval: same as above.
Notes:
-- HTTP Idle connections always use the 'short-lived' keepalive config, unless they become reused.
-- WebSockets are converted to 'long-lived' upon the call to TakeTransport.
-- Keepalives always disabled for SPDY (disabled in StartSpdy).