Narrator: So let's talk about RDS Performance Insights.
And that's the last one around monitoring for RDS
but I think you need to know it and it is quite
a cool tool overall.
So Performance Insights allows you to visualize
your database performance and you can analyze
why there are issues that affect your database.
So you can visualize the database load
and you can filter the load
by four different types of metrics.
The number one is called Waits.
And Waits is very cryptic but basically it shows you
the resource that will be the bottleneck.
It could be CPU, IO, could be some locks.
If you needed to know how to upgrade
your database to a different type of instance
and know if you wanted to optimize the CPU
or optimize the IO, Waits will give you
a good idea of what your database waits on the most.
If it's a CPU the IOS etc.
Now you can also filter by SQL statements
so if an SQL statement is, by default,
blocking your database or making it crawl for
whatever reason, then you can identify
that sequel statement and maybe you can
reach out to the team or the application
that runs that statement and to understand
how you can optimize that statement.
You can also filter by hosts.
Basically by filtering and by grouping by hosts
you can find the server or the application server
that will maybe be hammering our database
and take action.
Maybe blocking access or maybe talking to them
and understanding why they are using
so much of our database.
Maybe they need a re-replica.
And then finally by users.
This is to connect using the user names
and to find the user that are using
the most our database.
The idea is that the this Performance Insights
allows us to understand who or where from
or what statements is using our Waits
which is it CPO, IO lock, etc.
Now database load will be evaluated
as the number of active sessions
for the database engine.
And the whole thing basically allows
you to troubleshoot including viewing those
SQU queries that are putting loads on your database.
Our database is not interesting
because it's not running anything special.
There's not application so I was just
going to show you screen shots of what you can expect.
This is Performance Insights and this is from
the Amazon blog.
As you can see you get a line right here
and it shows you the max number of CPU.
As long as you are under it you're doing fine.
But if you are over it that means that
your database is running at capacity.
If you slice that graph by Waits, on the right-hand-side
its shows you what's using your database.
CPU is only 0.32.
And IO table SQL handler is 1.82.
It seems like IO in there is going to be something
that you may want to optimize and improve
maybe using a better disk or whatever.
But this is the kind of idea using
the Slide by Waits which gives you all this list
of stuff that's happening and you can understand
what's blocking your database.
Now you can also analyze the SQL queries
that are running.
So as you can see, this one 1.38,
is an SQL query that is taking a long time
so maybe updates came at three table one set
s1 equals md5 random.
Basically that's a lot of action in this
takes a lot of resources and maybe their team
running that sequel statements, you should go
and talk to them and understand why they are
doing it and if they can do anything better.
This is quite a cool way of troubleshooting
which sequel queries are taking the most time.
And then you can also view by users.
You can see on the right-hand-side
that rds_user is having four connections,
jeremiah is having two, again that's from the blog.
But you get a lot more information around
who is doing what on your database
which could be quite helpful as well.
Maybe some application is opening 1000 connections
and you need to know about it right away.
By host, I don't have a graph for it,
but it will basically tell you
which application server is connected
to your database.
Overall all these things really help.
I think Performance Insights is a great tool
to help you troubleshoot.
Let me just show you where it is
in the AWS console.
To use Performance Insights you will
go to the left-hand-side
and you will need to actually enable
Performance Insights.
To enable it you would have to go to
your database and modify it.
Click on your Database Instances
and click on Modify.
But it turns out that since because we using
a t2 type of instance, Performance Insights
is not supported right now
on db.t2 instance classes, unfortunately,
so we can't have it and this is
why I showed you screenshots of it,
but from the screenshots you should get
a great idea of how it works.
But if you had a non t2 micro type of instance
than you should be able to modify your DB instance
and enable Performance Monitoring.
So as you can see, if I click on it
and maybe do an m4.large
and then scroll all the way down,
then I start seeing Performance Insight
and I can enable it and say
how many days of retention of data I want, etc., etc.,
but I won't do it right now.
But you can an idea and now
you're supposed to be a monitoring expert for RDS,
so congratulations.
I will see you in the next lecture.