Oracle Linux: How to Calculate Memory Usage
APPLIES TO
Linux x86-64
Oracle Cloud Infrastructure
GOAL
This document describes how to calculate Linux memory usage.
SOLUTION
1. Calculate memory usage using SAR
$ sar -r 1 10 ... 09:54:56 AM kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit 09:54:57 AM 193624 7784500 97.57 389504 2280488 9644972 60.44 09:54:58 AM 193608 7784516 97.57 389504 2280456 9644972 60.44 09:54:59 AM 193312 7784812 97.58 389504 2280504 9644972 60.44 09:55:00 AM 193204 7784920 97.58 389508 2281068 9645356 60.45 09:55:01 AM 132436 7845688 98.34 389508 2281356 9659980 60.54 09:55:02 AM 127380 7850744 98.40 389516 2281440 9659520 60.53 09:55:03 AM 126976 7851148 98.41 389516 2281068 9659036 60.53 09:55:04 AM 126308 7851816 98.42 389516 2281068 9659036 60.53 09:55:05 AM 126744 7851380 98.41 389516 2281092 9657976 60.52 09:55:06 AM 187128 7790996 97.65 389516 2281092 9656576 60.52 Average: 160072 7818052 97.99 389511 2280963 9653240 60.49
To calculate free memory from Average value do:
kbmemfree + kbbuffers + kbcached = actual free memory on the system
Using above example:
160072 + 389511 + 2280963 = 2830546KB thats around 2.69GB free memory.
2. Calculate memory usage using free command
$ free -m total used free shared buffers cached Mem: 7791 7623 167 0 380 2227 -/+ buffers/cache: 5016 2775 Swap: 7791 655 7136
From above example, to get free memory on the system use: -/+ buffers/cache - free column
Tagged:
1