Help on Understanding Swap Size

Hi All,

I want to know how to understand the actual swap size.

My o/p shows as below

root@ecovs1a # swap -s
total: 4546056k bytes allocated + 358856k reserved = 4904912k used, 5046688k available
root@ecovs1a # swap -l
swapfile             dev  swaplo blocks   free
/dev/md/dsk/d31     85,31     16 8395184 8395184
root@ecovs1a # df -hk
Filesystem             size   used  avail capacity  Mounted on
/dev/md/dsk/d30         63G    38G    25G    61%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   4.8G   1.5M   4.8G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/platform/sun4u-us3/lib/libc_psr/libc_psr_hwcap1.so.1
                        63G    38G    25G    61%    /platform/sun4u-us3/lib/libc_psr.so.1
/platform/sun4u-us3/lib/sparcv9/libc_psr/libc_psr_hwcap1.so.1
                        63G    38G    25G    61%    /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   4.8G   1.4M   4.8G     1%    /tmp
swap                   4.8G    48K   4.8G     1%    /var/run
root@ecovs1a #

If I consider the swap -s command i find my used space to be around 40%..However in the subsequent commands I find my available space to be arround 98%..Please help me to understanding how to find exact swap usage and exact swap memory available for processes.

swap isn't a filesystem -- it holds no files -- so df doesn't return sensible answers for it. On some systems it's not even listed.

thanks for ur prompt answer dude...but all I want to know how to understand it?..How to know whats my total swap size and whats my available swap space??..normally we consider as 50% of swap file should be available for smooth operation of applications on the node..So how can I determine the same?

You should define what you expect swap to mean. As far as Solaris is concerned, this can be the on disk swap area, the whole virtual memory or a file system (a.k.a. tmpfs).

  • Your swap area size is 4 GB
  • Your total virtual memory size is around 10 GB, half of which been free. You have at least 6 GB of RAM but possibly much more.
  • The various file systems backed by swap are using a negligible part of virtual memory.

There is no straight relationship between how much swap is used and a system performance. If you want the latter, just make sure you have enough RAM to avoid pagination. If you want your applications not to crash, have enough swap for all memory allocation and reservations to easily fit. Memory allocations do like RAM, memory reservations are fine with on disk swap.

---------- Post updated at 22:59 ---------- Previous update was at 22:48 ----------

In the df output context, swap is a file system (a.k.a tmpfs) holding files about which sensible numbers are reported. However, you are correct df isn't the right command to investigate memory usage.

Thanks for your reply dude,In my operations swap memory is used for processes to run..Moreover we dont have any RAM on our node..Swap memory is used instead of Node..The o/p given above is of a voucher server (IN system).
As per our ZLD,if

swap -s

command provides o/p of availabe space=used space,everything if fine...what does this mean?..

Processes use virtual memory only. When they access it, it's on RAM.

What are you calling a "node" here ? In any case, Solaris doesn't run without RAM.

??

No idea about what you are describing/asking here. Please clarify.

Just I wanted to know whats my total available swap space,whats the used up swap space and whats the total swap size of my server...Please also provide the calculations how to calculate it?

root@ecovs1a # swap -s
total: 4546056k bytes allocated + 358856k reserved = 4904912k used, 5046688k available

available swap space = 5046688k
used swap space = 4904912k
total swap size = 9951600k (sum of the previous numbers).

So that means only the o/p from "

swap -s

" should be used for swap calculation..
Then please also let me know what

swap -l 

signifies?

root@ecovs1a # swap -l
swapfile             dev  swaplo blocks   free
/dev/md/dsk/d31     85,31     16 8395184 8395184

You physical swap area size is (8395184*512=) 4 GB, and it is currently not used, i.e. all memory allocations fit in RAM.

1 Like