delayed ack和nagles算法都能減少tcp傳輸過程中的小資料包的問題
tcpip卷二25章中提到tcp為每個連接配接建立7個定時器:
1.connection established
2.restransmission
3.delayed ack(https://en.wikipedia.org/wiki/TCP_delayed_acknowledgment)
4.persist
5.keepalive
6.fin_wait_2
7.time_wait
下面是wikipedia對nagle’s算法描述的url,
https://en.wikipedia.org/wiki/Nagle%27s_algorithm
最主要的應該就是這段代碼:
if there is new data to send
if the window size >= MSS and available data is >= MSS
send complete MSS segment now
else
if there is unconfirmed data still in the pipe
enqueue data in the buffer until an acknowledge is received
else
send data immediately
end if
end if
end if
MSS(maximum segment size)