Merge lp:~mbp/bzr/590638-buffering into lp:bzr
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Vincent Ladeuil | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 5321 | ||||
Proposed branch: | lp:~mbp/bzr/590638-buffering | ||||
Merge into: | lp:bzr | ||||
Diff against target: |
53 lines (+6/-17) 2 files modified
bzrlib/smart/protocol.py (+1/-0) bzrlib/tests/test_smart_transport.py (+5/-17) |
||||
To merge this branch: | bzr merge lp:~mbp/bzr/590638-buffering | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Robert Collins (community) | Needs Fixing | ||
Vincent Ladeuil | Approve | ||
Review via email: mp+27578@code.launchpad.net |
Commit message
flush stream parts after each length-prefixed bit, like we do when sending
Description of the change
In looking into bug 590638 with spiv and igc, we noticed that bzr can buffer up to 1MB of useful data when streaming from the server to the client. In other words we can get into the situation where we have 0.999MiB of data on the server ready to be sent to the client, but all the OS buffers on both sides are empty. This can at the least cause a state where the pipe is not filled, and it may also (?) cause poor tcp window behaviour.
TCP behaviour here is not trivial, and this patch probably doesn't make us optimal but it probably makes us better.
This change also makes it symmetric with the client code and other places where data is flushed down.
I think on platforms that support it we probably want to set TCP_CORK and then write as soon as we have data, then release the cork at the end of the logical operation.
I have tested this but I haven't attempted to measure a performance change. It will probably often be lost in the noise but there may be cases where it matters.
Hmm, I feel your pain, such an hard diagnostic for a one-line fix deserves reward: Approve :)