Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPU bound at high download speeds – need resource management #1026

Open
dcposch opened this issue Jan 25, 2017 · 14 comments
Open

CPU bound at high download speeds – need resource management #1026

dcposch opened this issue Jan 25, 2017 · 14 comments

Comments

@dcposch
Copy link
Contributor

@dcposch dcposch commented Jan 25, 2017

What version of WebTorrent?
WebTorrent Desktop 0.17.2

What operating system and hardware?
MacOS Sierra

2016 12" Macbook, plugged in

What did you expect to happen?
Download speed limited only by available network bandwidth and peers.

What actually happened?
It looks like WebTorrent is saturating the CPU during fast downloads:

image

@dcposch

This comment has been minimized.

Copy link
Contributor Author

@dcposch dcposch commented Jan 25, 2017

@feross two ideas:

  1. We could use the node profiler to figure out where WebTorrent is spending time in JS
  2. If it turns out as I suspect and a lot of time is spent in Chromium because of WebRTC, then we could try setting a global limit on the number of peers we talk to at once. We'd prioritize the fastest peers.
@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Jan 25, 2017

My guess is that the hashing to verify the pieces is the CPU-consuming monster.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jan 25, 2017

@dcposch We ought to do both IMO

@sliterok

This comment has been minimized.

Copy link

@sliterok sliterok commented Feb 5, 2017

Also ram consumption is really heavy
image
image

@catchstar

This comment has been minimized.

Copy link

@catchstar catchstar commented Apr 15, 2017

@sliterok
i have the same issue. Webtorrent can't release the memory even i have removed the torrent by client.remove(). When i add some more magnet it occurs an memory leak error.
Do you have solve the problem? please tell me.
the same issue: #1104

@sliterok

This comment has been minimized.

Copy link

@sliterok sliterok commented Apr 15, 2017

@catchstar
Hm, i've experienced memory leaks only when i download something.
BTW I haven't solved this trouble, but now i'm using qbittorrent.

@catchstar

This comment has been minimized.

Copy link

@catchstar catchstar commented Apr 15, 2017

@sliterok
i see. Thank you.

@crzidea

This comment has been minimized.

Copy link

@crzidea crzidea commented Apr 18, 2017

I have the same issue. Can't release memory after remove torrent.

@crzidea

This comment has been minimized.

Copy link

@crzidea crzidea commented Apr 18, 2017

Solved, this issue is caused by dht options. Tune the option to reduce resource usage.

@catchstar

This comment has been minimized.

Copy link

@catchstar catchstar commented Apr 18, 2017

@crzidea
i don't think this is a good solution because when use webtorrent to download by magnet it will fail because of tune the dht option to false.
i still can't solve this issue.

@crzidea

This comment has been minimized.

Copy link

@crzidea crzidea commented Apr 19, 2017

@catchstar No need to set the option to false, just tune the numbers for torrent-dht.

@catchstar

This comment has been minimized.

Copy link

@catchstar catchstar commented Apr 25, 2017

@crzidea
Thanks a lot. it works.

@CyberShadow

This comment has been minimized.

Copy link

@CyberShadow CyberShadow commented Jun 4, 2017

Here is a trace I did back in April for webtorrent-cli. The process becomes so CPU-bound, that the player can't even request more chunks quickly enough for continuous playback, despite webtorrent-cli having already downloaded a big % of the file.

Looking at the trace, it looks like validateWire is the likely culprit. It seems to be called from a lot of places and seems to do a lot of work.

@stale stale bot added the stale label May 3, 2018
@webtorrent webtorrent deleted a comment from stale bot May 4, 2018
@stale stale bot removed the stale label May 4, 2018
@stale stale bot removed the stale label May 4, 2018
@feross feross added accepted stale and removed area/perf labels May 4, 2018
@stale stale bot removed the stale label May 4, 2018
@feross feross added the area/perf label May 4, 2018
@vankasteelj

This comment has been minimized.

Copy link

@vankasteelj vankasteelj commented May 9, 2018

subscribing (from #1224 )

What's your DHT tuned option? I'm only using this so far:

Streamer.client = new (require('webtorrent'))({
  maxConns: 40,
  tracker: {
    wrtc: false
  }
});
@feross feross changed the title CPU bound at high download speeds CPU bound at high download speeds – need resource management Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
8 participants
You can’t perform that action at this time.