Registered Member
|
I only have about 6 torrents seeding and 8 downloading, and I'm seeing some high CPU usage, higher than it was before.
The main thread seems to sit at around 50% (more or less) and the other two threads sit at 15% each. Is there a good way to figure out where KT is spending all its time, and try to minimize that? My 2Ghz machine feels like its made of molasses with ktorrent running. |
Registered Member
|
|
Registered Member
|
The usage isn't GUI related as far as I can tell. I have mine set to update every 2 seconds.
I recall the list/map code in the authenticationmonitor taking up an absurd amount of CPU time. Also, seems I should have documented my patch a little better. There was a reason I reoganized that big ball of ifs in the authenticationmanager, to reduce the calls to ab->getSocket(), and to fix the following:
that ab->deleteLater() can and will be called on a NULL pointer. refactoring all that if code makes it much clearer whats being done and what's intended. Too many strung together checks as the authenticationmonitor does, reduces performance (calling vitual methods over and over in a "tight" loop is not good), and reduces clarity quite a bit. |
Registered Member
|
I noticed high CPU usage with SVN today. I have at least 521 active and seeding torrents. GUI update interval is 1 second. CPU usage did not drop when KTorrent was minimized to the system tray (GUI being updated even when KTorrent is not shown?). However when I switched to an empty group, CPU usage dropped a lot.
Thank you KTorrent developers!
_________________ "Thou shalt not steal." - STOP PIRACY NOW! |
Registered Member
|
521 torrents, are you INSANE?
the gui has nothing to do with my usage, I have the "active downloads" pane set, and theres all of 8 torrents in there. Changing to an empty group didn't help me much. Probably not. I doubt it has anything to do with the GUI imo. ktorrent still does a lot of stuff behind the gui. |
Registered Member
|
|
Moderator
|
High CPU usage, well that was probably a bit expected after the LAN speed changes.
What kind of situations are we talking about here ? How many uploads, how many downloads ? How fast are we going ? What where the upload and download caps ? EDIT: btw thanks for pointing out that problem with deleteLater, can't believe I missed that. |
Registered Member
|
6 active uploads, some queued uploads (not sure how many), 8 or so downloads. Anywhere from 5KB/s to 1000KB/s, doesn't seem to affect the usage much anymore. Upload: 30KB/s, Download: 1024KB/s. With KT running I can't do much with my machine. My machine seems to have issues with running at >50% usage non stop, it bogs down so slow that its barely usable. |
Moderator
|
|
Registered Member
|
Isn't there something better you can wait on like a sephemore, or "poll" ? All that I've learned from programing has taught me that using *sleep for anything is generally a bad idea.
After the change cpu usage is a lot better, but I bet it hurts throughput significantly. Which Is why I think those threads should be waiting on a resource that wakes them up when theres something to do. |
Moderator
|
If there are no limits that is exactly what we do. However when there are limits you have a problem. When you are downloading with a limit for example, you will not read all data available, because you are not allowed to read everything. So the next time you enter the poll, it will return immediatly, you will read a small amount of data (because the time elapsed since the last read time is small, you are not allowed to read much), and you will do poll again which will return immediatly once more ... This causes lots of CPU usage, but very little is actually done, so it is much better to sleep a bit, then read a decent amount of data and then sleep again, when there is a limit. And yes, this will cause problems a high download caps, with my tests it was impossible to get 4 MB/s when the download cap was 4 MB/s, however without a download cap, I could manage to get 6 MB/s (this obviously is on a LAN) The upload direction has pretty much the same problem. |
Registered Member
|
|
Moderator
|
We will have to tweak this sleep interval a bit depending on the download and upload caps. For 100 KB/s, 5 ms is probably enough.
You could solve this in the OS itself (at least for upload, not sure about download direction), by setting up a special traffic class for KT with the tc tool. But this is not easy to setup. |
Registered Member
|
I'm suffering from the same sorts of problems, but as a linux newbie I have no clue how to go about making these changes. I'm running kubuntu if that helps |
Registered Member
|
Its not so much linux knowledge you need, as programming knowledge. Its a very simple change in two of the source files from ktorrent's subversion repository, which, if you've not done before may look complex, but theres a little how to on ktorrents faq on grabbing the ktorrent svn. Though you may want to wait, I'm sure the kt devs will release a revision release soonish with some of the more recent fixes, which ubuntu should pickup asap. Actually, one temporary fix for the cpu usage is to not limit your uploads or downloads via ktorrent, maybe get your router to do it? or just not limit (but I'm sure your ISP would have that). |
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]