6. Memory Monitoring
Lesson Content
In addition to CPU monitoring and I/O monitoring you can monitor your memory usage with vmstat
pete@icebox:~$ vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 0 0 396528 38816 384036 0 0 4 2 38 79 0 0 99 0 0
The fields are as follows:
procs
- r - Number of processes for run time
- b - Number of processes in uninterruptible sleep
memory
- swpd - Amount of virtual memory used
- free - Amount of free memory
- buff - Amount of memory used as buffers
- cache - Amount of memory used as cache
swap
- si - Amount of memory swapped in from disk
- so - Amount of memory swapped out to disk
io
- bi - Amount of blocks received in from a block device
- bo - Amount of blocks sent out to a block device
system
- in - Number of interrupts per second
- cs - Number of context switches per second
cpu
- us - Time spent in user time
- sy - Time spent in kernel time
- id - Time spent idle
- wa - Time spent waiting for IO
Exercise
Look at your memory usage with vmstat.
Quiz Question
# What tool is used to view memory utilization?
>The vmstat command (short for virtual memory statistics) is a built-in monitoring utility in Linux. The command is used to obtain information about memory, system processes, paging, interrupts, block I/O, disk, and CPU scheduling. Users can observe system activity virtually in real-time by specifying a sampling period.
1. [x] vmstat
2. [ ] init
3. [ ] unstart
4. [ ] iostat