Ahh, look at that,
the glorious orange sunset that's coming on the end of
our monitoring of processes and memory.
Now I'm really hoping you've got a lot out of this and that you are
now much more confident in how you can resolve bottlenecks regarding
CPU utilization and memory utilization.
So we began really by taking a look at our uptime command.
With our uptime command,
we're able to go through and see our load averages over the last 1 minute,
5 minutes, and 15 minutes. But to really understand the uptime information,
we need to know how many CPUs do we have on our system, so the
lscpu command will give us a lot of information about our CPU
including the number of CPUs that we have.
Using top,
we're able to really see a lot about our running processes,
so it really is an underrated command.
By default,
it's sorting our processes based on the CPU utilization, so it's great for
identifying the processes that are taking the most CPU time,
our CPU hogs.
But if we need to look for our memory hogs,
then we can go through and change our sort order and
sort on the memory utilization.
We can use the mpstat command to look at our process information.
This is going to give us more detailed information than uptime,
but the reality is that we do need to have our sysstat
package installed to have mpstat, and if we have got it installed,
then we can also look at our historical information with sar,
our System Activity Reporter.
So it's most likely we'll be using sar with a variety of switches to
be able to go through and look at our information.
We've seen that we can use sar ‑u to look at our processor information.
We can use sar ‑S to go through and look at our swap information
and sar ‑r to look at our memory utilization.
We've also introduced zombie processes.
Now don't think that they're anything bad.
The word zombie here is really overdramatizing the process.
Our zombie processes are created naturally when a child process ends.
It's down to the parent to kill off its child
processes once they have completed.
So generally,
we're not going to be seeing zombie processes when we go
through and search for our running processes.
If we do,
the chances are that we've probably got a buggy or not‑so‑well‑written
program and identifying that program and having a word with the developers is
probably the course of action that we need to take.
And we've also taken a look at how we can manage our swap management.
Now swap is our virtual memory, and that can be disks or partitions,
or as we used, files,
but it's there so when we get out‑of‑memory situations
where we don't have any physical RAM left,
rather than just dropping from the physical RAM,
we can start paging out memory from RAM through to disk,
and this is what we call our swap, swapping from RAM to disk.
We can control how likely that is to happen through our
swappiness parameter in our procfs.
And that's it.
We've got to the end, and I do hope, as I said before,
you really got a lot out of it, but don't worry,
we haven't quite finished yet.
We're going to be coming back in our next module and we're
going to be troubleshooting our storage issues, so I really look forward to seeing you in the next module.