- In this video we are going to talk about I/O monitoring
and tuning.
So, if you wanna know what's going on with your I/O,
you should start using the top utility.
Because, the top utility gives generic system
use its information.
And you should particularly check out the weight parameter.
Then there is a I/O top utility.
I/O top is specifically focusing on I/O performance
and it's offering a top like interface
and that is quite convenient.
You can press Q to exit.
You might need to do a kernel setting go,
but we will see that
I/O top is complaining if the kernel setting is not done
and you can do it at that moment.
Also convenient is vm stat.
vm stat is giving an overview of current I/O activity.
Let me show you.
All right, so, well,
before we are going to explore these utilities,
let me write a small scale script.
I/O stress.
Because, it's so much nicer to have a look at this
if something really is going on.
So, as you can imagine,
this is an infinite loop.
And in this infinite loop,
we are copying the entire contents
of the input file dev sda to the output file dev null.
So, to nowhere.
And they should create
at least some read performance stress.
So let's make this executable.
And run it.
And now we can have a look at top
to see if there's anything going on.
So, what do we see?
We see a very busy DD process.
And we see a lot of activity in system space
on the third line.
And there we go.
The WA parameter
WA is waiting for I/O.
And it's waiting for I/O,
that's an indicator that something is not going alright
with your I/O performance.
So, once you have noticed
that this WA parameter occurs,
then you need to further zoom in
and that is where I/O top comes in.
I/O top in most cases is not installed by default.
I might have already installed it before.
But here we go.
This will be sure DNF install I/O top.
Just ignore the output of the DD command.
That is, that's happening in my screen.
Just a quick check to verify.
Yeah, I was verifying that the script is still running.
And DD is going to show us output every now and then.
Now here we have I/O top.
And what do we see?
We see that I/O top isn't showing anything.
But if you look at the lower part of the screen,
then you can see kernel . task delay
accounting sysctl not enabled in in the kernel.
So, that's something that we need to fix.
So, let's do that.
By going to proc sys kernel.
And the parameter that we are looking for
is task delay accounting.
So, what does it have?
It has a zero.
And if you want to see what is going on,
this parameter needs to be on.
So, now I'm going to try I/O top again.
And at this point we can see
I/O top clearly indicating what is going on.
So, what do we see?
Well, we see the DD process.
And the DD process giving a lot of
lot of activity.
Oops, that's the DD output messing up
what we are looking at.
You can see the amount of disc reads.
There's no disk writes because, we are just reading
and we are redirecting to the no device.
And that is indicating what is happening I/O wise.
It's also showing the percentage of I/O.
So, this is pretty nice,
pretty nice overview of what is happening
with the I/O on your system.
Now, related to I/O top, there's also vm stat.
Let me do vmstat 2 10
where 2 indicates that I wanna do a 2 second interval.
And I wanna do it 10 times.
And there we can see what exactly is happening.
This is what we are looking at
SISO for Swap In Swap Out.
BIBO for Block In and Block Out.
Now the generic thing that you should be looking at
again
is top.
So, what do we see in top?
Well, in top we need to make a conclusion
are we suffering from poor performance?
And if you are suffering from poor performance,
there's some optimization to be done.
Now, what is the indicator?
Indicator number one
is that we have some significant waiting going on.
Indicator number two
is that we
we do also have 42% in idle loop
and that means that this system is not completely saturated.
If it is, you need to
to look at how to reorganize your storage channel.
I can show you one thing.
That is in the sys directory.
There is a block sub directory
and in this block sub directory
we have one sub directory for every single disc device.
So, here we have the sub directory for sda.
In which, we have a queue sub directory.
And in this queue sub directory,
we have the scheduler.
So, if you get on the scheduler,
we can see the current scheduler.
So that's mq deadline
and there are other schedulers involved as well.
Kyber, bfq, and none.
What you can try as a quick fix
is to change the scheduler.
I'm going to echo none to this scheduler file.
And as you can see that changes it immediately.
The reason I'm using none as a scheduler,
is because this is a virtual machine
and in virtual machines,
it's typically the hypervisor
taking care of the I/O scheduling
and that means that Linux shouldn't be involved
and that is why none might give you better,
better performance.
Next, we can check in top
if there is any significant improvement.
And do we see significant improvement?
Probably not, but that's because the test is too simple.
With this, you now know a little bit about monitoring I/O.
And, also a little bit about tuning of I/O performance.
Let's have a look at the next video.