I'm getting confused by swap
# swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 256,2 16 16777200 16777200
/dev/zvol/dsk/swappool/swap2 256,1 16 50331632 50331632
# swap -s
total: 6710256k bytes allocated + 3402944k reserved = 10113200k used, 25553936k available
From the -l command, I see swap space is totally free, not allocated. But from -s command, there are about 10G of swap space is being allocated.
So how to read it.
Plus, when I run top command on the system, I got 0.0% swapping.
Thanks
All memory is backed by swap whether it's needed right this moment or not. So the swap space isn't actually being used at present -- but if memory became short, everything already has preallocated locations in swap to get dumped into.
That used to be the way swap was handled with SunOS 4 but it is no more with Solaris 2 and newer. While it is still recommended to have some swap set, a swap area isn't technically required on Solaris.
---------- Post updated at 22:47 ---------- Previous update was at 22:25 ----------
You need to know that swap means two different concepts here.
"swap -l" shows the size of the swap area, i.e. a dedicated storage area where the OS can paginate memory pages from/to RAM.
Your swap area size is 32 GiB and all free.
"swap -s" shows virtual memory statistics.
You virtual memory size is 34 GiB, this includes 32 GiB of swap area plus 2 GiB of RAM. The command tells 6.7 GiB are really allocated as reserved memory doesn't use RAM or swap.
There is then a contradiction between both of these commands.
Can you re-run both of these commands and post also the last lines of
prstat -Z
and
echo ::memstat | mdb -k
commands.
2 Likes
Let me describe more detail on my server in order for better understanding.
This is one of the DB node in Oracle RAC which is an guest domains.
20G of physical memory is allocated to this domain.
8G + 25G of swap space as you can see from the swap -l command
As Jlliagre's request, I'm posting prstat and mdb command output.
# swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 256,2 16 16777200 16777200
/dev/zvol/dsk/swappool/swap2 256,1 16 50331632 50331632
# swap -s
total: 6713584k bytes allocated + 3409144k reserved = 10122728k used, 24978216k available
# prstat -Z
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
1347 root 103M 63M sleep 59 0 49:01:38 1.8% orarootagent.bi/25
1351 grid 85M 49M sleep 59 0 13:14:41 0.5% gipcd.bin/10
1789 root 89M 47M sleep 59 0 8:40:17 0.3% orarootagent.bi/11
1369 root 81M 44M sleep 159 - 7:19:33 0.3% osysmond.bin/11
1395 grid 104M 60M sleep 100 - 6:23:39 0.2% ocssd.bin/28
2276 oracle 96M 74M sleep 59 0 4:08:18 0.2% oraagent.bin/15
1654 root 132M 88M sleep 59 0 3:15:51 0.1% crsd.bin/47
1314 grid 103M 68M sleep 59 0 3:01:18 0.1% oraagent.bin/29
1471 root 71M 35M sleep 59 0 3:00:18 0.1% octssd.bin/12
711 root 153M 115M sleep 59 0 2:32:56 0.1% ohasd.bin/35
2356 oracle 8410M 2848M sleep 59 0 3:11:19 0.1% oracle/1
1794 grid 104M 78M sleep 59 0 2:23:41 0.1% oraagent.bin/21
5 root 0K 0K sleep 99 -20 1:23:15 0.1% zpool-rpool/166
1612 grid 477M 296M sleep 59 0 2:30:00 0.1% oracle/1
2362 oracle 8411M 2853M sleep 101 - 1:22:00 0.0% oracle/1
2366 oracle 8411M 2849M sleep 101 - 1:22:43 0.0% oracle/1
1406 root 149M 43M sleep 159 - 1:21:22 0.0% ologgerd/7
1485 grid 83M 47M sleep 59 0 1:14:26 0.0% evmd.bin/18
1614 grid 474M 289M sleep 59 0 1:01:04 0.0% oracle/1
1618 grid 479M 284M sleep 101 - 0:57:45 0.0% oracle/1
1382 root 75M 33M sleep 100 - 0:45:50 0.0% cssdagent/23
ZONEID NPROC SWAP RSS MEMORY TIME CPU ZONE
0 163 9871M 10G 50% 126:52:51 4.7% global
Total: 163 processes, 1076 lwps, load averages: 0.91, 0.93, 0.91
# echo ::memstat | mdb -k
Page Summary Pages MB %Tot
------------ ---------------- ---------------- ----
Kernel 340174 2657 13%
ZFS File Data 913853 7139 36%
Anon 841128 6571 33%
Exec and libs 66941 522 3%
Page cache 16344 127 1%
Free (cachelist) 9857 77 0%
Free (freelist) 380902 2975 15%
Total 2569199 20071
Physical 2553055 19945
I still don't quite get what allocated and reserved really means from "swap -s" command.
Thanks.
---------- Post updated at 11:58 AM ---------- Previous update was at 11:54 AM ----------
It's not easy to read the output of some commands as the layout was changed. I wish I could post them with the original format.
Please use code tags to make your command outputs readable.
Oh. Didn't know about code tag. thanks... it looks much better.
Okay, so you have 20 GB or RAM of which 10 GB is virtual, not kernel memory. You really use 6.7 GB so the swap area is not used.