On Wed, 2009-12-23 at 04:06 +0000, Martin Pool wrote:
> 2009/12/23 John A Meinel <email address hidden>:
> > We should write when we can, and not try to buffer too much. We can
> > trust that ssh will do a decent amount of buffering. I don't think this
> > means we should write a single byte at a time, but a 64kB buffer
> > actually sounds reasonable. So when we get a bit, ssh can start putting
> > it on the wire, and we can keep producing more data.
>
> I think in the absence of contrary evidence, we should only gather up
> writes enough that the syscall overhead is sufficiently amortized. So
> 1byte would obviously be quite expensive but 64kB may even be past the
> sweet spot.
In both the non-ssh and ssh case we have evidence that gathering up
writes is important - we had performance bugs with the first packet
being sent off and then us waiting for acks to send the rest of a
request. I remind the bug of this because its not a amortisation issue:
its interactions up and down the stack tht we need to beware of.
I agree that in the stream case buffering much more than is needed to
avoid syscall overhead is likely a problem. Our *goal* though, IMO, is
to saturate whatever we're writing to - whether we do that with small
writes or big ones doesn't really matter, as long as we're ahead of the
recipient it can optimise for us.
On Wed, 2009-12-23 at 04:06 +0000, Martin Pool wrote:
> 2009/12/23 John A Meinel <email address hidden>:
> > We should write when we can, and not try to buffer too much. We can
> > trust that ssh will do a decent amount of buffering. I don't think this
> > means we should write a single byte at a time, but a 64kB buffer
> > actually sounds reasonable. So when we get a bit, ssh can start putting
> > it on the wire, and we can keep producing more data.
>
> I think in the absence of contrary evidence, we should only gather up
> writes enough that the syscall overhead is sufficiently amortized. So
> 1byte would obviously be quite expensive but 64kB may even be past the
> sweet spot.
In both the non-ssh and ssh case we have evidence that gathering up
writes is important - we had performance bugs with the first packet
being sent off and then us waiting for acks to send the rest of a
request. I remind the bug of this because its not a amortisation issue:
its interactions up and down the stack tht we need to beware of.
I agree that in the stream case buffering much more than is needed to
avoid syscall overhead is likely a problem. Our *goal* though, IMO, is
to saturate whatever we're writing to - whether we do that with small
writes or big ones doesn't really matter, as long as we're ahead of the
recipient it can optimise for us.
-Rob