LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-04-2009, 01:09 PM   #1
zQUEz
Member
 
Registered: Jun 2007
Distribution: Fedora, RHEL, Centos
Posts: 294

Rep: Reputation: 54
`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?

thanks
 
Old 06-04-2009, 02:44 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Not exactly sure what you mean by that.

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.
 
Old 06-04-2009, 05:35 PM   #3
zQUEz
Member
 
Registered: Jun 2007
Distribution: Fedora, RHEL, Centos
Posts: 294

Original Poster
Rep: Reputation: 54
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
 
Old 06-04-2009, 06:04 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,139

Rep: Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Disk Cache only 21% - kinfoCtr. tip suggests high is better vs. Physical - How alter? mitchellray Slackware 6 08-27-2011 09:02 PM
how to map a physical disk block to a file squarecmb Linux - General 2 04-12-2007 09:06 PM
disk stats not updating after deletion of file.. disk full joecool118 Linux - General 2 04-10-2006 12:23 PM
increase free physical memory, decrease disk cache efm Linux - Hardware 4 03-30-2006 09:53 AM
RH9, memory paging problems? Not physical NssOne Red Hat 3 04-23-2004 12:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration