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

neucoind uses high amount of CPU power #30

Open
haraldg opened this issue Dec 23, 2015 · 11 comments
Open

neucoind uses high amount of CPU power #30

haraldg opened this issue Dec 23, 2015 · 11 comments

Comments

@haraldg
Copy link

haraldg commented Dec 23, 2015

I have neucoind running on a quite fast machine (64 bit, 3.4GHz) and it is only following the blockchain and staking on two UTXOs. It consumes about 30% of CPU time for this! I don't know what's taking so much processing power, but this is not cheap and not environmentally friendly.

@Magicking
Copy link
Member

Could you provide more metrics to investigate that bug (memory usage, cpu usage, OS, etc) ?

Also just as a note, neucoind run on RPi2 with more than what you describe and even if it's a bit laggy, it doesn't consume that much.

@haraldg
Copy link
Author

haraldg commented Dec 23, 2015

Sylvain Laurent writes:

Could you provide more metrics to investigate that bug (memory usage, cpu usage, OS, etc) ?

The neucoind process is now running for about 1 month (real time).

$ uname -a
Linux hdev 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) x86_64 GNU/Linux

$ free
total used free shared buff/cache available
Mem: 32927936 1637500 1246644 3037664 30043792 27928376
Swap: 0 0 0

$ neucoind getinfo
{
"version" : "v1.1.0-2-g5fbfe5b-dirty",
"protocolversion" : 60004,
"walletversion" : 60000,

top says:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
11771 harald 30 10 835584 171948 45324 S 33.0 0.5 4994:29 neucoind

$ ps -A | grep neucoind; sleep 60; ps -A | grep neucoind
11771 pts/3 3-11:14:45 neucoind
11771 pts/3 3-11:15:04 neucoind

so it is taking 19 seconds CPU time during 60 seconds of real time.

Also just as a note, neucoind run on RPi2 with more than what you describe and even if it's a bit laggy, it doesn't consume that much.

Yes, when I started neucoind a month ago, after it had downloaded the
blockchain, it used only about 1% CPU time. So looks like some data
structure is becoming inefficient after a while or something.

Obvious thing to try would be stopping and starting neucoind again, but
I was thinking that maybe we should try to get some data out of the
process before...

If you want to support my work:
see http://friends.ccbib.org/harald/supporting/
or donate via bitcoin to 1FUtd8T9jRN1rFz63vZz7s2fDtB6d6A7aS

@haraldg
Copy link
Author

haraldg commented Jan 4, 2016

Since I didn't get a reply with further instructions and the CPU consumption rose even further, I stopped and started neucoind again. Now it is at 1 second CPU time per 60 seconds of real time. I guess this is ok.

I will keep an eye on CPU usage. Probably it will start going up again in a few days.

As there are already reports about missbehaving foundation wallets on the forum for a while, I think you should look into this closely. I wouldn't be surprised if these issues are related.

@Magicking
Copy link
Member

Sorry I guess I missed your previous answer, a high cpu usage at start is due to the load and check of data on disk.

What forum are you talking ?

@haraldg
Copy link
Author

haraldg commented Jan 4, 2016

Sylvain Laurent writes:

Sorry I guess I missed your previous answer, a high cpu usage at start is due to the load and check of data on disk.

Yes, but this problem report is about the load being high after neucoind
was running for more than a month ...

What forum are you talking ?

forum.neucoin.org

HTE,
Harald

@Magicking
Copy link
Member

This was not due to that, the most relevant information would be the debug.log if you run with the -debug option to investigate a posteriori.

I'm closing this issue but you can still reply to it.

@haraldg
Copy link
Author

haraldg commented Jan 4, 2016

Why are you closing this issue when the problem I reported hasn't been dealt with in any way?

Is there anything particular about the debug.log, that I should provide.

I have the feeling we are misunderstandig each other. Please reread the full issue.

Thanks.

@Magicking
Copy link
Member

I don't see anything else beside staking that could take a lot of CPU power, were you downloading the blockchain from the beginning when the problem happened ? If so your node might try to generate a lot of valid PoS block but reject them right after downloading more of the blockchain. The debug.log would show that behavior.

Could you try the "setstaking" RPC to turn on or off the staking thread to check if it lower your cpu usage (only on the git version for now).

@Magicking Magicking reopened this Jan 5, 2016
@haraldg
Copy link
Author

haraldg commented Jan 7, 2016

So after I restarted neucoind 3 days ago, it behaved well for two days, but now its consuming CPU again:

harald@hdev:~$ ps -A | grep neucoind; sleep 60; ps -A | grep neucoind
22576 pts/3    09:11:39 neucoind
22576 pts/3    09:12:09 neucoind

So my fist guess about a data structure becoming inefficient after a while
probably was wrong. I'm not monitoring the load close enough to be sure,
but my current impression is that this starts at some point (in this case
about a day ago).

The debug.log got truncated at restarting, and now is at about 8MB.
I don't see anything obviously wrong:

2016-01-07 15:37:39 UTC askfor tx 861104301754f133d7c7   1452181059000000
2016-01-07 15:37:39 UTC addUnchecked(): size 43
2016-01-07 15:37:39 UTC CTxMemPool::accept() : accepted 8611043017
2016-01-07 15:37:56 UTC askfor block 000000000065ff097acd   0
2016-01-07 15:37:56 UTC sending getdata: block 000000000065ff097acd
2016-01-07 15:37:56 UTC received block 000000000065ff097acd
2016-01-07 15:37:57 UTC SetBestChain: new best=000000000065ff097acd  height=166876  trust=14083779764876951  moneysupply=3577575186.073726
2016-01-07 15:37:57 UTC ProcessBlock: ACCEPTED
2016-01-07 15:37:57 UTC getblocks -1 to 00000000000000000000 limit 500
2016-01-07 15:37:58 UTC getblocks 166875 to 000000000065ff097acd limit 500
2016-01-07 15:37:58 UTC   getblocks stopping at 166876 000000000065ff097acd (6323 bytes)
2016-01-07 15:37:58 UTC getblocks -1 to 00000000000000000000 limit 500
2016-01-07 15:37:59 UTC 2016-01-07 15:37:59 UTC Flushing wallet.dat
2016-01-07 15:37:59 UTC Flushed wallet.dat 56ms
2016-01-07 15:37:59 UTC getblocks -1 to 00000000000000000000 limit 500
2016-01-07 15:38:14 UTC askfor block 08372ed0c03947ecd3fd   0
2016-01-07 15:38:14 UTC sending getdata: block 08372ed0c03947ecd3fd
2016-01-07 15:38:14 UTC askfor block 08372ed0c03947ecd3fd   1452181094000000
2016-01-07 15:38:14 UTC askfor block 08372ed0c03947ecd3fd   1452181214000000
2016-01-07 15:38:14 UTC askfor block 08372ed0c03947ecd3fd   1452181334000000

Should I send you the debug.log somewhere? Is there something particular
I should check?

I can try to compile the git version if you think it helps debugging this.
I have never profiled a C++ programm before. Is there anything I should do
at compile time?

I'll leave that busy process running for now, in case you have any idea
what we could test.

BTW what's the bounty for debugging such issues and where to claim it?
Looks like the code foundation isn't up and running yet?

@Magicking
Copy link
Member

I haven't had the time to profil it yet, my guess lie to the use on an un-optimised version of scrypt (instead of a version with SSE2 for example).

As the issue is not related to profiling I would redirect you to Google but using DEBUG=1 when using make add debug symbol to the binary, I would also suggest the use of either gprof (don't forget to add -pg if you use it) or oprofile.

We review each trimester to see if it fit our criteria for bounty and contact those eligible afterward.

The code foundation is up and running :).

@shday
Copy link

shday commented Jan 7, 2016

I am seeing the same high CPU usage with neucoin-qt on Ubuntu, installed from a binary (neucoin-qt_1.1.1_debian_amd64.deb). I noticed my computer was a little loud and found that the neucoin-qt process was using ~35%CPU. I just now restarted neucoin-qt and it is down around 1% (again).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants