Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: kjj on June 15, 2012, 12:39:10 PM



Title: excessive CPU usage in 0.6.2 ?
Post by: kjj on June 15, 2012, 12:39:10 PM
Ever since I upgraded to 0.6.2, all of my CPUs have been pinned at 100% usage.  Anyone else having similar problems?

Here is a 11 year old Athlon XP 1800+ running 0.6.0:

Quote
root@inana:~# ps waxuf | grep bitcoin
bitcoind 27316  0.5 20.5 200604 102428 ?       SLsl 05:16   0:35 /usr/local/bin/bitcoind -conf=/etc/bitcoin/bitcoin.conf -pid=/etc/bitcoin/pid -daemon -datadir=/etc/bitcoin/ -noirc

And a modern Celeron G440 running 0.6.2:

Quote
root@linuxcoin:/opt/logs# ps waxuf | grep bitcoind
root     27863  0.0  0.0   7740   836 pts/6    S+   11:59   0:00                          \_ grep bitcoind
root      3566 60.0  1.3 222240 106664 ?       SLsl 01:44 369:33 /usr/bin/bitcoind -conf=/etc/bitcoin.conf -pid=/var/run/bitcoind.pid -daemon -datadir=/opt/bitram/
root      3567  0.0  0.0   3924   324 ?        Ss   01:44   0:00 startpar -f -- bitcoind

Before the upgrade, the Celerons were quite snappy and responsive.  Now, it can take several minutes (really!) to run a simple bitcoind getinfo.  And it isn't an I/O problem, the Celerons are totally diskless, running entirely out of RAM, like they have been for the last few months.


Title: Re: excessive CPU usage in 0.6.2 ?
Post by: rav3n_pl on June 15, 2012, 07:48:45 PM
I feel same thing on my 3 core Athlon. Windows 7/64bit. Bitcoin-qt and bicoind is eating one full core for 3-5 seconds every 10-15 seconds. At same time disk usage is spiking to max transfer.
On image upper row is CPU, it is spiking to 33% (one core). Lower one is disk usage, spikes are over 40MB/s (my max data rate).
http://s12.postimage.org/zfutkf4x7/bicoin.png


Title: Re: excessive CPU usage in 0.6.2 ?
Post by: Diapolo on June 15, 2012, 09:27:08 PM
At least for Bitcoin-Qt some internals were re-worked to lower CPU usage with 0.7, mainly while downloading the block-chain. I have no idea for bitcoind though.

Dia


Title: Re: excessive CPU usage in 0.6.2 ?
Post by: deepceleron on June 15, 2012, 09:27:46 PM
Bitcoind 0.6.2 Win7 x32 with affinity set to cpu3:
The first 1/3 of the cpu graphs is catching up with blocks, the rest is sitting idle.

http://we.lovebitco.in/img/bitcoind-cpuusage.png

Core2 Quad @ 2.4GHz = no such issues

PS C:\Program Files\Bitcoin\daemon> get-process bitcoind | format-list *


__NounName                 : Process
Name                       : bitcoind
Handles                    : 259
VM                         : 219971584
WS                         : 130015232
PM                         : 90394624
NPM                        : 19132
Path                       : C:\Program Files\Bitcoin\daemon\bitcoind.exe
Company                    :
CPU                        : 585.6901544
FileVersion                :
ProductVersion             :
Description                :
Product                    :
Id                         : 1284
PriorityClass              : Normal
HandleCount                : 259
WorkingSet                 : 130015232
PagedMemorySize            : 90394624
PrivateMemorySize          : 90394624
VirtualMemorySize          : 219971584
TotalProcessorTime         : 00:09:45.6901544
BasePriority               : 8
ExitCode                   :
HasExited                  : False
ExitTime                   :
Handle                     : 2336
MachineName                : .
MainWindowHandle           : 984688
MainWindowTitle            : C:\Program Files\Bitcoin\daemon\bitcoind.exe
MainModule                 : System.Diagnostics.ProcessModule (bitcoind.exe)
MaxWorkingSet              : 1413120
MinWorkingSet              : 204800
Modules                    : {System.Diagnostics.ProcessModule (bitcoind.exe), System.Diagnostics.ProcessModule (ntdll.
                             dll), System.Diagnostics.ProcessModule (kernel32.dll), System.Diagnostics.ProcessModule (K
                             ERNELBASE.dll)...}
NonpagedSystemMemorySize   : 19132
NonpagedSystemMemorySize64 : 19132
PagedMemorySize64          : 90394624
PagedSystemMemorySize      : 199436
PagedSystemMemorySize64    : 199436
PeakPagedMemorySize        : 123723776
PeakPagedMemorySize64      : 123723776
PeakWorkingSet             : 156135424
PeakWorkingSet64           : 156135424
PeakVirtualMemorySize      : 275435520
PeakVirtualMemorySize64    : 275435520
PriorityBoostEnabled       : True
PrivateMemorySize64        : 90394624
PrivilegedProcessorTime    : 00:00:41.9954692
ProcessName                : bitcoind
ProcessorAffinity          : 4
Responding                 : True
SessionId                  : 1
StartInfo                  : System.Diagnostics.ProcessStartInfo
StartTime                  : 6/15/2012 1:56:05 PM
SynchronizingObject        :
Threads                    : {792, 5708, 3432, 2840...}
UserProcessorTime          : 00:09:03.6946852
VirtualMemorySize64        : 219971584
EnableRaisingEvents        : False
StandardInput              :
StandardOutput             :
StandardError              :
WorkingSet64               : 130015232
Site                       :
Container                  :


Keep in mind these days there is a bit of work to do when you get a new block, looking up and reindexing balances when it has 1000 dicespam transactions in it.


Title: Re: excessive CPU usage in 0.6.2 ?
Post by: rav3n_pl on June 15, 2012, 09:56:24 PM
Keep in mind these days there is a bit of work to do when you get a new block, looking up and reindexing balances when it has 1000 dicespam transactions in it.
But we NOT have block each 10-15 sec, right? And usage is spiking about every 10-15 sec, not 10mins like blocks...


Title: Re: excessive CPU usage in 0.6.2 ?
Post by: Gavin Andresen on June 16, 2012, 12:53:00 AM
The 0.7 release will include an optimization that should help a lot (transaction signature cache -- prior releases checked signatures when the transaction was first seen, and then checked again when a new block was received, it makes processing new blocks much faster).


Title: Re: excessive CPU usage in 0.6.2 ?
Post by: mrb on June 20, 2012, 07:04:54 AM
kjj, run this to sample what bitcoind is doing:

Quote
$ gdb -ex "set pagination 0" -ex "thread apply all bt" --batch -p $(pidof bitcoind)

Quite useful as a quick way to profile a running process...


Title: Re: excessive CPU usage in 0.6.2 ?
Post by: gmaxwell on June 20, 2012, 01:20:41 PM
But we NOT have block each 10-15 sec, right? And usage is spiking about every 10-15 sec, not 10mins like blocks...

You receive transactions at that rate.