1

I dont understand this. When free -m show this:

             total       used       free     shared    buffers     cached
Mem:         15334      14025       1308          0        258      10918
-/+ buffers/cache:       2848      12485
Swap:          953          0        953

Does it mean I've got 1.4GB Free as per line 1 or 12GB Free as per Line 2?

I have Linux + Nginx + php-fpm + Mysql + Memcached

EDIT:

I understand that the 1.3GB is the free unused memory but if we remove the buffer usage, I actually have 12GB of Free memory on my vps. Does it mean that 16GB for my vps is way too much than what I need and I am wasting it on a big machine since it has 12GB free? Or looking at Line 1, do I take it as since the buffer is using a lot memory which means my machine still benefits from a lot of ram since buffer usage means faster response?

migrated from webmasters.stackexchange.com Feb 3 '15 at 18:45

This question came from our site for pro webmasters.

3

The first line shows the memory usage considering (adding) the cache and buffers i.e. portion of the memory used for caching data or buffering I/O.

On the other hand the second line is showing the memory usage not considering (deducting) the cache and buffers.

Now you may wonder what if a new process needs more memory than showing in the first line i.e. considering cache/buffers, in that cache the oldest data in the cache will be cleared to make room for the newest process. So, you don't have to worry about the huge space taken up for caching/buffering.

Answer to the Edit:

More caching means faster response. So, unless it is absolutely bugging you, you are good with this.

  • Thank you @heemayl What I am wondering is, am I wasting by getting 16GB for my vps since based on Line 2 it appears I only actually be using about 2GB ram out of the 16GB? Have updated my question. – Neel Feb 3 '15 at 18:57
  • @blackops_programmer:added. – heemayl Feb 3 '15 at 19:01
  • Awesome! Thank you for that. I looked at Line 1, panicked and upgraded 8GB ram to 16GB Ram. But only now I saw the 2nd line and I was kicking myself thinking I made a big rookie mistake. Since it now appears my site is still benefiting from the 12GB Buffer Ram usage, I am feeling a bit relieved. Thank you heemayl – Neel Feb 3 '15 at 19:09
  • @blackops_programmer: happy to help :) – heemayl Feb 3 '15 at 19:11
0

I would suggest checking out the man page for free (see excerpt below):

# man free

NAME
       free - Display amount of free and used memory in the system

SYNOPSIS
       free [options]

DESCRIPTION
       free displays the total amount of free and used physical and swap memory in the system, as well as the buffers and caches used by the kernel. The information is gath‐
       ered by parsing /proc/meminfo. The displayed columns are:

       total  Total installed memory (MemTotal and SwapTotal in /proc/meminfo)

       used   Used memory (calculated as total - free)

       free   Unused memory (MemFree and SwapFree in /proc/meminfo)

       shared Memory used (mostly) by tmpfs (Shmem in /proc/meminfo, available on kernels 2.6.32, displayed as zero if not available)

       buffers
              Memory used by kernel buffers (Buffers in /proc/meminfo)

       cached Memory used by the page cache  (calculated as Cached - Shmem in /proc/meminfo - the Cached value is actually the sum of page cache and tmpfs memory)
  • Just saying "read the docs" seems not very helpful. – guntbert Jul 21 '16 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.