Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign updynamic requests pipeline length #190
Conversation
| @@ -650,6 +652,10 @@ Torrent.prototype._updateWire = function (wire) { | |||
| if (wire.peerChoking) return | |||
| if (!wire.downloaded) return validateWire() | |||
|
|
|||
| var minOutstandingRequests = getPipelineLength(wire, PIPELINE_MIN_DURATION) | |||
| if (wire.requests.length >= minOutstandingRequests) return true | |||
This comment has been minimized.
This comment has been minimized.
feross
Nov 27, 2014
Member
This should just be return instead of return true since the return value is not used. Please confirm.
This comment has been minimized.
This comment has been minimized.
astro
Nov 27, 2014
Author
Contributor
Of course. I got confused because of the return validateWire() above and because one of the subfunctions returns a boolean.
This comment has been minimized.
This comment has been minimized.
|
I am in favor of documenting, refactoring, or removing the All your changes make sense to me (except for my one inline comment), so let's merge. :) |
This comment has been minimized.
This comment has been minimized.
|
Released as 0.15.0. |
astro commentedNov 27, 2014
With the fixed
MAX_OUTSTANDING_REQUESTSwe're running into the following problems when peer communication suffers from delay:Torrent.prototype._updateWire(). Unfortunately, this mechanism is difficult to understand, lacks documentation, and has multiple TODOs. I was observing quite a delay when seeking during streaming playback.I propose using a pipeline length based on a bandwidth-delay-product. Because we cannot measure delay properly in pipelined TCP communication, we assume a constant of half a second. Large enough to avoid jitter on TCP packet loss for most links, small enough to retain agility when reselecting (seeking in streams). There's a lower limit (
PIPELINE_MIN_DURATION) and an upper limit (PIPELINE_MAX_DURATION) to send requests in batches, thereby making use of the Nagle algorithm.By confining the pipeline length in a time-based way I think you could throw away a lot of calculation in
speedRanker(). Of course there's a downside with high-latency links, but it will still work with the minimum of 3 in-flight requests.The terminology is arbitrary, feel free to rename
getPipelineLength()to something else.