From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96079271218333.tru64-unix-managers.marc@archive.invalid> From: Becki Kain Date: Mon, 03 Jan 2000 23:24:31 +0000 To: tru64-unix-managers Subject: {S} swap question X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96079271218333 Original question: this is on a 250/4/266, 4.0d, with 128 meg of ram with swap in over commit mode. "swapon -s" says 11% of 194MB swap (22MB) is in use. but if you add up all the "percent real memory usage" from the ps listing, it looks like only about 25% of real memory is in use: % ps -e -o pmem | awk '{sum += $1} END {print "sum = " sum}' sum = 24.8 so if real memory is only 25% in use, why is it swapping? or is something else using up the other 75% real memory? or am i looking at this all wrong? or do i need another beer? basically i was trying to figure out if we need more memory, and if so how much so that no swapping happens? ------------------------------------------------------------------------- I've included all of the messages but the summary is basically as follows: vmstat is better to use that swapon. Look for entries in pout column. If there is nothing there, the box is not yet swapping. -------------------------------------------------------------------------- From: Steve Walling Check out the man page for "vmstat". Until you see some activity in the "pout' column, you're not paging out anything. The system reserves some swap space even if its not needed. We have Oracle databases running on our servers. I kept increasing the database buffers in memory until I saw non zero values in the "pout" column. I then backed off a bit on the buffer size and we very rarely page out. --------------------------------------------------------------------------- From: "A. Mahendra Rajah, System Manager" Swap space is allocated to each process at process creation time so that they all could be swapped out just in case (think of this as reserved parking stalls). If all the cars came at once (ie., all processes are swapped out), that is the amount of parking space needed (swap space needed). Unless the machine is tight on memory, no actual swapping takes place. --------------------------------------------------------------------------- From: "Dr. Tom Blinn, 603-884-0646" Have you tried "vmstat -P" ? It reports on where your memory is REALLY going inside the kernel. For instance, if you've got a large UBC use for file I/O, then that can push not-recently-used process pages (that may be private to the process and hence need swap) for long-running processes (such as the X server or things of your own), that might not garbage collect effectively or even might have memory leaks -- private pages don't have to be in active use to be still around, after all.. --------------------------------------------------------------------------- From: Lawrence Decker Have another beer anyway!!! (author's note: I work from home and this was way late at night) ---------------------------------------------------------------------------- From: Duncan Webbe When you are in over-commit mode isn't the swap space you're seeing as being used just that which is reserved should it be required ? I don't think any real swapping is going on here. ----------------------------------------------------------------------------- From: Paul_O'SULLIVAN@paribas.com More beer is required I think. VMSTAT is a better indication that you need more memory if you get lots of swapin and swapout rates. Unix consumes as much memory as it likes in the form of UBC - unified buffer cache. This is a dynamically allocated area of memory. acct will give you info on images and command lines activated etc etc ---------------------------------------------------------------------------- From: Ron Morley What you are seeing is the amount of swap space that the system has reserved in case it needs it. With modern Unices "swapping" is not actually performed except under what amounts to emergency conditions. Instead of swapping memory is paged in and out of swap space generally on a least recently used basis. Swap space will be used by pages of processes that have not been accessed recently. To get a better idea of how this works take a look at vmstat. You'll see some paging activity taking place there. This is normal no matter how much physical memory you actually have. Nothing is wrong with your system. It is acting the way it's supposed to. ---------------------------------------------------------------------------- From: Piotr Konieczny %MEM = RSS / TOTAL_REAL_MEMORY. You must remember that each process has virtual address size (VSZ) much bigger than resident size (RSS). Sum of all VSZs is total usage of real memory. ----------------------------------------------------------------------------- From: Jim Fitzmaurice All available memory is always used as Universal Buffer Cache to cache disk reads and it gives it back as the system needs it for other things, Tru64 UNIX will swap what it considers "old" regardless. That is suppose to prevent thrashing should memory suddenly become constrained. The "System Tuning and Performance Management Manual" had an excellent write-up on how Virtual Memory, (That's RAM + Swap) is managed, you should read it. (And have another beer.) ---------------------------------------------------------------------------- From: "John J. Francini" Hmmm. Note that memory not taken up by processes is given over to the filesystem cache. It's quite likely that this is where the majority of the space is. The default parameters allow DU to claim as much as 80% of system memory for the file system cache, unless it's required for process expansion. Of course, if a process's pages go out (because it's idle and the system needed to expand the buffer cache), the pages will stay out until the process revives and tries to touch those pages. This can account for the situation where there's plenty of memory available but the swap space isn't empty. You may want to lower the maximum size of the buffer cache to something more reasonable, like, say 50%. Also note that some of the kernel and executive itself is paged, and could be using a nonzero amount of pagefile space -- especially pages that contain code that doesn't get executed often. As an aside, generally, on any system 512M or smaller, I tend to allocate double the memory in pagefile space, buttered across two or more spindles, if possible. Hope this helps, John p.s. Checked out your Web site -- those ferrets are _cute_! Becki Kain beckers@furph.com -- furph, Inc. WWW/Unix/Windows Solutions 734-513-7763 (voice) info@furph.com http://www.furph.com 734-513-7759 (FAX)