In order to ensure we get good performance on high capacity links with anything more than a few ms of latency, when the sender doesn't support / negotiate timestamps, we need the auto resizing of the receive buffer to support estimated RTT.
This is a first draft attempt at that. It works by using performing the resize check once every smoothed RTT (t_srtt).
It also currently includes some temporary dtrace probes to help monitor the results using the following dtrace script:
#!/usr/sbin/dtrace -s #pragma D option quiet #pragma D option switchrate=25hz int last[int]; int last_check[int]; dtrace:::BEGIN { printf(" %12s %12s %9s %7s %9s %9s %9s %9s %12s %12s %12s\n", "dt(us)", "dt_check(us)", "rtt_check", "srtt", "newsize", "ticks", "rfbuf_ts", "rtttime", "ack", "seq", "rtseq"); } tcp:::receive-autoresize /(args[4]->tcp_sport == 80 || args[4]->tcp_sport == 443) && args[5] != 4/ { elapsed = (timestamp - last[args[1]->cs_cid]) / 1000; printf(" %12d %12s %9d %7d %9d %9d %9d %9d %12d %12d %12d\n", elapsed, "n/a", args[5], args[3]->tcps_srtt, args[0], args[2], args[3]->tcps_rfbuf_ts, args[3]->tcps_rtttime, args[4]->tcp_ack, args[4]->tcp_seq, args[3]->tcps_rtseq); last[args[1]->cs_cid] = timestamp; } tcp:::receive-autoresize /(args[4]->tcp_sport == 80 || args[4]->tcp_sport == 443) && args[5] == 4/ { elapsed = (timestamp - last[args[1]->cs_cid]) / 1000; elapsed_check = (timestamp - last_check[args[1]->cs_cid]) / 1000; printf(" %12d %12d %9d %7d %9d %9d %9d %9d %12d %12d %12d\n", elapsed, elapsed_check, args[5], args[3]->tcps_srtt, args[0], args[2], args[3]->tcps_rfbuf_ts, args[3]->tcps_rtttime, args[4]->tcp_ack, args[4]->tcp_seq, args[3]->tcps_rtseq); last[args[1]->cs_cid] = timestamp; last_check[args[1]->cs_cid] = timestamp; }
Initial test results look good with S3 downloads at ~17ms latency on a 1Gbps connection jumping from ~3MB/s to ~80MB/s.