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 upIndexeddb chunk store in browser #1456
Conversation
This comment has been minimized.
This comment has been minimized.
|
One thing I noticed is that everything breaks in Firefox's private browsing mode (ctrl+shift+P). This is because Firefox simply disables indexeddb in that mode. Maybe this could be fixed with another layered abstract chunk store (like immediate-chunk-store) that reverts to memory-chunk-store on failure. |
This comment has been minimized.
This comment has been minimized.
|
A potential optimization is to increase or remove the concurrency limit on verification here https://github.com/webtorrent/webtorrent/blob/master/lib/torrent.js#L582 (FILESYSTEM_CONCURRENCY is set to 2) idb-kv uses batching to improve the performance of indexeddb as each transaction adds a lot of overhead. Increasing the limit would allow more reads to make it into each batch, and it might speed up store verification. EDIT: I added this. The benefit was so drastic that there's no reason not to. I was seeing more than a 2x speed up of verification. EDIT2: This would load the entire torrent into memory for verification I think. The fix would be to change this from |
7958956
to
548e6c8
This comment has been minimized.
This comment has been minimized.
|
This had been suggest before, making the default for the browser a different other than memory, but we'd rather offer extensibility than by default fill the disk and maybe never get cleaned. I'm just not convinced |
This comment has been minimized.
This comment has been minimized.
|
What about just the name option and concurrency changes? |
This comment has been minimized.
This comment has been minimized.
|
Sure, for now, and we can keep the "debate" open |
This comment has been minimized.
This comment has been minimized.
|
I removed the commit that changed the default store. |
|
LGTM |
KayleePop commentedAug 2, 2018
•
edited
Here's the chunk store used https://github.com/KayleePop/idbkv-chunk-storewhich is built on this IndexedDB wrapper https://github.com/KayleePop/idb-kv
npm run sizeshows this branch's bundle to be85,873 byteswhich compared to the85,252 bytesof master is a .7% increase or 621 bytes largerHere's a deployment of instant.io using this PR's code for demo and smoke testing https://instant-io-idbkv.glitch.me/ (glitch.com is awesome)
Things to test (please share results😄 ):
EDIT: The default-chunk-store is no longer changed in this PR