PDA

View Full Version : Fix for laggy servers [will also increase your penis size by a factor 100000]



IzNoGoD
20th June 2015, 12:24
This might apply to all hetzner dedicated servers running ubuntu 14.04 (probably) and maybe more (just post your results)

My server has been lagging like crazy for a few months now, ever since the reinstall of ubuntu. Turns out, it was running in powersaving mode.

How to check:


sudo cpufreq-info


Output should look like:



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.90 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 1.60 GHz and 3.90 GHz.
The governor "powersave" may decide which speed to use
within this range.
current CPU frequency is 1.63 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.90 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 1.60 GHz and 3.90 GHz.
The governor "powersave" may decide which speed to use
within this range.
current CPU frequency is 1.68 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.90 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 1.60 GHz and 3.90 GHz.
The governor "powersave" may decide which speed to use
within this range.
current CPU frequency is 1.68 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.90 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 1.60 GHz and 3.90 GHz.
The governor "powersave" may decide which speed to use
within this range.
current CPU frequency is 1.63 GHz (asserted by call to hardware).
analyzing CPU 4:
driver: intel_pstate
CPUs which run at the same hardware frequency: 4
CPUs which need to have their frequency coordinated by software: 4
maximum transition latency: 0.97 ms.
hardware limits: 1.60 GHz - 3.90 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 1.60 GHz and 3.90 GHz.
The governor "powersave" may decide which speed to use
within this range.
current CPU frequency is 1.68 GHz (asserted by call to hardware).
analyzing CPU 5:
driver: intel_pstate
CPUs which run at the same hardware frequency: 5
CPUs which need to have their frequency coordinated by software: 5
maximum transition latency: 0.97 ms.
hardware limits: 1.60 GHz - 3.90 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 1.60 GHz and 3.90 GHz.
The governor "powersave" may decide which speed to use
within this range.
current CPU frequency is 1.68 GHz (asserted by call to hardware).
analyzing CPU 6:
driver: intel_pstate
CPUs which run at the same hardware frequency: 6
CPUs which need to have their frequency coordinated by software: 6
maximum transition latency: 0.97 ms.
hardware limits: 1.60 GHz - 3.90 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 1.60 GHz and 3.90 GHz.
The governor "powersave" may decide which speed to use
within this range.
current CPU frequency is 1.63 GHz (asserted by call to hardware).
analyzing CPU 7:
driver: intel_pstate
CPUs which run at the same hardware frequency: 7
CPUs which need to have their frequency coordinated by software: 7
maximum transition latency: 0.97 ms.
hardware limits: 1.60 GHz - 3.90 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 1.60 GHz and 3.90 GHz.
The governor "powersave" may decide which speed to use
within this range.
current CPU frequency is 1.63 GHz (asserted by call to hardware).


As you can see, all the cores are being throttled and run with the powersave governor.

How to fix this:


sudo cpufreq-set -c 0 -g performance
sudo cpufreq-set -c 1 -g performance
sudo cpufreq-set -c 2 -g performance
sudo cpufreq-set -c 3 -g performance
sudo cpufreq-set -c 4 -g performance
sudo cpufreq-set -c 5 -g performance
sudo cpufreq-set -c 6 -g performance


This will change the governor from powersave to performance, making the cpu throttle as little as possible. You could go on and change the minimum frequency, but this fix above is the main part. (make sure to run said command for all cores, in my case 0-7)

Load has dropped from 80% of a single core for a bot serv to 25% of that same server, under the same conditions.

Edit: this is after the fix:



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.90 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 1.60 GHz and 3.90 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 3.70 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.90 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 1.60 GHz and 3.90 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 3.54 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.90 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 1.60 GHz and 3.90 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 3.43 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.90 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 1.60 GHz and 3.90 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 3.81 GHz (asserted by call to hardware).
analyzing CPU 4:
driver: intel_pstate
CPUs which run at the same hardware frequency: 4
CPUs which need to have their frequency coordinated by software: 4
maximum transition latency: 0.97 ms.
hardware limits: 1.60 GHz - 3.90 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 1.60 GHz and 3.90 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 3.17 GHz (asserted by call to hardware).
analyzing CPU 5:
driver: intel_pstate
CPUs which run at the same hardware frequency: 5
CPUs which need to have their frequency coordinated by software: 5
maximum transition latency: 0.97 ms.
hardware limits: 1.60 GHz - 3.90 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 1.60 GHz and 3.90 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 3.12 GHz (asserted by call to hardware).
analyzing CPU 6:
driver: intel_pstate
CPUs which run at the same hardware frequency: 6
CPUs which need to have their frequency coordinated by software: 6
maximum transition latency: 0.97 ms.
hardware limits: 1.60 GHz - 3.90 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 1.60 GHz and 3.90 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 3.22 GHz (asserted by call to hardware).
analyzing CPU 7:
driver: intel_pstate
CPUs which run at the same hardware frequency: 7
CPUs which need to have their frequency coordinated by software: 7
maximum transition latency: 0.97 ms.
hardware limits: 1.60 GHz - 3.90 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 1.60 GHz and 3.90 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 3.81 GHz (asserted by call to hardware).

kung foo man
20th June 2015, 12:46
apt-get install cpufrequtils

868

Just told someone to try it on a Server4You root, but it doesn't work out of the box (or not at all). It neither can read the CPU settings nor set them.

Mitch
20th June 2015, 13:49
When i try to install that i'm getting this:


Setting up cpufrequtils (008-1) ...
* Loading cpufreq kernel modules... [fail]
* disabled, governor not available...
* CPUFreq Utilities: Setting ondemand CPUFreq governor... [ OK ]
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
Processing triggers for ureadahead (0.100.0-16) ...


But i'm using a VPS so it doesn't apply.

IzNoGoD
20th June 2015, 14:21
By default cpufrequtils tries to set the ondemand governor, which is not available on most systems. It might auto-switch to another. Just try to continue with the rest of the tutorial