How to check memory usage of linux server

王林
Release: 2020-09-29 16:31:19
forward
3723 people have browsed it

How to check memory usage of linux server

Today I will share with you the command to view the memory.

free command

(Recommended tutorial: linux tutorial)

free command displays system usage and idle Memory status, including physical memory, interactive area memory (swap) and kernel buffer memory.

How to check memory usage of linux server

It clearly shows the total memory, how much has been used, and how much is left. Here you can see that Swap's used has used 811Mb. A multi-threaded audio downloading process is running on the server. The physical memory is no longer enough, so part of the memory is virtualized from the disk. Of course, we can use free -g and free-h to view it, but the displayed memory units are different. Free -h will display the memory size in an easy-to-read unit.

How to check memory usage of linux server

Physical memory and Swap exchange area

When the physical memory is almost exhausted, the system does not crash, but uses swap as temporary memory. Both are exhausted, and the system OutofMemory

The physical memory reaches the peak. The memory occupied by some infrequently used processes in the system may be kicked to the swap area

When the resources in the Mem area are released, they are Not all the memory moved to swap will come back. It will slowly return to the mem area as the system or program wakes up.

Swap is the memory virtualized by the disk when the memory is insufficient. The disk is mainly for I/O. Level operations are not system kernel level operations, and the processing speed is not at the same level as the Mem area

shooting the first bird

Many services are generally deployed on the production environment server. When the memory is received When there is insufficient alarm, the first thing we think of is to see which process takes up the most memory. We can execute the following command. This command can check the memory usage of each process.

ps -eo pmem,pcpu,rss,args | sort -k 1 -r | less
Copy after login

As shown in the figure below, the first column is the percentage of memory occupied by the process. You can see which applications occupy more memory and can be used to troubleshoot problems:

How to check memory usage of linux server

top command to check memory

The top command checks the real-time load of the system, including processes, CPU load, memory usage, etc.; directly enter the top command

How to check memory usage of linux server

Related recommendations: php training

The above is the detailed content of How to check memory usage of linux server. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template