How To Calculate SAR and VMSTAT Memory Values: Ksar Graphical Tool
How To Calculate SAR and VMSTAT Memory Values: Ksar Graphical Tool
values
Most of the UNIX beginners are very confused with sar and vmstat outputs.In most of the occasion they
are not able to determine the free memory and free swap in order to find the memory bottleneck.Not
all the time top command will give right values. Ksar graphical tool also very useful to analysis
bottleneck.
SAR:
Now we will see how to calculate free memory and swap
Formula:
Free memory in GB= freemem*pagesize/1024/1024/1024
Free swap in GB=freeswap*512/1024/1024/1024
To find the page size value,
[root@wSolarisN ~]# pagesize
8192
FYI:In x86 pagesize value is 4k and in SPARC its 8k.
As per the above commands output,
Free memory in GB =6917436*8192/1024/1024/1024=52.77GB
Free swap in GB=89634194*512/1024/1024/1024=42.74GB
[root@solarisN~]# sar -r 5 5
SunOS SolarisN 5.10 Generic_147440-09 sun4v
03/12/2013
6917436 89634194
VMSTAT:
vmstat will provide the free memory and free swap in KB .So its very easy to calculate unlike the SAR
values.
Formula:
Free memory in GB=value/1024/1024
Free swap in GB=value/1024/1024
Free swap in GB=44905096/1024/1024=42.82GB
Free memory in GB=55305768/1024/1024=52.74GB
[root@solarisN ~]# vmstat 5 5
kthr
r b w
memory
swap
free
page
re
disk
faults
mf pi po fr de sr m1 m1 m1 m2
in
sy
cpu
cs us sy id
6 0 0 96425064 87221048 18 63 10 0 0 0
4 81
921
923
908
0 98
1 0 0 44907344 55306816 1 6 0
961 1254
954
0 99
3 0 0 44854688 55307016 1 1 0
945 1216
936
0 99
13 0 0 44912064 55312408 1 2 0 0
944 1221
943
0 99
1 0 0 44905096 55305768 1 2 0
969 1274
966
0 99