How Linux servers view memory, free up memory and cache

Source: Internet
Author: User

1. Use the DF-HL command to see if the mounting space is sufficient;

2. Use the top command to view memory operation;

You should also use the FREE-M command:

[Email protected] ~]# free-m
Total used free shared buffers Cached
mem:2013 1661 352 0 223 1206
-/+ buffers/cache:231 1782
swap:2047 0 2047

3. Use the Sync command to write the cache to the file;

[[Email protected] test]# Sync

Perform the sync command manually (description: Sync command runs the Sync subroutine. If you must stop the system, run the Sync command to ensure the integrity of the file system. The Sync command writes all the non-writable system buffers to disk, including modified I-node, deferred block I/O, and read-write mapping files.

To free Pagecache, use
echo 1 >/proc/sys/vm/drop_caches;
To free dentries and inodes, use
echo 2 >/proc/sys/vm/drop_caches;
To free Pagecache, dentries and inodes, use
Echo 3 >/proc/sys/vm/drop_caches.

The default is 0,1 to empty the page cache, 2 for emptying the inode and the directory tree cache, and 3 for emptying all caches.

View:

[Email protected] ~]# cat/proc/sys/vm/drop_caches

4, redundant data timely deletion, production data backup;

Test
[Email protected] ~]# uname-a
Linux testserver 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT x86_64 x86_64 x86_64 gnu/linux

[Email protected] ~]# free-m
Total used free shared buffers Cached
mem:2013 1661 352 0 223 1206
-/+ buffers/cache:231 1782
swap:2047 0 2047

[[Email protected] ~]# Sync
[[Email protected] ~]# Sync
[Email protected] ~]# cat/proc/sys/vm/drop_caches
0
[Email protected] ~]# echo 3 >/proc/sys/vm/drop_caches
[Email protected]er ~]# cat/proc/sys/vm/drop_caches
3
[Email protected] ~]# free-m
Total used free shared buffers Cached
mem:2013 100 1913 0 0 14
-/+ buffers/cache:85 1927
swap:2047 0 2047
[Email protected] ~]#

How Linux servers view memory, free up memory and cache

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.