Stephane: So let's have a look now at,
burstable type of instances in AWS, for example, T2 or T3,
but just a T-family overall.
So that means that when you have a T2, T3 type of instance,
you are using it and the instance,
will have okay CPU performance.
And then when the machine needs to process something,
very, very unexpected, for example,
that requires a lot of CPU for a spike in load,
it can burst.
That means that the CPU can become very good,
and can handle this spike for you.
So then when the machine bursts,
it usually what's called a burst credit,
and as your EC2 instance has its lifecycle,
it will accumulate burst credit,
and then when the CPU is intensely being used,
then the burst credit will be used as well.
So if all credits are gone,
the CPU becomes really, really bad,
and that means,
that you're not using the right type of instance,
and I will show you this in graphs right now.
So if the machine stops bursting though,
the CPU credits are getting backed over time,
and you can reuse them whenever you need them.
So, first of all, instance can be amazing to handle,
unexpected type of traffic, and if handled correctly,
it could be a really, really,
lifesaver type of instance for you.
But if you are having an instance,
that consistently runs low credits,
then you need to move to a different kind of instance,
because maybe,
you're not using the T type of family correctly.
So if you ever looks, this is from CloudWatch monitoring,
as we can see, as soon as the CPU,
level will spike, then there will be a decrease,
in the CPU credit balance.
As you can see here, there's a spike in usage of credits,
and that means that here the CPU credit balance,
will go down, and then once the spike steps,
then credits are reaccumulated,
to go back to a different credit balance.
Okay.
So if we look at the credits, different type of instances,
will earn credits at a different rate.
And so, as we can see for a T2 micro,
we one vCPU with a launch credit of 30,
and then you earn six credits per hour,
and the maximum amount of credits you can have is 144.
And the baseline performance is 10%.
Okay.
So what happens when the credits are exhausted?
So I did run a little experiment for you to see.
So I ran the CPU's stress command,
to peak at 100% CPU utilization on a T2 micro.
And then we can see that,
after all the credits are exhausted,
then the actual measured CPU utilization will drop.
So let's have a look, this is again from CloudWatch.
So I did launch my instance,
and then I ran the stress command, as you can see,
the CPU utilization skyrocketed,
and went all the way to 100%.
While it did so, on the right hand side,
we can look at the CPU credit balance.
So it started at 30,
which is the number of CPU credits you get,
when you launch a T2 micro,
and then because the CPU position was skyrocketing at 100%,
then the credit balance was being used.
And as we go along in time,
the CPU current credit balance drops, drops, drops, drops,
which allows my utilization to still peak,
but when the CPU credit balance reached the zero,
so when we had no more credits.
Then as we can see,
even though the stress command was still being run,
the CPU utilization dropped all the way to 10%,
which is the baseline.
And so, as you can see now,
there is a lower CPU utilization.
So when there is no more credit on your CPU,
even though you are running your instance at full capacity,
the measured CPU utilization will be really low,
and will not be at 100%,
which is a behavior you should know,
going into the exam.
So how can we (indistinct) that?
So we have T2 and T3 unlimited,
which is to give you an unlimited burst credit balance.
So this time you don't have a credit balance,
you can just tap into it as much as you want.
That means that you're going to pay extra money,
if you go over the credit balance,
but you will not lose in performance.
And in case you have a CPU research,
that goes over the 24 hour baseline,
then you're going to get additional pay,
for number of CPU per hour you're using.
So, be careful if you have a CPU instance,
that really, always is at 100%,
you will not be shown that behavior,
and you will pay a lot of money.
Okay, so be careful,
and manage your other CPU you have,
health of your instances.
So this is what I wanted to show you in this graph.
So what we can see here,
is that the CPU utilization right here, peaks at 100%,
and that we're using the CPU credit usage as well,
a lot in CloudWatch.
Okay, five credits per hour.
And if we look at the CPU credit balance,
we started as zero, this is the blue line right here,
which means that first we are tapping,
into this 24 hour period surplus credit balance.
So we are tapping into it,
and then when we reach 72,
which is how many credits we can use,
in one hour for this type of instance,
then what's went is to the CPU will get charged,
and the CPU surplus credit charge,
which is a feature of T3 unlimited or T2 unlimited,
which is that extra CPU balance were given to you,
and you're paying for those.
But it still allows your CPU solution,
to remain stable at 100%,
and give you the performance you need.
So, if I go and launch an instance,
and we choose an instance in the T family,
for example, T2 micro,
which is a burstable type of instance,
then you scroll down, and you find advanced details,
and you scroll down again,
and you're looking for credit specification.
In here we have the option to choose the unlimited mode,
if we wanted, to have unlimited burst credit,
and additional charge may apply,
or to use the standard mode, to just have standard credits.
Okay, and if you don't select anything,
then it will go with a default based on the logic of AWS.
And finally, if I look at my T2 micro right now,
and go into monitoring,
and have a look at the credit.
So if I scroll down in here,
at the very bottom, I can look at CPU credit usage.
So, how much CPU credits were being used every hour,
as well as my CPU credit balance.
And so if I just view this in metrics,
to give you a larger graph in CloudWatch metrics,
as we can see, I started at about 30 credits,
and over time,
because I have not been using my CPU instance a lot,
I've been accumulating credits.
And when I was using my CPU instance,
and my EC2 instance,
then some CPU credits were being consumed here as well.
Okay.
So that's it for this lecture.
I hope you liked it, and I will see you in the next lecture.