Happy Thursday!
all posts

Your server might be faster than you think if you have a Hetzner server

Published on Mar 9, 2018

Sven Pachnit GitHub Twitter StackOverflow

If you have a Hetzner server with one of the recent CPU types you might be running in powersave mode. This is because the new CPUs don't support ondemand anymore. Also, some revisions of the ubuntu server image contain a typo which might cause this problem even with an older CPU.

  1. Verify you are on powersave

    • cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
  2. Check if you already have:

    • service: sudo service cpufrequtils status
    • file: file /etc/default/cpufrequtils
  3. Check available governors (it probably doesn't have ondemand if it's a newer (intel?) CPU)

    • cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
  4. Edit file /etc/default/cpufrequtils (it has typo and nonexistant governor)
    REPLACE: GOVENOR="ondemand"
    WITH: GOVERNOR="performance"

  5. Disable ondemand service (it doesn't know about performance and will always set it to powersave)

    • sudo service ondemand stop
    • sudo update-rc.d ondemand disable or systemctl disable ondemand
  6. Restart the service and verify after a few seconds

    • sudo service cpufrequtils restart
    • sudo service cpufrequtils status
    • cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
  7. Make sure it stays that way

    • After upgrading the Ubuntu release the ondemand service was back at work.
    • Monitoring this value is recommended, I'm using my poor man monitoring