New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Confused with RAM usage
I have CentOS 6.8 server with 12GB RAM and am confused with the RAM usage, it uses very minimal.
# free -m
total used free shared buffers cached
Mem: 12288 10978 1309 297 0 10723
-/+ buffers/cache: 254 12033
Swap: 2048 1559 488
If I am not mistaken, it's using only 254MB of ram, but using 3/4th of SWAP.
Just to make sure, I ran the munch script (http://www.linuxatemyram.com/play.html), and it allocated almost 12GB of ram.
Allocated 11809 MB
Allocated 11810 MB
Killed
The top command shows that it's using more than the 254MB.
I have vm.swappiness=0
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1609 root 20 0 622m 146m 856 S 0.0 1.2 0:06.12 clamd
23888 root 20 0 244m 78m 3648 S 0.0 0.6 0:00.79 spamd child
15608 mysql 20 0 5794m 66m 4824 S 0.0 0.5 0:30.10 mysqld
1628 root 20 0 231m 53m 5268 S 0.3 0.4 1:04.56 spamd
1540 root 20 0 82352 18m 440 S 0.3 0.2 0:01.21 config
17544 nobody 20 0 139m 15m 2048 S 0.0 0.1 0:07.75 httpd
21618 nobody 20 0 139m 15m 1824 S 0.0 0.1 0:00.09 httpd
22526 nobody 20 0 139m 14m 1852 S 0.0 0.1 0:00.05 httpd
16015 nobody 20 0 139m 14m 1628 S 0.0 0.1 0:08.30 httpd
15982 nobody 20 0 139m 14m 1628 S 0.0 0.1 0:18.00 httpd
22552 nobody 20 0 139m 14m 1680 S 0.0 0.1 0:00.09 httpd
16048 nobody 20 0 139m 14m 1620 S 0.0 0.1 0:08.27 httpd
22648 nobody 20 0 139m 14m 1896 S 0.0 0.1 0:07.89 httpd
15974 nobody 20 0 139m 14m 1564 S 0.0 0.1 0:09.75 httpd
17844 nobody 20 0 139m 14m 1660 S 0.0 0.1 0:08.89 httpd
16062 nobody 20 0 139m 13m 1748 S 0.0 0.1 0:10.43 httpd
22557 nobody 20 0 139m 13m 1716 S 0.0 0.1 0:00.04 httpd
21920 nobody 20 0 139m 13m 1748 S 0.0 0.1 0:00.10 httpd
15735 nobody 20 0 139m 13m 1380 S 0.0 0.1 0:00.35 httpd
22514 nobody 20 0 139m 13m 1772 S 0.0 0.1 0:00.07 httpd
16011 nobody 20 0 139m 12m 1556 S 0.0 0.1 0:10.35 httpd
15927 nobody 20 0 139m 12m 1552 S 0.0 0.1 0:00.26 httpd
23913 cpanelro 20 0 103m 12m 2988 S 0.0 0.1 0:00.01 webmaild - serv
22520 nobody 20 0 139m 11m 1656 S 0.0 0.1 0:00.03 httpd
15890 nobody 20 0 139m 11m 1540 S 0.0 0.1 0:21.77 httpd
16052 nobody 20 0 139m 10m 116 S 0.0 0.1 0:07.49 httpd
17281 nobody 20 0 139m 10m 184 D 17.0 0.1 0:12.72 httpd
21886 nobody 20 0 139m 10m 112 S 0.0 0.1 0:00.05 httpd
15984 nobody 20 0 139m 10m 112 S 0.0 0.1 0:07.68 httpd
17519 nobody 20 0 139m 10m 1588 S 0.0 0.1 0:00.37 httpd
15724 nobody 20 0 139m 10m 112 S 0.0 0.1 0:09.72 httpd
22519 nobody 20 0 139m 10m 112 S 0.0 0.1 0:00.03 httpd
15728 nobody 20 0 139m 9m 148 S 0.0 0.1 0:00.31 httpd
21601 nobody 20 0 139m 9.9m 112 S 0.0 0.1 0:09.83 httpd
22875 nobody 20 0 139m 9.9m 236 D 16.6 0.1 0:05.36 httpd
15825 nobody 20 0 139m 9.9m 112 S 0.0 0.1 0:10.98 httpd
22741 nobody 20 0 139m 9.9m 232 D 16.0 0.1 0:05.34 httpd
17618 nobody 20 0 139m 9.8m 176 D 17.3 0.1 0:33.77 httpd
16010 nobody 20 0 139m 9.8m 176 D 16.3 0.1 0:15.74 httpd
15742 nobody 20 0 139m 9.8m 148 S 0.0 0.1 0:07.50 httpd
21598 nobody 20 0 139m 9972 148 S 0.0 0.1 0:00.09 httpd
22783 nobody 20 0 139m 9968 116 S 0.0 0.1 0:00.09 httpd
17845 nobody 20 0 139m 9960 116 S 0.0 0.1 0:07.87 httpd
15976 nobody 20 0 139m 9940 112 S 0.0 0.1 0:10.70 httpd
22773 nobody 20 0 139m 9932 116 S 0.0 0.1 0:00.06 httpd
22774 nobody 20 0 139m 9932 120 S 0.0 0.1 0:07.65 httpd
22780 nobody 20 0 139m 9928 116 S 0.0 0.1 0:00.06 httpd
22844 nobody 20 0 139m 9928 116 S 0.0 0.1 0:00.07 httpd
17295 nobody 20 0 139m 9924 112 S 0.0 0.1 0:08.82 httpd
17590 nobody 20 0 139m 9924 116 S 0.0 0.1 0:15.25 httpd
18380 nobody 20 0 139m 9924 152 S 0.0 0.1 0:00.27 httpd
22571 nobody 20 0 139m 9924 112 S 0.0 0.1 0:07.81 httpd
Do you think there's some stuff wrong with my server? Why is it using swap when there's 12GB of free RAM.
Comments
Hello,
To me and according to your #free command near 11 Gb ram is used.
Did you disable swap before running that munch test (as instructed)? Were you using swap before running it, or only after?
I don't see that as you didn't post the header info from top. You can't simply add up the columns and get the amount of ram used. Many of those items are threads and reflect the same ram usage.
Either you had swap enabled and ran munch, or some of your processes are using large amounts of ram for a short time, causing your system to swap, and then settle down.
Nope: http://www.linuxatemyram.com
you may need to adjust /proc/sys/vm/swappiness if you don't want the kernel to swap the less used memory in a favour of system page cache.
As a provider you should know how to read free -m ....
Just Linux being Linux. Nothing to sweat about it. You are way way under your limit.
@raindog308 @ATHK technically what i said is not false 11 Gb is used but is also available for applications.
Where i am wrong in the end is more because i did not answer to the OP questioning
10978MB used but 10723MB are for caching so in reality just 254MB used.
total used free shared buffers cached
Mem: 12288 10978 1309 297 0 10723
-/+ buffers/cache: 254 12033
And unless you set swap = 0 Linux won't use swap, then even with swappiness=0 it will still try to allocate disk swap, normal behaviour.
10978 Ram is used
No 10978 is cached the ops total memory usage is read from
-/+ buffers/cache: 254 12033
Which will indicate that the os is currently using 254 mb of ram and there is 12033 'free'
Op I'd recommend installing htop as it will give you a clear idea of how much memory you are using but you are correct in thinking you are using 254 mb don't worry some much about virtual memory.
Try reboot it once.
For what effect?
You ran the script with swap enabled.
Linux moved other processes stuff to swap because you were asking for more ram.
The script was killed after linux didn't found a way to give you more ram.
Linux won't move back that processes to ram, until you need their memory pages, because is IO expensive to do that.