Swap puzzle


 
Thread Tools Search this Thread
Operating Systems Solaris Swap puzzle
# 1  
Old 03-19-2012
Swap puzzle

I'm getting confused by swap
Code:
# 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

Code:
# 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

Last edited by DukeNuke2; 03-20-2012 at 06:38 PM..
# 2  
Old 03-19-2012
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.
# 3  
Old 03-19-2012
Quote:
Originally Posted by Corona688
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 ----------

Quote:
Originally Posted by redstone
I'm getting confused by swap

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

Code:
prstat -Z

and
Code:
echo ::memstat | mdb -k 

commands.

Last edited by jlliagre; 03-21-2012 at 11:58 AM..
These 2 Users Gave Thanks to jlliagre For This Post:
# 4  
Old 03-20-2012
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.

Code:
# 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



Code:
# 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


Code:
# 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.

Moderator's Comments:
Mod Comment That is why I just put code tags on your output. Please do that in the future

Last edited by jim mcnamara; 03-20-2012 at 06:02 PM..
# 5  
Old 03-20-2012
Please use code tags to make your command outputs readable.
# 6  
Old 03-21-2012
Oh. Didn't know about code tag. thanks... it looks much better.
# 7  
Old 03-21-2012
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Another sed Syntax Puzzle . . .

Greetings! Have a quick question for the community today; this time looking at a nifty little sed puzzle ;) Consider the following file content to be worked through:What needs to happen is theblock should be removed up to and including the following blank line, leavingI have bits and pieces... (8 Replies)
Discussion started by: LinQ
8 Replies

2. Solaris

Explain the output of swap -s and swap -l

Hi Solaris Folks :), I need to calculate the swap usage on solaris server, please let me understand the output of below swap -s and swap -l commands. $swap -s total: 1774912k bytes allocated + 240616k reserved = 2015528k used, 14542512k available $swap -l swapfile dev swaplo... (6 Replies)
Discussion started by: seenuvasan1985
6 Replies

3. UNIX for Advanced & Expert Users

Chroot jail environment puzzle

I have a simple sandbox program which runs a command as user "nobody" in a chroot jail. It sets resource limits with setrlimit, changes the user id with setuid, changes the root dir with chroot, and then calls exec to execute the command given as command line parameters. It is of course a... (8 Replies)
Discussion started by: john.english
8 Replies

4. Programming

The puzzle for malloc some spaces for a key

Hi, all, I am writing a BST (Binary Search Tree). What I am concerned about is typedef struct BST{ struct BST *p_left; struct BST *p_right; void *p_data; char *p_key; unsigned int *length; }BST; I have to malloc some space for p_key. How many of chars... (4 Replies)
Discussion started by: mythmgn
4 Replies

5. IP Networking

Puzzle about sctp_bindx in UNP

It writes in Section 9.3 in Unix Network programming about SCTP: "The sctp_bindx call can be used on a bound or unbound socket." And then it writes: "The port number in all the socket address structures must be the same and must match any port number that is already bound; if it doesn't, then... (0 Replies)
Discussion started by: tomdean001
0 Replies

6. HP-UX

Swap device file and swap sapce

Hi I have an integrity machine rx7620 and rx8640 running hp-ux 11.31. I'm planning to fine tune the system: - I would like to know when does the memory swap space spill over to the device swap space? - And how much % of memory swap utilization should be specified (swap space device... (6 Replies)
Discussion started by: lamoul
6 Replies

7. Linux

It's a puzzle

Hi, Recently I installed Fedora 9 on the following hardware - Asus A8N-SLI Deluxe motherboard bios version 1805 - 2GB twinmos ram - AMD 4400 CPU - Tagan PSU 550 W - Asus EN6200LE video card - WD 74 GB Raptor - Areca ARC-1222 raid controller - 4x 1TB Seagate Baracudas - Symbios Logic... (6 Replies)
Discussion started by: jwoude
6 Replies

8. Shell Programming and Scripting

Alias escape puzzle

Here is "escape puzzle" from real life task: Conditions: We need to create an alias which will Save current directory path Will ssh to particular server Then will cd to saved path (it's mounted via NFS) Then will find all files with name patter as "All*.bld" and run particular editor... (0 Replies)
Discussion started by: BaruchLi
0 Replies
Login or Register to Ask a Question