View memory usage in centos
In Linux, the free command is generally used to view the memory usage. The parameter-M is used to display the content in MB. This content is actually exquisite. For example:
The content is divided into three n columns. The first row indicates the overall memory usage, and the second row indicates the usage of memory-/+ buffers/cache, the third row indicates the usage of swap partitions. Each column shows the usage of each category. The total column indicates the total memory size, used column indicates the number of memory in use... and so on. We need to focus on the second line. 2564 in the used column of the second row indicates the number of memory in use-the memory after buffers-Cache (that is, used-Buffers-cache in each row), 1388 in the free column of the second row, indicates the number of available memory + buffers + cache memory (that is, free + buffers + cache in the first line). Therefore,
The actual memory used by the server is 2564 MB, and the memory not used is 1388 MB.! Why? We know that buffer and cache are the Cache Technology in Linux. What are the differences between these two caches? I am not very clear about them as long as I know that they are all used for caching. The number of memory in each column in the first row is reflected by the system. For the system, the buffer and cache are allocated memory, so they belong to used (used ); the memory of each column in the second row is not the same. They are the memory size after-/+ buffer/cache. For programs, both buffer and cache are available memory, because they are designed as pre-allocated memory to improve performance, they are all available, that is, free. Therefore, the used-buffer-cache in the first row gets the number in the used column in the second row, which is the memory actually used by the program; and the free + buffer + cache in the first row, the number in the free column in the second row is obtained, which is the memory that can be used by the program.