Connection keepalive
TCP keepalive
= 心跳包
linux tcp keepalive 参数:
tcp_keepalive_time: 7200
tcp_keepalive_intvl 75
tcp_keepalive_probes 9
发现有7200秒未收到对端数据时,开始以75秒间隔发送心跳包,9次不成功close连接
HTTP keep-alive
Http连接种类:
短连接: openSocket->send1->receive1>closeSocket openSocket-send2>receive2>closeSocket 一个连接只用一次
长连接: keep-alive所谓的伪RPC, openSocket->send1->receive1>send2>receive2>.....顺序发送.....>closeSocket 连接复用
并行连接: 并发短连接
http/1.1开始默认开启keep-alive