9

I've been paranoid that the websocket feed I was listening to on a t3.micro instance was being inhibited by cpu steal time from other instances under the same hypervisor.

So I switched over to a c5d.large instance and definitely noticed less latency. But now I am curious... where did my CPU credit graph disappear to in the EC2 monitoring section?

Do c5d.large instances not have CPU credits for some reason? If not, why not?

MLu
  • 23,798
  • 5
  • 54
  • 81
randy
  • 101
  • 4
  • `t3.micro` instances run in unlimited mode by default, meaning that no throttling is taking place: if you exceed the CPU credits allocated to your instance, you simply wind up paying for more credits automatically (if this happens all the time, it will be actually more expensive than running a higher class `m` instance). It is unlikely that "CPU steal" is the cause of your performance problem, it is much more likely that the bigger (and costlier) `c5d.large` can just run your code faster. – 0xF2 Feb 23 '20 at 18:21
  • Depending on the age of the instance, "unlimited CPU" might not have been enabled. – Criggie Feb 24 '20 at 00:06
  • 1
    @Criggie T3 instances started with unlimited mode when they were released. It's only T2 instances that don't have this defaulted (and even new T2 instances don't default to this). https://aws.amazon.com/about-aws/whats-new/2018/08/introducing-amazon-ec2-t3-instances/ – ydaetskcoR Feb 24 '20 at 09:11
  • Why do you think that is unlikely? If every VM on a physical t3 host is using more than its share of CPU, they all run slower. Unlimited mode or not. – user253751 Feb 24 '20 at 11:10
  • @user253751 you have a point. I find it is unlikely that every VM on that host is consistently in resource contention (including Randy's), but it is not impossible — just unlikely to consistently be the issue. – 0xF2 Feb 26 '20 at 04:37

1 Answers1

25

CPU credits only apply to T2/T3 instances. Each T2/T3 instance accumulates some CPU credits per second and also when it's in use (i.e. not "idle") it spends these CPU credits. When it runs out of credits it either slows down to the baseline performance (T2 default) or keeps running at full speed with you paying for the extra credits needed (T3 default and T2 "unlimited mode").

See On clarifying t2 and t3 working conditions? for a more detailed explanation.

Note that this doesn't apply to any other instance type - C3, C4, C5, M5, etc. None of these use CPU credits and can always use the full allocated speed.

Also note that if you upgraded from t3.micro to c5d.large you're now running a lot more powerful instance. No wonder that you see a lower latency!

Hope that explains it :)

MLu
  • 23,798
  • 5
  • 54
  • 81