Change tcp.inflight_min from 1024 to a production default of 6144. Create

a sysctl for the stabilization value for the bandwidth delay product (inflight)
algorithm and document it.

MFC after:	3 days
This commit is contained in:
dillon 2002-12-14 21:00:17 +00:00
parent bb0e8ad59a
commit 524e713804
4 changed files with 56 additions and 8 deletions

View File

@ -343,6 +343,19 @@ This value should not generally be modified but may be used to set a
global per-connection limit on queued data, potentially allowing you to
intentionally set a less then optimum limit to smooth data flow over a
network while still being able to specify huge internal TCP buffers.
.It tcp.inflight_stab
The bandwidth delay product algorithm requires a slightly larger window
then it otherwise calculates for stability. This parameter determines the
extra window in maximal packets / 10. The default value of 20 represents
2 maximal packets. Reducing this value is not recommended but you may
come across a situation with very slow links where the ping time
reduction of the default inflight code is not sufficient. If this case
occurs you should first try reducing tcp.inflight_min and, if that does not
work, reduce both tcp.inflight_min and tcp.inflight_stab, trying values of
15, 10, or 5 for the latter. Never use a value less then 5. Reducing
tcp.inflight_stab can lead to upwards of a 20% underutilization of the link
as well as reducing the algorithm's ability to adapt to changing
situations and should only be done as a last resort.
.El
.Sh ERRORS
A socket operation may fail with one of the following errors returned:

View File

@ -587,6 +587,21 @@ only effects data transmission (uploading / server-side).
It does not
effect data reception (downloading).
.Pp
Adjusting
.Va net.inet.tcp.inflight_stab
is not recommended.
This parameter defaults to 20, representing 2 maximal packets added
to the bandwidth delay product window calculation. The additional
window is required to stabilize the algorithm and improve responsiveness
to changing conditions, but it can also result in higher ping times
over slow links (though still much lower then you would get without
the inflight algorithm). In such cases you may
wish to try reducing this parameter to 15, 10, or 5, and you may also
have to reduce
.Va net.inet.tcp.inflight_min
(for example, to 3500) to get the desired effect. Reducing these parameters
should be done as a last resort only.
.Pp
The
.Va net.inet.ip.portrange.*
sysctls control the port number ranges automatically bound to TCP and UDP

View File

