ビットコイン・インスティテュート

Re: Bitcoinの​自動renice

人物: asdfman
asdfman 2010年7月12日08:05 UTC

こんにちは。

同じ挙動には自分も悩まされていた。bitcoindが優先度を取ってしまってシステムの応答性が落ちていたので、全スレッドを19にreniceしていたのだが、時々プログラムが自動的に優先度をシステムの応答性を損なう値に戻してしまっていた…… そこで自分がやったのは、util.hを編集して、優先度を操作する関数をこう書き換えただけだ:

inline void SetThreadPriority(int nPriority) { printf(“No, were not changing any damn priority\n”); }

そしてbitcoindを再コンパイルした。

今は最初に全スレッドを一度reniceするだけで、プログラム終了までその値で固定されたままになる(NI列は19のまま):

   1  [||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||100.0%]     Time: 03:59:40
  2  [||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||100.0%]     Uptime: 253 days(!), 01:12:27
  Mem[||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||501/1255MB]     Load: 4.01
  Swp[||||||||||||||||||||||||||||||||||||||||||||||||||||||                                            501/1004MB]     Load average: 4.01 4.15 3.49
         __   __         __   __        __  __   __         __   __         __   __         __   __                             __  __              __
        |  | |__         __| |__       |__||__  |__|       |  | |  |       |  | |  |       |  | |  |                            __| __|   |           |
  Avg:  |__|.|__|% sy:  |__ . __|% ni:  __||__|.|__|% hi:  |__|.|__|% si:  |__|.|__|% wa:  |__|.|__|%                   Tasks:  __| __|   | total,    | running

  PID USER     PRI  NI  VIRT   RES   SHR S CPU% MEM%   TIME+  Command

 4523 root      39  19  126M 46280  3424 S  0.0  3.6  0:00.66  `- bitcoind -gen -daemon
 4534 root      39  19  126M 46280  3424 R 90.0  3.6 12:43.73  |   `- bitcoind -gen -daemon
 4533 root      39  19  126M 46280  3424 R 45.0  3.6 10:49.02  |   `- bitcoind -gen -daemon
 4532 root      39  19  126M 46280  3424 R 46.0  3.6 10:05.83  |   `- bitcoind -gen -daemon
 4531 root      39  19  126M 46280  3424 S  0.0  3.6  0:00.03  |   `- bitcoind -gen -daemon
 4530 root      39  19  126M 46280  3424 S  1.0  3.6  0:15.53  |   `- bitcoind -gen -daemon
 4529 root      39  19  126M 46280  3424 S  0.0  3.6  0:00.72  |   `- bitcoind -gen -daemon
 4527 root      39  19  126M 46280  3424 S  0.0  3.6  0:00.02  |   `- bitcoind -gen -daemon
 4526 root      39  19  126M 46280  3424 S  0.0  3.6  0:00.03  |   `- bitcoind -gen -daemon
 4525 root      39  19  126M 46280  3424 S  0.0  3.6  0:00.06  |   `- bitcoind -gen -daemon

debug.logにはこう出る:

[root@raidserv] (~/.bitcoin)# grep “No,” debug.log No, were not changing any damn priority No, were not changing any damn priority No, were not changing any damn priority No, were not changing any damn priority …

これでbitcoindを一日中動かしっぱなしにしても、ほとんど気にならなくなった……