Vmstat.snapshot.memory different from free
Closed this issue · 9 comments
@threez I had gone through that but I couldn't get the fact that how is there so much difference? Also how can I compute the total memory? Also why does the values differ so much from vmstat-s
Does this help you? #24 (comment)
It depends on what you want so way, I know that is not helpful ;-). If you are on linux you may want to use available to check on the available memory, on most other operating systems you may want to ((wired + active + inactive).to_f / total) * 100.0 to get use memory or use (free.to_f / total) * 100.0 for free.
I'm on azure ubuntu 18 VM, I was trying to figure out the total memory. From the ruby library I've got close to only 12gb(adding active+wired+inactive+free) where as from vmstat -s
and free -m
its 47gb 😕
What system are you working with?
Ror application with redis server set up on szure ubuntu vm.With htop there is 27gb free m/y available, 18gb used by redis
Could you provide the contents of /proc/meminfo
that is the infomration that is used to provide you with the memory details.
cat /proc/meminfo
MemTotal: 32916912 kB
MemFree: 27821984 kB
MemAvailable: 29327948 kB
Buffers: 213048 kB
Cached: 1535592 kB
SwapCached: 0 kB
Active: 3297804 kB
Inactive: 986192 kB
Active(anon): 2535864 kB
Inactive(anon): 1076 kB
Active(file): 761940 kB
Inactive(file): 985116 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 996 kB
Writeback: 0 kB
AnonPages: 2528852 kB
Mapped: 184160 kB
Shmem: 1596 kB
KReclaimable: 233736 kB
Slab: 437576 kB
SReclaimable: 233736 kB
SUnreclaim: 203840 kB
KernelStack: 9376 kB
PageTables: 17604 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 16458456 kB
Committed_AS: 4609044 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
Percpu: 89088 kB
HardwareCorrupted: 0 kB
AnonHugePages: 2232320 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 0 kB
DirectMap4k: 268224 kB
DirectMap2M: 8120320 kB
DirectMap1G: 27262976 kB
free -m
Vmstat.snapshot.memory
That looks fine to me, did you notice that there are functions for #total_bytes
#free_bytes
and the like on memory? See the documentation https://www.rubydoc.info/gems/vmstat/2.3.1/Vmstat/Memory