View memory usage in centos

Source: Internet
Author: User

Free
Total used free shared buffers cached
Mem: 1815340 1628680 186660 0 130316 1327736
-/+ Buffers/cache: 170628 1644712
Swap: 1020116 0 1020116
Mem: physical memory statistics
-/+ Buffers/cached: indicates the cache statistics of physical memory.
Swap: indicates the usage of swap partitions on the hard disk.
Total physical memory of the system: 1815340kb (2 GB). However, the actual available memory of the system is not 186660kb marked as free in the first line. It only indicates the unallocated memory.

Row 3 mem:
Total: total physical memory. 1815340
Used: indicates the total quantity allocated to the cache (including buffers and cache), but some of the caches are not actually used. 1628680
Free: unallocated memory. 186660
Shared: shared memory, which is generally not used by the system and will not be discussed here. 0
Buffers: Number of buffers allocated by the system but not used. 130316
Cached: Number of cache allocated by the system but not used. 1327736 the difference between buffer and cache is described later.

Total = used + free

Row 3-/+ buffers/cached:
Used: Used-Buffers-cached in the first line is also the total memory used.
Free: The sum of unused buffers, cache, and unallocated memory. This is the actual available memory of the system. Free 2 = buffers1 + cached1 + free1 // free2 indicates the second row, and buffers1 indicates the first row.

Difference between buffer and Cache
A buffer is something that has yet to be "written" to disk. A cache is something that has been "read" from the disk and stored for later use row 3rd: the third row refers to from the application perspective, for applications, buffers/cached is equivalent to available, because buffer/cached is used to improve file read performance. When the application needs to use the memory, buffer/cached will be quickly recycled.
From the application perspective, the available memory = system free memory + buffers + cached.

Next, we will explain when the memory will be exchanged and by which side.
When the available memory is less than the rated value, a meeting will be held for exchange.
Rating:
# Cat/proc/meminfo
Switching reduces the number of physical pages used in the system in three ways:
1. Reduce the buffer and page cache size,
2. swap out the V-type memory page of the system,
3. Swap out or discard the page. (The Memory Page occupied by the application, that is, the physical memory is insufficient ).
In fact, using swap in a small amount affects the system performance.

The following is the difference between buffers and cached.
Buffers is the buffer size for Block devices. It only records the metadata and tracking in-flight pages of the file system.
Cached is used to buffer files.
That is to say: buffers is used for storage. What content and permissions are contained in the directory.
Cached is used directly to remember the files we opened. If you want to know whether the files take effect, you can try and execute two commands one by one # Man X, you can obviously feel that the second start is much faster.
Experiment: it is obvious on a machine with no application. Remember that the experiment can only be performed once. If you want to do more, change the file name.

Use the following command to check which processes use the memory:

PS aux

Display:

User PID % CPU % mem vsz RSS tty stat Start Time Command
MySQL 1888 0.8 0.2 1026444 60812? SL 25-dec 78: 56: 00/usr/local/MySQL/libexec/mysqld
Webuser 5108 0 0 360072 17048? S/usr/local/bin/httpd
Webuser 4953 0 0 358728 15656? S/usr/local/bin/httpd
Webuser 4916 0.1 0 358880 15616? S/usr/local/bin/httpd
Webuser 5750 0 0 358452 15420? S/usr/local/bin/httpd
Webuser 5106 0 0 356384 15364? S/usr/local/bin/httpd
Webuser 4970 0 0 356420 15344? S/usr/local/bin/httpd
Webuser 4950 0 0 358856 15288? S/usr/local/bin/httpd
Webuser 4911 0 0 359056 15276? S/usr/local/bin/httpd
Webuser 5034 0 0 358864 15180? S/usr/local/bin/httpd
Webuser 5095 0 0 358868 15136? S/usr/local/bin/httpd
Webuser 4929 0 0 358856 15124? S/usr/local/bin/httpd
Webuser 4900 0 0 358464 14912? S/usr/local/bin/httpd
Webuser 4944 0 0 356376 14792? S/usr/local/bin/httpd
Webuser 4896 0 0 356376 14768? S/usr/local/bin/httpd
Webuser 4995 0 0 356452 14640? S/usr/local/bin/httpd
Webuser 5035 0 0 356472 14608? S/usr/local/bin/httpd
Webuser 5097 0 0 356392 14588? S/usr/local/bin/httpd
Webuser 4918 0 0 356400 14560? S/usr/local/bin/httpd
Webuser 4927 0 0 356444 14520? S/usr/local/bin/httpd
Webuser 4938 0 0 356388 14512? S/usr/local/bin/httpd
Webuser 4913 0 0 356376 14476? S/usr/local/bin/httpd
Webuser 5039 0 0 356392 14452? S/usr/local/bin/httpd
Webuser 4940 0 0 356376 14384? S/usr/local/bin/httpd
Webuser 4934 0 0 356404 14332? S/usr/local/bin/httpd

Here, the RSS column is the physical memory usage.

Vsz: Virtual Memory Used
RSS: physical memory used

 

Related Article

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.