mastercoin-MSC / mastercore

mastercore info
mastercoin.org
MIT License
24 stars 11 forks source link

Mastercored takes too much CPU with '-reindex' #215

Open kostaz opened 9 years ago

kostaz commented 9 years ago

Issue

Mastercored takes ~90% of CPU on relatively good machine. The daemon is run with the below command: ./mastercored -daemon -datadir=/home/mastercore/.bitcoin -reindex

Setup

root@ubuntu:~# ~/msc_0.0.8.2/mastercore/src/mastercored getinfo
{
    "mastercoreversion" : 12008,
    "version" : 90200,
    "protocolversion" : 70002,
    "walletversion" : 60000,
    "balance" : 0.00000000,
    "blocks" : 315690,
    "timeoffset" : 0,
    "connections" : 29,
    "proxy" : "",
    "difficulty" : 19729645940.57713318,
    "testnet" : false,
    "keypoololdest" : 1417119409,
    "keypoolsize" : 101,
    "paytxfee" : 0.00010000,
    "relayfee" : 0.00001001,
    "errors" : ""
}

debug.log

root@ubuntu:/home# tail -f /home/mastercore/.bitcoin/debug.log 2014-11-28 08:38:19 ProcessBlock: ACCEPTED 2014-11-28 08:38:20 UpdateTip: new best=00000000000000001c0b13eaea555130e3a40480e5d95a01370846724cb3ba64 height=315837 log2_work=80.209332 tx=44659269 date=2014-08-16 01:21:49 progress=0.763642 2014-11-28 08:38:20 ProcessBlock: ACCEPTED 2014-11-28 08:38:24 Pre-allocating up to position 0x600000 in rev00166.dat 2014-11-28 08:38:24 UpdateTip: new best=000000000000000023a5395210992b88d1e963e8952efa44697ac0f90dd33f9b height=315838 log2_work=80.209419 tx=44660622 date=2014-08-16 01:39:52 progress=0.763676 2014-11-28 08:38:24 ProcessBlock: ACCEPTED 2014-11-28 08:38:27 UpdateTip: new best=0000000000000000369645517df70ff760ef8ed62f66443f05f4b5a84de1d9a1 height=315839 log2_work=80.209507 tx=44661548 date=2014-08-16 02:02:18 progress=0.763711 2014-11-28 08:38:27 ProcessBlock: ACCEPTED 2014-11-28 08:38:29 UpdateTip: new best=00000000000000001a54d83660d4108e071ea2a8da3d119682dcce516c916f40 height=315840 log2_work=80.209594 tx=44661706 date=2014-08-16 02:03:32 progress=0.763714 2014-11-28 08:38:29 ProcessBlock: ACCEPTED 2014-11-28 08:38:32 UpdateTip: new best=0000000000000000295617ce4b131838a6ea63769ebf4bd8ff0a27590bb0a909 height=315841 log2_work=80.209682 tx=44661856 date=2014-08-16 02:04:53 progress=0.763717 2014-11-28 08:38:33 ProcessBlock: ACCEPTED 2014-11-28 08:38:35 UpdateTip: new best=000000000000000010d4597fdea1ca179c482cb7330b6bdedc4948b4b6f2744d height=315842 log2_work=80.209769 tx=44662291 date=2014-08-16 02:16:29 progress=0.763735 2014-11-28 08:38:36 ProcessBlock: ACCEPTED 2014-11-28 08:38:36 receive version message: /Satoshi:0.8.6/: version 70001, blocks=331957, us=5.100.250.140:8333, them=0.0.0.0:0, peer=148.251.238.178:30691 2014-11-28 08:38:39 UpdateTip: new best=000000000000000031c41536c62d7bd6c3709678c404398056f35d20b7fa6137 height=315843 log2_work=80.209856 tx=44662979 date=2014-08-16 02:34:26 progress=0.763762 2014-11-28 08:38:39 ProcessBlock: ACCEPTED 2014-11-28 08:38:41 UpdateTip: new best=00000000000000001fd59f5087b66e1cccf63861134fcc765016bd34dd50ef4a height=315844 log2_work=80.209944 tx=44663460 date=2014-08-16 02:49:41 progress=0.763785

Question

Is this the sane and expected behavior?

Thanks, --- Kosta

kostaz commented 9 years ago

This issue seems related to the issue #216.

dexX7 commented 9 years ago

During the processing high CPU load is to expect. If you'd like to throttle this, you may start Bitcoin Core/Master Core with the CLI parameter -par=<n>:

-par= Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)

If you intend to run a server and face too much queries, there is also -rpcthreads=<n>:

-rpcthreads= Set the number of threads to service RPC calls (default: 4)

dexX7 commented 9 years ago

As a side note: it should be possible to fully synchronize and index a Bitcoin Core client with v0.9.~ and then swap the files so that mastercored (and likewise mastercore-qt) are used, so if you already have a synchronized client, you may just copy the files and swap the executables.

It's also possible to bootstrap Bitcoin Core/Master Core with the block chain torrent, which is usually very well seeded (30+ MB/s).

In general: Bitcoin Core 0.10 should be much faster due to the headers first synchronization. Master Core will be rebased accordingly, once it's an official release.