Best practice to disable SpeedStep for Hyper-V hosts?

65

After a bit more searching it seems like this is a general problem with modern server CPUs, even unrelated to virtualization, and major server vendors as well as software vendors like Microsoft and VMWare ship their products with default settings that artificially limit your CPU performance. I still find that hard to believe.

The solution for anybody who cares about having instantly access to full CPU power per core without all the cores being busy at first, is to disable power saving (Intel SpeedStep/EIST or AMD Cool'n'Quiet). Depending on your BIOS setting, this can be controlled on the OS level (like on Windows powercfg.cpl "High-Performance" plan), or via BIOS, in this case the OS setting is grayed out.

Brent Ozar wrote on this ("SQL Server on Power-Saving CPUs? Not So Fast.") in 2011:

In the last few weeks, I’ve seen several cases where server upgrades have resulted in worse performance, and one of the key factors has been throttled-down CPUs. In theory, the servers should crank up the juice according to demand, but in reality, that’s rarely the case. Server manufacturers are hiding power-saving settings in the BIOS, and Windows Server ships with a default power-saving option that throttles the CPU down way too often.

Microsoft says in KB2207548:

In some cases you may experience degraded overall performance on a Windows Server 2008 R2 machine when running with the default (Balanced) power plan. The issue may occur irrespective of platform and may be exhibited on both native and virtual environments. The degraded performance may increase the average response time for some tasks and cause performance issues with CPU-intensive applications. [...] This issue may occur if the Power Options settings are set to Balanced. By default, Windows Server 2008 R2 sets the Balanced (recommended) power plan

There is a hotfix available for Win2008R2, and a BIOS update is recommended, but since this is an issue still with Win2012R2 it seems there is no way around the second recommendation, "High performance" plan.

An issue with similar symptoms is described in KB2534356 which also offers a hotfix for Win2008R2 only. So for me only the usual workaround applys (High performance plan), but it sounds like a fix could be possible in the future. (It works great on desktop CPUs, so I don't understand why it shouldn't be possible on the server.)

I will update this answer in case I might find a better solution (or of course will change the accepted answer if someone else is posting a solution).

Still wondering if EC2 or Azure might have the same issue (in this case you wouldn't be able to do anything about it since you need control over the host, changing the setting in the VM won't have any effects).

Some more references:

Share:
65

Related videos on Youtube

huzaifa imran
Author by

huzaifa imran

Updated on September 18, 2022

Comments

  • huzaifa imran
    huzaifa imran over 1 year

    I am new to threading concepts in Java. I made a thread consisting of a method called timer() this method lessens the value of the variable 'time'. I dont know what I am doing wrong in this, The code is posted below:

    package Threading;
    /**
     * Threads are used to perform tasks cocurrently 
     * In this example we used Thread Class 
     * .start() is method use to run the method
     * .sleep is used for delay and so on
     */
    public class Intro_using_Thread extends Thread {
        int time;
    
    
        public Intro_using_Thread(int time) {
            this.time = time;
        }
        
    
        public void timer() {
            for (int i = time; i >= 0; i--) {
                time--;
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    

    Driver Class

    package Threading;
    
    import java.util.Scanner;
    
    /**
     * Threads are used to perform tasks cocurrently In this example we used Thread
     * Class .start() is method use to run task
     */
    public class Intro_using_thread_run {
        public static void main(String[] args) {
            int choice;
            Scanner in = new Scanner(System.in);
            Intro_using_Thread timerobj = new Intro_using_Thread(200000);
            timerobj.start();
            while (timerobj.time!=0) {
                choice = in.nextInt();
                System.out.println("The time is = "+timerobj.time);
                
            }
        }
        
    }
    

    OUTPUT

    The Output is in this link

    I dont know why Stack overflow does not lemme add pictures.

  • raja
    raja over 9 years
    not all UEFI firmware supports disabling speedstep
  • realMarkusSchmidt
    realMarkusSchmidt over 9 years
    Thanks, but as I wrote, I was able to turn it off in Windows control panel without even rebooting. That's not my problem. My question is if this is really expected behavior and if there is a workaround without disabling power management. E.g. I don't think cloud providers like Amazon, Google or Microsoft would do this, they probably would get crazy power consumption and cooling problems in their datacenters... it's probably not best practice.
  • realMarkusSchmidt
    realMarkusSchmidt over 9 years
    So when you (sporadically) saw this, what did you do about it?
  • Michael
    Michael over 8 years
    You'd think if the customer wanted a low power cpu, they would BUY a lower power CPU - not have it forced upon them by an obscure setting who's nature does not reveal its self anywhere but a 3rd party tool!
  • Solomon Slow
    Solomon Slow about 3 years
    Re, "When you call...start(), it...calls run()." That's true, but saying it that way could mislead a beginner. The run() call happens because of the start() call, but it does not happen inside the start() call: It happens in a different thread.
  • huzaifa imran
    huzaifa imran about 3 years
    Does that mean that simply calling timerobj.run() will run that function on same thread? Does this mean that after running start() once makes a different thread and after that every run() will call that new thread?
  • Akshar
    Akshar about 3 years
    Solomon : Updated the answer to be more clear.
  • Akshar
    Akshar about 3 years
    huzaifa : A) Does that mean that simply calling timerobj.run() will run that function on same thread? -- Yes. timerobj is still a java object and you can call its functions. B) Does this mean that after running start() once makes a different thread and after that every run() will call that new thread? -- start() creates a new thread and calls run() method on the new thread.