Bitcoin Forum
December 11, 2016, 10:12:11 AM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Limiting CPU usage while contributing to Bitcoin  (Read 3116 times)
jpsoto
Newbie
*
Offline Offline

Activity: 10


View Profile
April 06, 2011, 01:10:06 PM
 #1

Audience: you could be interested on limiting CPU usage of bitcoind while mining (gen=1 in your bitcoin.conf) if:

  • You are motivated to contribute (modest, but actually) to the global effort to verify Bitcoin transactions.
  • Definitively, you are *not* suffering from BC-gold Fever.
  • You do *not* want to hear roaring fans every time Bitcoin is instructed to generate hashes.
  • You are an happy user of an Unix box

Assuming your bitcoin.conf file includes "gen=1", and you want to allow a 10% of CPU usage. A quite simple solution, from command line:
Code:
bitcoind
cpulimit -z -l 10 -p `pidof bitcoind` &

A more elaborated solution, i.e. this piece of code from a Bash script:
Code:
OPID=($(pidof bitcoind))
su bitcoin -c "$BITCOIND_DIR/bitcoind -datadir=$TEST_DATA $*"
BPID=$(pidof ${OPID[@]/#/-o } bitcoind)
if [[ -n $BPID ]]; then (cpulimit -z -l 10 -p $BPID &); fi

[Likely, you will need to get the cpulimit package: apt-get install cpulimit]

Please, test and feedback, JP
1481451131
Hero Member
*
Offline Offline

Posts: 1481451131

View Profile Personal Message (Offline)

Ignore
1481451131
Reply with quote  #2

1481451131
Report to moderator
1481451131
Hero Member
*
Offline Offline

Posts: 1481451131

View Profile Personal Message (Offline)

Ignore
1481451131
Reply with quote  #2

1481451131
Report to moderator
1481451131
Hero Member
*
Offline Offline

Posts: 1481451131

View Profile Personal Message (Offline)

Ignore
1481451131
Reply with quote  #2

1481451131
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1481451131
Hero Member
*
Offline Offline

Posts: 1481451131

View Profile Personal Message (Offline)

Ignore
1481451131
Reply with quote  #2

1481451131
Report to moderator
1481451131
Hero Member
*
Offline Offline

Posts: 1481451131

View Profile Personal Message (Offline)

Ignore
1481451131
Reply with quote  #2

1481451131
Report to moderator
jpsoto
Newbie
*
Offline Offline

Activity: 10


View Profile
April 08, 2011, 07:57:24 PM
 #2

cpulimit uses signals SIGSTOP/SICONT to achieve the cpu usage percent.

I have become aware of (likely) RPC interface of bitcoind, after trapped by SIGSTOP, discards commands. So, 'bitcoind getinfo' or 'bitcoind stop' fail too many times.

Manually releasing bitcoind proves this behavior
Code:
kill -s STOP cpulimit
sleep 0.1
kill -s CONT bitcoind
sleep 0.1
bitcoind getinfo
kill -s CONT cpulimit
jago25_98
Hero Member
*****
Offline Offline

Activity: 871


http://moneybutnofixedabode.blogspot.com


View Profile WWW
April 26, 2011, 09:12:47 AM
 #3

i run with gen turned off but still the laptop server fan spins up only when running bc, keeping me awake.

How do i safely shutdown the commandline client?
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!