Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to check the memory usage of the linux server

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to check the memory usage of the linux server. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Free command

The free command shows the amount of memory used and free by the system, including physical memory, interactive area memory (swap), and kernel buffer memory.

It clearly shows how much total memory, how much has been used, and how much is left. Here you can see that 811Mb has been used in Swap's used, and there is a multi-threaded process for downloading audio on the server, so there is not enough physical memory, so part of the memory is virtualized from the disk. Of course, we can use free- g, free-h to view, but the display of memory units are not the same, free-h will show the memory size in easy-to-read units.

Physical memory and Swap swap

When the physical memory is running out, the system does not crash, but uses swap as temporary memory. When both are exhausted, the system OutofMemory

When the physical memory reaches its peak, some uncommonly used processes in the system may be kicked into the swap area

When the resources in the Mem area are released, not all the memory moved to the swap will come back, but will slowly return to the mem area with the awakening of the system or program.

Swap is the virtual memory of the disk when there is not enough memory. The disk is mainly operated at the O level, not at the kernel level, and the processing speed is not the same as that of the Mem area.

to stick your neck out

Many services are generally deployed on the servers in the production environment. When we receive an out-of-memory 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 view the memory usage of each process.

Ps-eo pmem,pcpu,rss,args | sort-k 1-r | less

As shown in the following figure, the first column lists the percentage of memory consumed by the process, and you can see which applications take up more memory for troubleshooting:

Top command to troubleshoot memory

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

On how to view the memory usage of the linux server to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report