ChatGPT解决这个技术问题 Extra ChatGPT

What is CPU Credit Balance in EC2? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions about professional server or networking-related infrastructure administration on Stack Overflow. You can edit the question so it’s on-topic for Stack Overflow. Closed 3 years ago. Improve this question

I came across CPU Credit Balance in EC2 monitoring . What is CPU Credit Balance?


M
Mostafiz Rahman

AWS EC2 has 2 different type of instances: Fixed Performance Instances(e.g. M3, C3 etc) and Burstable Performance Instances (e.g. T2). Fixed Performance Instances provides a consistent CPU performance whereas Burstable Performance Instances provide a baseline CPU performance under normal workload. But when the workload increases Burstable Performance Instances have the ability to burst, i.e. increase the CPU performance.

CPU Credit regulates the amount CPU burst of an instance. You can spend this CPU Credit to increase the CPU performance during the Burst period. Suppose you are operating the instance at 100% of CPU performance for 5 minutes, you will spend 5(i.e. 5*1.0) CPU Credit. Similarly if you run an instance at 50% CPU performance for 5 minutes you will spend 2.5(i.e. 5*0.5) CPU Credits.

CPU Credit Balance is simply the amount of CPU Credit available in your account at any moment.

When you create an instance you will get an initial CPU Credit. In every hour you will get certain amount of CPU credits automatically(this amount depends on the type of instance). If you don't burst the CPU performance the CPU Credit will be added to your CPU Credit Balance of your account. If you are out of CPU Credit(i.e. CPU Credit Balance turns into 0) your instance will work on baseline performance.

Read more on CPU Credits and Baseline Performance for Burstable Performance Instances


Does this means If I use CPU at 50% for 5 minutes, I can use CPU at 150% for 5 minutes ?
@JayShah, No, you won't. In fact for most of the instances you will lose your CPU Credits to run it at 50% since most of the instances has the baseline performance less than 50%L(e.g. t2.small has 20%)
Oh. Baseline performance is just 30% for t2.large. In Fixed Performance Instances, we can continuously use CPU even at 90% without any problem. So why would one use Burstable Instances ? - Are they very cost effective ? or when someone wants to run the app that rarely uses CPU ?
That I got, but what makes me wondering is - the price difference between burstable and fixed performance instances is very less. t2.large - $0.0928 per Hour - $66.816 per Month, m5.large - $0.096 per Hour - $69.12 So, why anyone should use burstable instances which provides around 3 times less CPU power and cost difference is just around $3 per month ? Please tell me if I'm missing something.
Yes, you need to compare t2 with m4, and t3 with m5 which are the same generations of hardware. To see the breakeven for using m5 vs t3 read here: docs.aws.amazon.com/AWSEC2/latest/UserGuide/…
h
haotang

According to official document:

Amazon EC2 allows you to choose between Fixed Performance Instances (e.g. M3, C3, and R3) and Burstable Performance Instances (e.g. T2). Burstable Performance Instances provide a baseline level of CPU performance with the ability to burst above the baseline. T2 instances are for workloads that don’t use the full CPU often or consistently, but occasionally need to burst. T2 instances’ baseline performance and ability to burst are governed by CPU Credits. Each T2 instance receives CPU Credits continuously, the rate of which depends on the instance size. T2 instances accrue CPU Credits when they are idle, and use CPU credits when they are active. A CPU Credit provides the performance of a full CPU core for one minute.


d
datasage

To expand on the previous answer.

t2 class instances use a burstable CPU model. Instead of having access to full CPU resources all the time, you get access to full CPU resources base on a CPU credit model.

When your instance is idling, the instance is building credits up to a cap. The rate and cap vary on instance size.

When you use CPU resources, you spend those credits. Once you run out, your CPU usage is capped very low until you build up more credits.


D
Donal

When your instance uses fewer CPU resources than its base performance level allows (such as when it is idle), the unused CPU credits (or the difference between what was earned and what was spent) are stored in the credit balance for up to 24 hours, building CPU credits for bursting.