What is cacheMemory in linux? When you read and write files, the Linux kernel caches the files in the memory to improve the read and write performance and speed. this part of the memory is CacheMemory ). CacheMemory will not be automatically released even after your program runs. This will cause your program to read and write files frequently in Linux, and you will find that there is very little available physical memory. In fact, this cache memory (Cach
What is cache Memory in linux? When you read and write files, the Linux kernel caches the files in the Memory to improve the read and write performance and speed. this part of the Memory is Cache Memory ). The Cache Memory will not be automatically released even after your program runs. This will cause your program to read and write files frequently in Linux, and you will find that there is very little available physical memory.
In fact, this Cache Memory will be automatically released when you need to use the Memory, so you do not have to worry about no Memory available. You can also manually release the Cache Memory.
You can run the following command to view the memory Status:
Method 1:
[Root @ sky9896/] # more/proc/meminfo
MemTotal: 1921696 kB # total physical memory
MemFree: 106016 kB # idle memory
Buffers: 176380 kB # cache, mainly used for directories
Cached: 696016 kB # cache for opened files
SwapCached: 33176 kB # swap cache
......
Method 2:
[Root @ sky9896/] # free-m
Total used free shared buffers cached
Mem: 1876 1723 152 0 173 618
-/+ Buffers/cache: 931 944
Swap: 2023 138 1885
Note:
Total: total physical memory
Used: memory used
Free: completely unused memory
Shared: Application shared memory
Buffers: cache, mainly used for directories, inode values, etc.
Cached: cache for opened files
-Buffers/cache: memory size used by the application, used minus the cache value
+ Buffers/cache: memory size available for all supply applications, free plus cache value
Where:
Total = used + free
-Buffers/cache = used-buffers-cached, which is the actual memory size used by the application (931 mb)
+ Buffers/cache = free + buffers + cached, which is the actual available memory size of the server (944 MB)
Method 3: cache memory monitored by cacti. the cache is full.
The following method is used to clean up, that is, to execute two commands.
[Root @ sky9896/] # sync # prevent data loss
[Root @ sky9896/] # echo 1>/proc/sys/vm/drop_caches # release the page cache
[Root @ sky9896/] # echo 2>/proc/sys/vm/drop_caches # release directories and nodes
[Root @ sky9896/] # echo 3>/proc/sys/vm/drop_caches # clear all caches
After Execution, check the memory status as follows:
[Root @ sky9896/] # free-m
Total used free shared buffers cached
Mem: 1876 756 1119 0 0 36
-/+ Buffers/cache: 719 1156
Swap: 2023 138 1885
Cached memory monitored by cacti, which is reduced from 619.46M to 62.36 M
Note: The linux cache is cleared manually.