How is Memory Utilization calculated in SUN Solaris server?

How is Memory Utilization calculated in SUN Solaris server?

Memory Calculation

We run the below command to check if the SUN server is a zone-supported server: 

/usr/bin/prstat -n 1 -Z 1 1 2> /dev/null|grep -v "PID"|grep -v "Total:"

 If the command gives the proper output then we conclude that the server is Zone supported and we find the Memory Utilization by using it.

Here is a Sample Output :
79 daemon     15M 5428K sleep   59    0   0:36:51 0.0% kcfd/4
ZONEID    NPROC  SWAP   RSS MEMORY      TIME  CPU ZONE
0       66  514M  201M   1.1%   1:59:44 0.0% global

Physical Memory Utilization (MB) : 201M

 

Physical Memory Utilization (%) :  1.1%


where,

Physical Memory utilization (MB) = (Line 3, Token 4) = 201MB

Physical Memory utilization (%) = (Line 3, Token 5) = 1.1%


If the command output not meet our criteria we conclude that the server is normal SUN Solaris server and we use the following way to find the memory Utilization:
/usr/sbin/swap -l|awk '{TOT+=$4} {FREE+=$5} END {print "total: "TOT " used: " TOT-FREE}';/usr/sbin/prtconf|grep Memory;vmstat 1 3;kstat zfs:0:arcstats:size | grep size|tr -s ' ' ''|tr -s '\t' '^'


Here is a Sample Output :

               total: 4194296  used: 0

               Memory size: 16372 Megabytes

               kthr      memory            page            disk          faults      cpu

               r b w   swap  free  re  mf pi po fr de sr s0 -- -- --   in   sy   cs us sy id

               0 0 0 14939532 14938784 89 334 0 0 0 0  0  3  0  0  0  858  440  312  0  0 100

               1 0 0 14583028 14581684 284 1589 0 0 0 0 0 0  0  0  0  694 2483  264  1  0 99

               0 0 0 14582152 14580824 0 36 0 0  0  0  0  0  0  0  0  690  216  244  0  0 100

               ^size                            979216592        

 

Physical Memory Utilization (MB) : (((Total Physical Memory * 1024 *1024) - ((Free Physical Memory * 1024) + ZFSCache)) / (1024 * 1024)))

 

Physical Memory Utilization (%) :  Physical Memory Utilization (MB) * 100 / Total Physical Memory

where,

                Total Physical Memory = (Line 2, Token 3) = 16372 (MB)

                Free Physical Memory = (Line 7, Token 5) = 14580824 (KB)

                ZFSCache = (Line 8, Token 2) = 979216592 (Bytes)

       

Swap Memory Utilization (in MB) : Used Swap Memory / (2*1024)

 

Swap Memory Utilization (%) : (Swap Memory Utilization (MB) * 100) / (Total Swap Memory / (2*1024))

where,

               Total Swap Memory = (Line 1, Token 2) = 4194296 (512 bit block)

               Used Swap Memory = (Line 1, Token 4) = 0 (512 bit block)