2008/5/15 木曜日

えころじぃ。

Linuxだからこそ低消費電力、グリーンIT、エコ、嫁の機嫌とり(電気代抑え)をします。

まず、HDDを一定期間アクセスがなければスタンバイモードに移行するようにします。hdparmのSオプションでその期間を決めることができます(240までは5倍秒の単位で0だと無効)。

システム以外のHDDは10分アクセスとスタンバイにするようにしました。

# hdparm -S 120 /dev/sdb
# hdparm -S 120 /dev/sdc
# hdparm -S 120 /dev/sdd
# hdparm -S 120 /dev/sde

~10分後。

# hdparm -C /dev/sdb

/dev/sdb:
 drive state is:  standby

最近のCPUは、IntelであればSpeedStep、AMDであればPowerNOW!とクロック可変です。これはCentOSであればcpuspeedを動かせば大丈夫です。

# /etc/init.d/cpuspeed start
/etc/init.d/cpuspeed: line 60: /sys/devices/system/cpu/cpuidle/cpufreq/scaling_governor: No such file or directory
Enabling ondemand cpu frequency scaling:                   [  OK  ]

えーっと。Kernelのコンパイルをした際に設定わすれたかも。普通、動きます。

こんな時は頑張ってもよいのですがcpufreqでカバーしてみせます。まずはインストールします。

# yum install -y cpufreq-utils

CPUの状態を見るにはcpufeg-infoです。デュアルコアなので2CPUと判断されます。

# cpufreq-info
cpufrequtils 002: cpufreq-info (C) Dominik Brodowski 2004-2006
Report errors and bugs to linux@brodo.de, please.
analyzing CPU 0:
  driver: powernow-k8
  CPUs which need to switch frequency at the same time: 0 1
  hardware limits: 1000 MHz - 2.30 GHz
  available frequency steps: 2.30 GHz, 2.20 GHz, 2.00 GHz, 1.80 GHz, 1000 MHz
  available cpufreq governors: userspace, performance
  current policy: frequency should be within 1000 MHz and 2.30 GHz.
                  The governor “userspace” may decide which speed to use
                  within this range.
  current CPU frequency is 2.30 GHz (asserted by call to hardware).
analyzing CPU 1:
  driver: powernow-k8
  CPUs which need to switch frequency at the same time: 0 1
  hardware limits: 1000 MHz - 2.30 GHz
  available frequency steps: 2.30 GHz, 2.20 GHz, 2.00 GHz, 1.80 GHz, 1000 MHz
  available cpufreq governors: userspace, performance
  current policy: frequency should be within 1000 MHz and 2.30 GHz.
                  The governor “userspace” may decide which speed to use
                  within this range.
  current CPU frequency is 2.30 GHz (asserted by call to hardware).

簡単に解説すると

ドライバーとしてPowerNOW-K8が使われています。
クロックは1000MHz~2.3GHzで可変します。
可変の単位は2.30 GHz, 2.20 GHz, 2.00 GHz, 1.80 GHz, 1000 MHzです。
可変の設定はperformance(最高設定)にされています。
今は2.3GHzで駆動しています。

常に最高で動く必要性がないので、段階的に可変する「conservative」と設定します。CPUの状態設定を行うのはcpufreg-setコマンドで行います。-gはgovernorの設定です。

# cpufreq-set -g conservative

実際にどれくらいの効果があるのかと疑問視されがちですが。

24時間稼働すれば、月々の電気代が1000円になるぐらい。

コメント (0) »

この記事にはまだコメントがついていません。

コメント RSS トラックバック URL

コメントをどうぞ

HTML convert time: 0.207 sec. Powered by WordPress ME