I've setup an EC2 Instance on AWS Amazon, and I'm trying to change the CPU speed of the cores by following these steps: https://software.intel.com/sites/default/files/comment/1716807/how-to-change-frequency-on-linux-pub.txt

However, the folder cpu0/cpufreq does not exist. What should I do?

  • Why would you expect to be able to control the CPU speed on a machine that is potentially sharing a CPU across multiple virtual machines? As you are in a VM why would you expect to be able to control the CPU of the host at all? – Mokubai Jul 8 '19 at 21:33
  • 1
    The only way to increase the CPU frequency is to pay Amazon for that frequency. The documentation you linked to only applies to physical hardware and cannot be done within a EC2 instance – Ramhound Jul 8 '19 at 21:34
  • @Mokubai EC2 instances do not share CPU cores. Cores and memory are dedicated to each VM. – Michael - sqlbot Jul 9 '19 at 2:06
  • Why are you trying to control CPU frequency? What do you hope to achieve? – Tim Jul 9 '19 at 18:59

You don't do anything. You don't have control of the physical CPU parameters because you are in a virtual machine.

From https://aws.amazon.com/ec2/instance-types

Each vCPU is a thread of either an Intel Xeon core or an AMD EPYC core, except for T2 and m3.medium.

vCPU tells you that you are running a virtualized CPU rather than having all the hardware and control you expect of a "real" CPU.

If you want control of the CPU then chances are you need a dedicated server, not a VM instance.

  • Thank you! So something like this: aws.amazon.com/ec2/pricing/dedicated-instances ? – Teresa Salazar Jul 8 '19 at 22:24
  • or this: aws.amazon.com/ec2/dedicated-hosts ? – Teresa Salazar Jul 8 '19 at 22:31
  • 1
    @TeresaSalazar No, not either of those. Those are still cases where your tasks are assigned virtual CPUs. It's just that the only virtual CPUs assigned to that physical CPU are yours. These are all solutions where Amazon manages the CPU performance for you. – David Schwartz Jul 9 '19 at 0:21
  • Oh ok thank you @DavidSchwartz. What do you recommend using then? – Teresa Salazar Jul 9 '19 at 0:34
  • 1
    @TeresaSalazar I don't know what you're trying to do, but the short answer is to buy exactly what you want rather than buying something else and trying to make it what you want. – David Schwartz Jul 9 '19 at 0:36

You can control C-state and P-state configuration by modifying the kernel parameters passed to it from grub. Documentation explains how it works exactly at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/processor_state_control.html

You can also specify CPU options when creating EC2 instances to control the use of Threads & Cores. As per the documentation at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.