11

I'm on an i7 core but monerod consumes up to 300% CPU at times. When I am catching up on the blockchain, it renders my computer nearly unusable. Is this normal?

When the chain is synced, CPU use is OK.

  • It is normal, syncing is very CPU intensive. – ant Bldel Sep 29 '16 at 9:38
13

Basically what jwinterm said.

I think your best bet, assuming you want to do something else with your computer while catching up rather than catch up ASAP, would be to add --prep-blocks-threads 1 (or 2; it defaults to 4) to your command line. This will make it use only one (or two) core(s) to compute POW while in "catch up" mode.

8

I think it tries to sync as fast as possible and the verification is CPU intensive. I believe there are options to limit the bandwidth usage in the daemon, or you could just limit the resource usage of the daemon from Windows or Linux.

  • 1
    Thanks for your answer but I chose Luigi's because he included how exactly I could limit CPU usage. – pl55 Oct 1 '16 at 5:39
2

Monerod tries to sync as fast as possible, but the load on a server is so high that monerod slows down the whole server, databases, other websites... I guess that's what most private users want, but not if you are a sysadmin responsible for others too.

The --prep-blocks-threads 1 parameter is not the solution as even with less and smaller blocks monerod maxes out virtual memory, boosting CPU usage up over 140% on big dedicated servers. I have had constant loads of 15 on a 16GB RAM 4-core server for over an hour. Only during the time of synchronization of course, which on a good server in a data center only takes like two to three hours, at the max.

In other discussions users point to cpulimit, nice, renice and ionice commands. At first sight true, but these commands can only handle single programs (with one thread). Monerod on the other side kicks off with up to 12 or 15 threads and cpulimit can't handle that... or only for a short time.

The solution to get monerod sync and run with a restricted, reasonable amount of ressources are the cgroup-tools and cgroup commands. That sounded intimidating when I heard it the first time, but it is actually just 4 lines of code.

As root on your server in the command line install cgroups

apt-get install cgroup-tools

Then create your cgroup

cgcreate -t monero:monero -a monero:monero -g memory,cpu:monerogroup

with monero being the normal username who will eventually run monerod (don't do it as root...). monerogroup is my groupname for this restricted group. You want to set up memory and CPU limitations.

Assign the ressources

cgset -r memory.limit_in_bytes=$((4*1024*1024*1024)) monerogroup

cgset -r cpu.shares=128 monerogroup

The first line allows up to 4GB for monerod, the second an eighth of CPU power. The maximum being 1024.

Switch user to normal user (in this case user monero) and run monerod

cgexec -g memory,cpu:monerogroup ./monerod --detach

Feel free to fine tune it and restrict it even more. Add a restriction for the virtual memory as that's the one that gets incredibly blown up.

This is a fantastic way to tame monerod and run it safely and in the long run on your server as I do. Support Monero by running more nodes.

Cheers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.