@ -166,13 +166,16 @@ static int tcp_inflight_debug = 0;
SYSCTL_INT(_net_inet_tcp, OID_AUTO, inflight_debug, CTLFLAG_RW,
&tcp_inflight_debug, 0, "Debug TCP inflight calculations");
static int tcp_inflight_min = 1024;
static int tcp_inflight_min = 6144;
SYSCTL_INT(_net_inet_tcp, OID_AUTO, inflight_min, CTLFLAG_RW,
&tcp_inflight_min, 0, "Lower-bound for TCP inflight window");
static int tcp_inflight_max = TCP_MAXWIN << TCP_MAX_WINSHIFT;
SYSCTL_INT(_net_inet_tcp, OID_AUTO, inflight_max, CTLFLAG_RW,
&tcp_inflight_max, 0, "Upper-bound for TCP inflight window");
static int tcp_inflight_stab = 20;
SYSCTL_INT(_net_inet_tcp, OID_AUTO, inflight_stab, CTLFLAG_RW,
&tcp_inflight_stab, 0, "Inflight Algorithm Stabilization 20 = 2 packets");
static void tcp_cleartaocache(void);
static struct inpcb *tcp_notify(struct inpcb *, int);
@ -1652,8 +1655,9 @@ tcp_xmit_bandwidth_limit(struct tcpcb *tp, tcp_seq ack_seq)
/*
* Calculate the semi-static bandwidth delay product, plus two maximal
* segments. The additional slop puts us squarely in the sweet
* spot and also handles the bandwidth run-up case. Without the
* slop we could be locking ourselves into a lower bandwidth.
* spot and also handles the bandwidth run-up case and stabilization.
* Without the slop we could be locking ourselves into a lower
* bandwidth.
*
* Situations Handled:
* (1) Prevents over-queueing of packets on LANs, especially on
@ -1669,9 +1673,15 @@ tcp_xmit_bandwidth_limit(struct tcpcb *tp, tcp_seq ack_seq)
* (3) Theoretically should stabilize in the face of multiple
* connections implementing the same algorithm (this may need
* a little work).
*
* (4) Stability value (defaults to 20 = 2 maximal packets) can
* be adjusted with a sysctl but typically only needs to be
* on very slow connections. A value no smaller then 5
* should be used, but only reduce this default if you have
* no other choice.
*/
#define USERTT ((tp->t_srtt + tp->t_rttbest) / 2)
bwnd = (int64_t)bw * USERTT / (hz << TCP_RTT_SHIFT) + 2 * tp->t_maxseg;
bwnd = (int64_t)bw * USERTT / (hz << TCP_RTT_SHIFT) + tcp_inflight_stab * tp->t_maxseg / 10;
#undef USERTT
if (tcp_inflight_debug > 0) {

View File

@ -166,13 +166,16 @@ static int tcp_inflight_debug = 0;
SYSCTL_INT(_net_inet_tcp, OID_AUTO, inflight_debug, CTLFLAG_RW,
&tcp_inflight_debug, 0, "Debug TCP inflight calculations");
static int tcp_inflight_min = 1024;
static int tcp_inflight_min = 6144;
SYSCTL_INT(_net_inet_tcp, OID_AUTO, inflight_min, CTLFLAG_RW,
&tcp_inflight_min, 0, "Lower-bound for TCP inflight window");
static int tcp_inflight_max = TCP_MAXWIN << TCP_MAX_WINSHIFT;
SYSCTL_INT(_net_inet_tcp, OID_AUTO, inflight_max, CTLFLAG_RW,
&tcp_inflight_max, 0, "Upper-bound for TCP inflight window");
static int tcp_inflight_stab = 20;
SYSCTL_INT(_net_inet_tcp, OID_AUTO, inflight_stab, CTLFLAG_RW,
&tcp_inflight_stab, 0, "Inflight Algorithm Stabilization 20 = 2 packets");
static void tcp_cleartaocache(void);
static struct inpcb *tcp_notify(struct inpcb *, int);
@ -1652,8 +1655,9 @@ tcp_xmit_bandwidth_limit(struct tcpcb *tp, tcp_seq ack_seq)
/*
* Calculate the semi-static bandwidth delay product, plus two maximal
* segments. The additional slop puts us squarely in the sweet
* spot and also handles the bandwidth run-up case. Without the
* slop we could be locking ourselves into a lower bandwidth.
* spot and also handles the bandwidth run-up case and stabilization.
* Without the slop we could be locking ourselves into a lower
* bandwidth.
*
* Situations Handled:
* (1) Prevents over-queueing of packets on LANs, especially on
@ -1669,9 +1673,15 @@ tcp_xmit_bandwidth_limit(struct tcpcb *tp, tcp_seq ack_seq)
* (3) Theoretically should stabilize in the face of multiple
* connections implementing the same algorithm (this may need
* a little work).
*
* (4) Stability value (defaults to 20 = 2 maximal packets) can
* be adjusted with a sysctl but typically only needs to be
* on very slow connections. A value no smaller then 5
* should be used, but only reduce this default if you have
* no other choice.
*/
#define USERTT ((tp->t_srtt + tp->t_rttbest) / 2)
bwnd = (int64_t)bw * USERTT / (hz << TCP_RTT_SHIFT) + 2 * tp->t_maxseg;
bwnd = (int64_t)bw * USERTT / (hz << TCP_RTT_SHIFT) + tcp_inflight_stab * tp->t_maxseg / 10;
#undef USERTT
if (tcp_inflight_debug > 0) {