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 upIdea: Stream WebSeed instead of making thousand range request #1497
Comments
This comment has been minimized.
This comment has been minimized.
Agreed. My webseed server can serve a 1MB image in 1 second in 1 request. So why does webtorrent instead make 62 requests of 16KB each, which takes like 10 seconds? It doesn't make sense to me. It would be nice if we could somehow specify a different piece length when requesting from the webseed. |
This comment has been minimized.
This comment has been minimized.
|
Browser support seems quite good now. All latest browser seems to support AbortController, fetch, res.body and ReadableStream except for firefox that only lacks res.body and ReadableStream |
This comment has been minimized.
This comment has been minimized.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This comment has been minimized.
This comment has been minimized.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Instead of making 987 range request to download the Sintel Movie how about making just one request instead and have the WebSeed priorities the first pieces and all other peers starts from the end?
I'm certain that it would be faster then having to make multiple range requests to a server. A lot of packages are wasted (request and response headers takes up extra bytes, lookup time are wasted and all computing power to figure out the next range request to make up time too)
So when a WebSeed collide somewhere in the middle with what the peer are downloading - abort the streaming request
I would recommend using
node-fetchand browser'snative fetchimplementation for this since both are compatible of streaming and aborting a request usingAbortControllerboth difference in a streaming API but a whatwg streams can easily be converted to a node stream so BlockStream can used on both of themThis is just a roughly idea of how it would work:
Ofc we would have to dealt with converting this above rough example with async/await and the asyncIterator to es6 somehow and also have a fallback for browser that don't have AbortController + streaming body (firefox has moz-chunked-arraybuffer and abort if we would like to go deep - but i bet they will implement it soon)
This strategy is turned on if there is at least one WebSeed, If there would be 2 or more WebSeed the other stream would start somewhere between the first webseed and the end of what the peer is downloading