Write the first body chunk in the initial packet. #557

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@nelhage
nelhage commented Mar 4, 2016

fixes #556

When #266 was fixed, it caused a regression in the behavior from #233,
which deliberately merged the initial writes to the socket, for network
efficiency and to avoid triggering the pathological behavior caused by
the combination of Nagle's Algorithm and TCP delayed ACKs.

Restore that optimization, in a slightly more general way: Do a
nonblocking read of an initial chunk of data off the provided body, and
merge that with the headers before sending.

@nelhage nelhage Write the first body chunk in the initial packet.
When #266 was fixed, it caused a regression in the behavior from #233,
which deliberately merged the initial writes to the socket, for network
efficiency and to avoid triggering the pathological behavior caused by
the combination of Nagle's Algorithm and TCP delayed ACKs.

Restore that optimization, in a slightly more general way: Do a
nonblocking read of an initial chunk of data off the provided body, and
merge that with the headers before sending.
8fc63ae
@nelhage
nelhage commented Mar 4, 2016

I'm of mixed feelings about the read_nonblock approach; I like that it keeps the "we always treat body as an IO` simplification introduced in #266, but it also seems like it increases the possible surface area for weird interaction with weird bodies. I'm happy to go back to something that looks more like the pre-#266 code if you'd prefer.

@geemus
Contributor
geemus commented Mar 7, 2016

Hey, thanks for the details and kicking this off. I started from here and made a couple (hopefully good/reasonable) tweaks here: #559. What do you think?

@geemus
Contributor
geemus commented Mar 7, 2016

adapted into #559

@geemus geemus closed this Mar 7, 2016
@nelhage nelhage deleted the nelhage:single-packet branch Mar 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment