`sar -B` - does paging stats include file cache or literally physical disk?
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
`sar -B` - does paging stats include file cache or literally physical disk?
An excerpt from the man page of sar reads as follows:
----------------- cut -------------------------
" -B Report paging statistics. The following values are displayed:
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 (post 2.5 kernels only). 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 (post 2.5 kernels only)."
----------------- cut -------------------------
Does anyone know if the values pgpgin & pgpgout literally mean pages read from physical disk, or does it also include pages read in from file cache in memory?
It says "from disk" and "to disk". This deals with writes to and reads from the swap device. There would be no reason to put swap device in "memory" (RAM) because if you have enough RAM you shouldn't need to swapout in the first place.
Some disk arrays (e.g. EMC Symmetrix) have a memory cache to stage writes to disks. If that was where your swap was then the "disk" would be the array's memory cache rather than the actual disk because the OS would consider it written to disk once the array had reported it as such even though behind the scenes the array is doing the write to physical device afterwards. There is no way you could use sar to determine that was happening - it would simply look like a very fast write.
You don't really have to worry much about pagein/pageout unless you see an excessively high number of the former compared to latter as it would indicate you are memory constrained.
thanks for your reply. I was under the impression that `sar -B` reported total pages read/written from the disk during normal application activity (i.e. not swap related). In fact I tested this on an Oracle DB server that is very active, but not using any swap space (naturally) and it did show high pgpgin/pgpgout values which I took to mean normal read/writes from the DB and application files.
As Linux caches much of it's disk reads to page cache for faster access if needed later, my question is then, will the pgpgin value increment if files are read from file cache or will it only increment if it needs to go to disk to access that information? In other words, does sar consider reads from the file cache "disk" access?
(or have I completely missed the purpose of `sar -B`) - thanks
It will only include physical I/O to the "device". Hits on page-cache are effectively transparent - minor page faults give some indication, but not much.
There is an unfortunate mix of terminology here - in Linux the page cache is (also) used for mmap'd file I/O. This explains the numbers the OP sees. Swap(-cache) is a different in that it is only used for (dirty) anonymous pages. It's effectively a subset of pagecache.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.