Well, those stats are a bit extreme, but not impossible.
Solaris will push out to swap any memory that has been allocated but doesnt appear to be being used.
So its pushed out 57G of useless crap.
It does this to free up memory for more useful tasks.
It may look like you've got 13 Gig of free memory just sitting around doing nothing. But the "free" memory is actually used as a disk cache. So you have 13 Gig of memory being used to cache hopefully more useful data than the 57 Gig of crap it pushed out to swap..
Anyway, low swap isnt actually a critical problem. Its not ideal, certainly. Because it indicates that the could be even more crap taking up memory that it would push out to swap if it could.
But low memory would be much more of a problem. Because that indicates that that the system has more useful data than memory and so has been forced to push out to swap stuff it would prefer to keep in memory...
So you could add some more swap if its convenient. But its not critical. A more useful question is why is so much virtual memory being allocated and why isnt it being used. Perhaps you can tune your application to grab less memory.
> hi,
>
> top command shows that the swap is too low (57G in
> use 382M free) and at the same time, the memory is at
> ease: 32 G real and 13 G free.
Could you show the output of 'swap -s' and 'swap -l'?
There are two reasons I can think of for high swap usage but low RAM.
#1 high amounts of "reservations". Resverations are when an application asks for memory but doesn't use it immediately. The reservations are taken from disk because it is likely that the program will *never* use it. So this leaves RAM free for other programs.
#2 Substantial memory pressure paged out tons of stuff to disk, and then an application exited or freed memory so that RAM was returned. I'd want to see one of the incremental lines of 'vmstat'. Is the 'w' column non-zero? If so, #2 becomes more likely.
> is it possible to have a low swap while free RAM is
> ok?
Yes.
Once something is paged out, it won't be paged back in unless it's needed.
--
Darren
I nearly hit post before actually testing out the command on my own systems, but I nearly stated my standard statement (stolen from another SA) - that top has been relatively broken since at least 2.5 days -
I think that statement really drives to the "freemem" parameter and other kernel memory statistics areas that in older versions of Solaris really didn't contain as much "relevant" info as it does in more recent versions. [ edit - on version 2.8 and above, freemem appears to be fixed and top is reporting things correctly now ]
take for example this following 2.6 example -
$ df -k /tmp
Filesystemkbytesusedavail capacity Mounted on
swap655544853760 65016881%/tmp
$ swap -l
swapfile dev swaplo blocksfree
/dev/vx/dsk/swapvol 156,516 3071984 2608576
$ prtconf |egrep "^Memory"
Memory size: 7168 Megabytes
$ egrep swap /etc/vfstab
/dev/vx/dsk/swapvol--swap-no-
swap-/tmptmpfs-yes-
these lines show that I'm not limiting at mount time my tmpfs filesystem, that I have ~7GB of memory on the machine, another 1.5GB of file mounted swap and have roughly 6.5GB total available remaining "memory" on the machine whether its physical mounted swap or RAM.
the top output shows (cutting for relevance)
load averages: 0.03, 0.04, 0.05;up 140+03:07:05 13:24:59
86 processes: 85 sleeping, 1 on cpu
CPU states: 98.5% idle, 0.0% user, 1.5% kernel, 0.0% iowait, 0.0% swap
Memory: 7168M phys mem, 120M free mem, 1500M swap, 1274M free swap
###
and the 120M free mem seems way out of place -
however, if you look at the vmstat 5 5 |tail -1 output (keeping my header lines)
$ vmstat 5 5 |tail -1
procsmemorypagedisk faultscpu
r b wswap free re mf pi po fr de sr s2 s7 s7 s8insycs us sy id
0 0 30 6503856 123160 0 0 0 0 0 0 0 0 0 0 1 828 127 216 0 0 100
there you see my "freemem" value
ftp://ftp.sunfreeware.com/pub/freeware/sparc/9/top-3.6.1-sol9-sparc-local.gz
Try downloading top for Solaris 9 if this is for a Solaris 9 machine. If your OS isn't 2.9, then please let us know which version we're actually talking about
thanks! - jeff
Message was edited by: jeff
jeffrey.s
I'm not sure why you say 'top' is broken when you show that it and 'vmstat' print the same information.
The VM system changed significantly between Solaris 7 and Solaris 8. Prior to 8 the UFS disk cache counted against the free list. So all I/O reduced memory, and then the page scanner had to run to clean it up. This scales horribly. The scanner has to do more work the more RAM you have, and it limits the amount of I/O you can do. On such a system, the amount of free RAM shown will tend to remain in one place (the value of LOTSFREE or, if you have priority paging enabled, CACHEFREE).
With Solaris 8, a separate list of cache pages is kept. Because it can be quickly purged and used for other purposes, it is counted as 'free' memory. In addition, the page scanner no longer has to run if the only thing requiring additional memory is the disk cache. Instead the cache list just throws things off the back end.
All of these changes should be visible in both 'top' and 'vmstat' for free memory views.
Due to the age, I now assume anyone not explicitly mentioning a version is now running on Solaris 8 or later.
--
Darren
even though - in my 2.6 example vmstat and top match their "freemem" - doesn't mean it's the reporting the same thing as on a 2.8/2.9 vmstat/top output of freemem. We're saying the same thing - the VM system information has greatly changed what is being reported 2.8 and later.
The example from the original post - to me - looks like it's pre 2.8 based on similar results on an older platform machine - even though they didn't explictly state version in their post - jeff
I guess I was questioning your choice of saying that 'top' isn't reporting correctly. It sounded like you were saying that specific utility as opposed to others was giving incorrect values.
I also didn't think the OP has such a system. The first message mentions having having 13G of RAM free and almost no swap free. Unless those numbers were reversed in the post, then that's not what I would expect from a pre-8 machine at equilibrium.
--
Darren