Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 May 2016 10:32:19 -0700
From:      hiren panchasara <hiren@strugglingcoder.info>
To:        Randall Stewart <rrs@netflix.com>
Cc:        FreeBSD Transports <transport@FreeBSD.org>
Subject:   Re: Consider this code in tcp_output.c and tcp_input.c
Message-ID:  <20160512173219.GG51099@strugglingcoder.info>
In-Reply-To: <A025183A-7E1C-452A-8700-614476F285A7@netflix.com>
References:  <A025183A-7E1C-452A-8700-614476F285A7@netflix.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--reI/iBAAp9kzkmX4
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 05/12/16 at 05:50P, Randall Stewart via freebsd-transport wrote:
> All:
>=20
> Here are a couple blocks of code from input/output
> ************************************
> tcp_input.c:
>=20
>        /*
>          * Segment received on connection.
>          * Reset idle time and keep-alive timer.
>          * XXX: This should be done after segment
>          * validation to ignore broken/spoofed segs.
>          */
>         tp->t_rcvtime =3D ticks;
>=20
> tcp_output.c:
>=20
>        /*
>          * Determine length of data that should be transmitted,
>          * and flags that will be used.
>          * If there is some data or critical controls (SYN, RST)
>          * to send, then transmit; otherwise, investigate further.
>          */
>         idle =3D (tp->t_flags & TF_LASTIDLE) || (tp->snd_max =3D=3D tp->s=
nd_una);
>         if (idle && ticks - tp->t_rcvtime >=3D tp->t_rxtcur)
>                 cc_after_idle(tp);
>=20
> **************************************
>=20
> Now this works just fine if you are the sender of the data.. i.e. we go i=
dle, and then=20
> you call send(?) to the peer.
>=20
> However what happens if say you are a CDN?
>=20
> Your client goes idle, its gotten everything.. for some period of time, m=
aybe its playing out
> its play-buffer or what ever..
>=20
> Then it sends in a request, "please send me a large block of data??
>=20
> You then start to stream out your 2Meg block of data?.
>=20
> Since you received a request at tp->t_rcvtime to send you a big block of =
data
> the timestamp is current.
>=20
> So you blast out 2Meg using your old cwnd/ssthresh and send a nice line-r=
ate
> burst? which of course hits tail drops and other fun :-)
>=20
> I believe we need to have something like:
> ***************************
> if ((tp->snd_max =3D=3D tp->and_una) && ((ticks - tp->t_rcvtime) >=3D tp-=
>t_rxtcur))) {
>      cc_after_idle(tp)
> }
> tp->t_rcvtime =3D ticks;
> ***********************************
> added so we catch both sides of the equation..

Great catch! I always thought we were covered on both sides but clearly
thats not the case.

BTW, we are very conservative in after idle case on our CC side which I
tried to fix: https://reviews.freebsd.org/D5124 (which got abandoned for
other things but you get the idea...)

Cheers,
Hiren

--reI/iBAAp9kzkmX4
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQF8BAABCgBmBQJXNL4gXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNEUyMEZBMUQ4Nzg4RjNGMTdFNjZGMDI4
QjkyNTBFMTU2M0VERkU1AAoJEIuSUOFWPt/lGT0H/jXEnK8jhrxovloWoAQysmTL
rCyFGF5o8fyBqZ2BHKAtm8xpSDqoMn15C+gLf3WSfioe+gi/iRTG2NrxOOSRaBvx
EMBNjU8COaO8JHO2Rxn+pqagUWPHIracS/zrj+ldh++3YXVf39Xpm7y0VqR8cjD/
AWaI2TP/Fe9HCzNoMQcG51yiWX4hWCyuh7UL1k2j/GjxjVD/UY/R4SCDu4nzBQWI
+mTdb2LTEPig3rY1qWePwYobR2lriZGG7YQxRM/oQg3xwcICSHGm0tf9aneTGMwM
dWassbJ55WOqzAUG+wRgNaOEDV2mhBfEaM2EaJzJxknXnZhs6r4NFncbT3HFN+A=
=kub8
-----END PGP SIGNATURE-----

--reI/iBAAp9kzkmX4--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160512173219.GG51099>