Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


How to enable Performance mode on Ubuntu 20.04?
New on LowEndTalk? Please Register and read our Community Rules.

How to enable Performance mode on Ubuntu 20.04?

nqservicesnqservices Member
edited May 2 in Help

Hi,

I bought a new AX51-NVME dedicated server from Hetzner that comes with CPU AMD 3700X and when running “cpufreq-info” it says CPU governor mode is set to “Ondemand”.

After some reading, I follow the instructions at: https://www.robertroos.net/blog/cpu-performance-ubuntu-elementaryos/ to change the CPU governor mode to “Performance”, in order to improve my server speed by having always the “full cpu power”.

So I set my CPU to performance mode, by simply running the command:
sudo bash -c 'for i in {0..15}; do cpufreq-set -c $i -g performance; done'

All seems fine and since I’m using hetrixtools to monitor the server, the CPU Speed is now always very high (more than 3500Mhz), when before I saw many times at 2000Mhz.

My first question, is if performance mode will really bring more speed than ondemand mode, by having the CPU always set to use max power, correct?

My second question, is how to make performance mode default even after a server reboot. At the moment after every reboot, governor mode goes back to ondemand.

Thanks!

Comments

  • Daniel15Daniel15 Member
    edited May 2

    @nqservices said: is how to make performance mode default even after a server reboot.

    If you're on Kernel 5.9 or above (which you should be for a Ryzen CPU), add cpufreq.default_governor=performance to your GRUB command-line (GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub), then run update-grub.

    @nqservices said: My first question, is if performance mode will really bring more speed than ondemand mode, by having the CPU always set to use max power, correct?

    I'm not sure, but running the CPU at 100% power may reduce its lifespan, and of course uses more power too (although power is only really relevant if you're colocating). I think using performance mode just avoids the need for the CPU to ramp up to the higher frequency then ramp back down, which makes it a bit faster.

    The other thing that's possible is keep using ondemand but increase the minimum frequency.

    Of course, if your app only uses 5% of the CPU (for example), you're not going to actually notice a difference. Just because you get a higher Geekbench score doesn't mean your actual workload will improve in the same way
    Always run a benchmark with your actual workload to see if changes will actually help you :)

  • nqservicesnqservices Member

    Hi @Daniel15

    Thanks for the information! Im using Ubuntu 20.04.3 LTS [5.4.0-109-generic]. Other than that I just have the option for the Ubuntu 20.04 HWE version. Should I keep using the present one or move to the HWE version since im using Ryzen?

    Does you explanation applies to my Ubuntu 20.04.3 LTS [5.4.0-109-generic]?

    Thanks!

  • Daniel15Daniel15 Member

    I'd recommend upgrading to a newer Ubuntu version (22.04 is ideal) with a newer kernel. There's been several performance improvements for Ryzen processors in newer 5.x kernels.

  • nqservicesnqservices Member

    @Daniel15 said:
    I'd recommend upgrading to a newer Ubuntu version (22.04 is ideal) with a newer kernel. There's been several performance improvements for Ryzen processors in newer 5.x kernels.

    Thanks again. Will try to use Ubuntu 20.04 HWE version, available on Hetzner installimage rescue mode. Hope not to have any issues in using the HWE version instead of the "normal" non HWE 20.04 that comes with [5.4.0-109-generic] kernel.

  • 1gservers1gservers Member, Patron Provider

    With the CPU in “performance” mode, keep in mind that the CPU frequency will no longer boost above/beyond the base clock speed as it will remain fixed.

  • reb0rnreb0rn Member

    I never tweaked anything on my dedis and they work fast, benchmarks are also normal in ubuntu 20.04
    I am never for some "fake" tweaks that at the end do nothing

  • nqservicesnqservices Member
    edited May 2

    @1gservers said:
    With the CPU in “performance” mode, keep in mind that the CPU frequency will no longer boost above/beyond the base clock speed as it will remain fixed.

    Are you sure about that? I have set to performance mode on 2 servers. One is using AMD 3700X and when looking at hetrixtools monitoring, sometimes it shows above 3600Mhz base clock (its now at 4223Mhz), surely most of the time at: 3.6Ghz. Also on a Intel i9-9900K its showing right now at: 4410Mhz.

    Anyway I will further monitor that. But in theory it does not makes sence. Performance mode should use always the base clock and also use the boost/turbo mode, both in AMD and intel CPUs.

  • nqservicesnqservices Member

    @reb0rn said:
    I never tweaked anything on my dedis and they work fast, benchmarks are also normal in ubuntu 20.04
    I am never for some "fake" tweaks that at the end do nothing

    Mine too, for years. But I just noticed this and at last in theory it should improve overal performance, since it should avoid the need for the CPU to ramp up to the higher frequency if in energy saving mode.

  • nqservicesnqservices Member

    Hi all,

    One question to all LET members:

    Do you run your dedicated servers in "Ondemand" power saving mode or do you set to "Performance" mode?

    Thanks!

  • DPDP Member, Moderator, The Domain Guy

    @nqservices said:
    Hi all,

    One question to all LET members:

    Do you run your dedicated servers in "Ondemand" power saving mode or do you set to "Performance" mode?

    Thanks!

    "Idle Mode" surely.

    Thanked by 4AlwaysSkint k4zz t0m ralf
  • @Daniel15 said:

    @nqservices said: is how to make performance mode default even after a server reboot.

    If you're on Kernel 5.9 or above (which you should be for a Ryzen CPU), add cpufreq.default_governor=performance to your GRUB command-line (GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub), then run update-grub.

    hI @Daniel15

    Do you think using a newer kernel will also have benefit when using a KVM VPS instead of a dedicated server? I supose yes, correct?

  • Daniel15Daniel15 Member
    edited May 14

    @nqservices said:

    @Daniel15 said:

    @nqservices said: is how to make performance mode default even after a server reboot.

    If you're on Kernel 5.9 or above (which you should be for a Ryzen CPU), add cpufreq.default_governor=performance to your GRUB command-line (GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub), then run update-grub.

    hI @Daniel15

    Do you think using a newer kernel will also have benefit when using a KVM VPS instead of a dedicated server? I supose yes, correct?

    Yes, newer kernels help on KVM too, as the VPS still uses the CPU directly (albeit a virtualized version of it). It might not help as much as on a dedicated server, and a VPS can still be slower if it has a newer kernel but the host machine has a very old kernel, but in general it's worth running the latest stable kernel where possible since in general there a large number of bug fixes in each release.

    Thanked by 1nqservices
  • Thanks @Daniel15 for all the info and help!

  • user54321user54321 Member

    @nqservices said:
    Hi all,

    One question to all LET members:

    Do you run your dedicated servers in "Ondemand" power saving mode or do you set to "Performance" mode?

    Thanks!

    "Ondemand" is not the power saving mode, the name says pretty clearly what it is and the governor for powersaving is "powersave".
    With modern CPUs and their boost behaiviour you could actually end up with lower performance in performance mode, but you can of course benchmark that for yourself what performs on the hardware you have the best.

  • Hi @user54321

    To be clear I’m not looking to have the best bench YABS score. What I’m looking is to have the best PHP performance, since most of the apps I host depend on single thread PHP requests. So they must be fast and all available CPU clock must be “always waiting and ready at max speed”.

    I know differences are low… but.. in real day usage, its what I’m testing.

    Currently testing with 2 dedicated servers, one with AMD 3700X and the other with Intel i9900K. Both monitoring using Hetrixtools.

    When governor mode was set to “ondemand”, I often saw in hetrixtools, the CPU around 2Ghz. Also many times around +4Ghz. Also do not see max Ghz turbo/boost, even with YABS.

    After set governor mode to “performance”, the CPU clock on hetrixtools always shows the standard base CPU clock (3.6Ghz on both the AMD and Intel CPUs). Never below. Many times above +4Ghz.

    And yes… strange that in performance mode, I seem not to get more than 4.4Ghz. Seems “turbo/boost” mode on both AMD and Intel do not achieve the max Ghz in performance mode. Even using YABS.

    Whad do you think?
    Anyone else can share some experience / opinion? Thanks!

  • 1gservers1gservers Member, Patron Provider

    @nqservices said:
    And yes… strange that in performance mode, I seem not to get more than 4.4Ghz. Seems “turbo/boost” mode on both AMD and Intel do not achieve the max Ghz in performance mode. Even using YABS.

    Whad do you think?
    Anyone else can share some experience / opinion? Thanks!

    Yes this is why I commented earlier on this thread about this as has been my experience. Probably has something to do with thermal or overall voltage limits. The higher frequency all cores are running at, the lower probability of any single core turbo boosting.

  • nqservicesnqservices Member
    edited May 15

    @1gservers said:

    @nqservices said:
    And yes… strange that in performance mode, I seem not to get more than 4.4Ghz. Seems “turbo/boost” mode on both AMD and Intel do not achieve the max Ghz in performance mode. Even using YABS.

    Whad do you think?
    Anyone else can share some experience / opinion? Thanks!

    Yes this is why I commented earlier on this thread about this as has been my experience. Probably has something to do with thermal or overall voltage limits. The higher frequency all cores are running at, the lower probability of any single core turbo boosting.

    Yes... Inmy case my servers CPU is around 20% all day long. So my interest in to achieve the higher single thread performance.

    Anyway strange, since performance mode should set the base clock at it sets (perfect) and also achieve max CPU single thread Ghz.

    Im testing at Hetzner with Ubuntu 20.04 Minimal HWE ISO version (kernel 5.13.0-41-generic).

  • NoCommentNoComment Member

    @nqservices said: And yes… strange that in performance mode, I seem not to get more than 4.4Ghz. Seems “turbo/boost” mode on both AMD and Intel do not achieve the max Ghz in performance mode. Even using YABS.

    Because to hit the max clock speed for all cores, you need good cooling, good mobo and there's also a possibility your provider has restricted you somewhat in bios. If you turn off performance mode, most likely you can get the max clock for several cores, just not all of them.

  • Please double my bandwidth

    Order number #5409334892

    Thank you

  • @neobrother said:
    Please double my bandwidth

    Order number #5409334892

    Thank you

    Your bandwidth has been halved and your invoices doubled.

    Thanked by 2t0m CheepCluck
  • Thanked by 2t0m ralf
  • ralfralf Member
    edited May 15

    Everyone knows a proper turbo button toggles between 4.77MHz and 12MHz.

Sign In or Register to comment.