Is there a good way to see how much my system (for example how frequently, how much swap space it is using each time/ on average) is using the swap space during various tasks?
1 Answer
You can use sar -B 1
to get a realtime view of this information (change 1
to the update interval you want).
The output looks like this:
08:11:54 PM pgpgin/s pgpgout/s fault/s majflt/s pgfree/s pgscank/s pgscand/s pgsteal/s %vmeff
08:11:55 PM 0.00 0.00 24.00 0.00 57.00 0.00 0.00 0.00 0.00
08:11:56 PM 0.00 0.00 23.53 0.00 53.92 0.00 0.00 0.00 0.00
08:11:57 PM 0.00 0.00 16.00 0.00 53.00 0.00 0.00 0.00 0.00
pgpgin/s - Total number of kilobytes the system paged in from disk per second.
pgpgout/s - Total number of kilobytes the system paged out to disk per second.
fault/s - Number of page faults (major + minor) made by the system per second. This is not a count of page faults that generate I/O, because some page faults can be resolved without I/O.
majflt/s - Number of major faults the system has made per second, those which have required loading a memory page from disk.
pgfree/s - Number of pages placed on the free list by the system per second.
pgscank/s - Number of pages scanned by the kswapd daemon per second.
pgscand/s - Number of pages scanned directly per second.
pgsteal/s - Number of pages the system has reclaimed from cache (pagecache and swapcache) per second to satisfy its memory demands.
-
Sar comes with sa1 a script that can collect daily usage of different system activity metrics, pagination included (see "man sa1", "man sadc").– EmmanuelCommented Dec 6, 2013 at 10:06