StamusNetworks / SELKS

A Suricata based IDS/IPS/NSM distro
https://www.stamus-networks.com/open-source/#selks
GNU General Public License v3.0
1.49k stars 285 forks source link

CPU Throttling with SELKS 2.0 #18

Open michelpy opened 9 years ago

michelpy commented 9 years ago

Hi there,

I installed SELKS 2.0 on 4 different hardware setups so far (2 Intel, 2 AMD). On all of them, the CPU speed was locked to the minimum CPU speed (possibly: power save) speed even if there was heavy CPU load.

What worked for me : apt-get install cpufreqd (no other tinkering) Now, it appears to be "on-demand"

I respecfully suggest that cpufreqd is installed by default on the next selks release.

Not much going on : selks-user@SELKS:~$ grep -E '^model name|^cpu MHz' /proc/cpuinfo model name : Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz cpu MHz : 1647.292 model name : Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz cpu MHz : 2037.750 model name : Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz cpu MHz : 2580.960 model name : Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz cpu MHz : 1865.015

Much going on : selks-user@SELKS:~$ grep -E '^model name|^cpu MHz' /proc/cpuinfo model name : Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz cpu MHz : 3300.000 model name : Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz cpu MHz : 3300.000 model name : Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz cpu MHz : 3300.000 model name : Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz cpu MHz : 3300.000

pevma commented 9 years ago

So in your case - when you added the cpufreqd - it made things be more adaptive to on demand tasks or it just put all CPUs to max speed available? (making use of an existing config profile already)

michelpy commented 9 years ago

Peter,

On my hardware, it made things to be adaptive to on demand taks, not put all CPUs to max speed availabe. It appears to be the default behavior even if cpufrequtils is NOT installed. Since last posrt, I installed cpufrequtils, and even with the "performance" governor, the CPUs scale down when there is no demand.

On my system, I have 2 governors : root@SELKS:/home/selks-user# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors performance powersave

As you can see below, even with the performance governor, all CPUs go down if not needed. To be honest I'm not sure that cpufrequtils does anything. The breakthrough was cpufreqd

root@SELKS:/home/selks-user# cpufreq-info cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009 Report errors and bugs to cpufreq@vger.kernel.org, please. analyzing CPU 0: driver: intel_pstate CPUs which run at the same hardware frequency: 0 CPUs which need to have their frequency coordinated by software: 0 maximum transition latency: 0.97 ms. hardware limits: 1.60 GHz - 3.30 GHz available cpufreq governors: performance, powersave current policy: frequency should be within 3.30 GHz and 3.30 GHz. The governor "performance" may decide which speed to use within this range. current CPU frequency is 1.67 GHz (asserted by call to hardware). analyzing CPU 1: driver: intel_pstate CPUs which run at the same hardware frequency: 1 CPUs which need to have their frequency coordinated by software: 1 maximum transition latency: 0.97 ms. hardware limits: 1.60 GHz - 3.30 GHz available cpufreq governors: performance, powersave current policy: frequency should be within 3.30 GHz and 3.30 GHz. The governor "performance" may decide which speed to use within this range. current CPU frequency is 1.60 GHz (asserted by call to hardware). analyzing CPU 2: driver: intel_pstate CPUs which run at the same hardware frequency: 2 CPUs which need to have their frequency coordinated by software: 2 maximum transition latency: 0.97 ms. hardware limits: 1.60 GHz - 3.30 GHz available cpufreq governors: performance, powersave current policy: frequency should be within 3.30 GHz and 3.30 GHz. The governor "performance" may decide which speed to use within this range. current CPU frequency is 1.60 GHz (asserted by call to hardware). analyzing CPU 3: driver: intel_pstate CPUs which run at the same hardware frequency: 3 CPUs which need to have their frequency coordinated by software: 3 maximum transition latency: 0.97 ms. hardware limits: 1.60 GHz - 3.30 GHz available cpufreq governors: performance, powersave current policy: frequency should be within 3.30 GHz and 3.30 GHz. The governor "performance" may decide which speed to use within this range. current CPU frequency is 1.77 GHz (asserted by call to hardware).

http://debian-jessie.blogspot.com/2014/10/how-to-set-power-governor-at-boot-time.html

pevma commented 9 years ago

Sounds good. Do you see any performance impact when running at full speed? I remember seeing somewhere on high perf boxes those should be switched off - but have not seen it myself anyway.

michelpy commented 9 years ago

I did see negative performance impact without cpufreqd (which is why I investigated the issue in the first place). I have incomplete data on the AMD platform, but on the Intel platform it was pretty clear that older hardware had a problem. In my world, I have some semi-obsolete hardware that is already in the rack, that does consume (too much) power but it's washed out withing the office power, and that makes a perfect and free candidate for a SELKS probe.

I installed SELKS 2.0 on a Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz with 2 cores (no hyperthreading); before installing cpufreqd, it had trouble keeping up with 25 Mbps of bandwidth (both cores at 1.8 GHz, some CPU maxout). After installing cpufreqd, CPU graph maxes out at about 70%. BTW, one of the things to keep at all costs is the CPU graph at the bottom right.

I can't see any difference in performance between different governors when using cpufrequtils.

Therefore, my view from the little end of the lorgnette is that cpufreqd is installed by default in the next SELKS distro.

michelpy commented 9 years ago

I loaded a cheezy PC last night to look at the SSH thing; and yesterday I loaded an older Intel server (pre-SpeedStep).

I understand that I don't have statistically meaningful data, but here it goes:

Analysis so far :

Sadly, so far I find the Intel hardware reacting better to my taste than the AMD hardware. A few extra watts for a few extra seconds is the name of my game. I don't doubt that with enough tweaking I could make either platform do whatever I want, but you have to put this in context : I'm a Debian rookie.