Page 1 of 1

CPU spike every 15min

Posted: Thu Jul 10, 2014 2:19 am
by Brokenstorm
Every 15min the CPU usage of qbittorent spikes to 60-70% for about 25sec.
Is there a fix for this? I run win7 x64 and have about 1000 active torrent.

Re: CPU spike every 15min

Posted: Thu Jul 10, 2014 5:43 am
by sledgehammer_999
Try this build and tell me if you see any difference. Also mention if the GUI is smoother now.
http://qbforums.shiki.hu/index.php/topi ... l#msg11387

Re: CPU spike every 15min

Posted: Thu Jul 10, 2014 8:47 am
by Brokenstorm
I was only able to try with around 500 active torrents.
There is still a spike every 15min but it only lasted 2-3 seconds.

Re: CPU spike every 15min

Posted: Thu Jul 10, 2014 11:48 am
by sledgehammer_999
This is really odd. The only thing that I found in the code to happen in 15min intervals in the saving of the statistics to file. Every 15min qBittorrent-data.ini is opened and the new statistics are written to disk, which are already gathered in memory(the stats). It should be really cheap cpu-wise.

The opening/writing happens if there was an actual change from the previous open/writing. Can you pause all your torrents and observe if the spikes continue to happen. Allow 3x15min to pass, because the first one might have data to write until you pause all torrents.

Re: CPU spike every 15min

Posted: Thu Jul 10, 2014 3:38 pm
by Brokenstorm
It still occurs even with all the torrents paused.
Right now I'm trying to use Procmon to see if I can find the source of the spikes.

Oh I and forgot to mention it, but qbittorrent was running in a VM is that matters at all and the content of the torrent are on a shared drive.

UPDATE:
It seems every 15min qbittorent queries every file in every torrent.
There is also a lot of access to the qBittorrent-resume.ini file and the BT_backup folder.

Re: CPU spike every 15min

Posted: Sat Jul 12, 2014 4:58 pm
by Brokenstorm
^^
Is this normal behavior and would it still occur if I gave the VM direct access to the drive?

Re: CPU spike every 15min

Posted: Mon Jul 14, 2014 1:31 pm
by sledgehammer_999
UPDATE:
It seems every 15min qbittorent queries every file in every torrent.
There is also a lot of access to the qBittorrent-resume.ini file and the BT_backup folder.
This seemed like useful info. I looked again at the code but I couldn't find something obvious. There isn't a timer that sets off every 15mins.
Are the spikes that dreadful in the alpha?
Is this normal behavior and would it still occur if I gave the VM direct access to the drive?
I have no idea. I haven't tested with so many torrents. And I don't know what the VM does differently apart from (maybe) slower file access. There's no good reason to access the torrent files, qBittorrent-resume.ini, BT_backup every 15min. Are you sure that it happens at 15mins and not every 3min? (I have some suspisions).

Re: CPU spike every 15min

Posted: Mon Jul 14, 2014 6:23 pm
by Brokenstorm
[quote="sledgehammer_999"]
Are the spikes that dreadful in the alpha?

Are you sure that it happens at 15mins and not every 3min? (I have some suspisions).
[/quote]

The spikes appear to be the same in the alpha. Both seem to be caused by a spike in kernel times when qBittorent queries 1000s of files every 15min.
Moving the files to a local drive didn't fix anything either.

I'll try to give the VM direct access to the drive and I'll also run qBittorent in the main OS to see if the spikes still occur.

Re: CPU spike every 15min

Posted: Mon Jul 14, 2014 6:50 pm
by sledgehammer_999
I might have to do sometime my own testing with a debugger. However I have limited time atm.