benchmark.js.ipfs.io #946
Description
First of all, great work with js-ipfs!
I have been trying to implement file streaming with ipfs in browser and face a performance lag when trying to stream large files with js-ipfs in the browser.
To simplify the case and not to add any custom code implementations, I am following the example of transfering files between browser and other ipfs nodes here:
https://github.com/ipfs/js-ipfs/tree/master/examples/exchange-files-in-browser
So this example works nicely when working with small files, but when I try to fetch larger ones, I get a performance lag.
Scenario 1 (Websockets connection):
- I start a go-ipfs daemon (let's say node1) with websockets connection enabled
- I add a file sized ~4MB locally with the CLI.
- I connect a browser-node (node2) with the go-ipfs node and request the file.
The file stream is finished after approx. 36-39 seconds, and for some reason the browser-node drains the cpu resources, and sometimes craches the browser.
Scenario 2 (WebRTC connection):
- With the two nodes open, I open a third browser-node (node3) (incognito window) and
- connect it with the already opened browser-node (node2) using WebRTC.
The file stream is also finished after approx. 36-39 seconds, and the cpu is also drained.
Scenario 3 (WebRTC & Websockets connection):
- With the two nodes open, I connect the third browser-node (node3) with both node1 and node2 that already have the file.
- I request the file and have the same results: the file stream lasts ~40 seconds and the cpu resources issue still remains.
I have the latest update of js-ipfs (latest commit: a85cf70), and I tried the scenarios again with the same results.
Any ideas or directions of what causes this issue, and how to overcome this?
Many thanks!