Monday, May 18, 2020

How to Display Memory Usage on Linux Servers

How to Display Memory Usage on Linux Servers


One of the issues that newcomers to server management often experience is the use of memory in Linux servers. In this article we added, we think that you can have more clear information about memory usage in your Linux servers.

The command you should use to view memory usage is the free command. When you write this command, the terminal output will be as below.

You can use some special parameters to see the values ​​in the output of the command more readable. The most preferred parameter among these is the free -m parameter. You can access all parameters of the free command by typing man free for more parameters. The output of the free -m parameter is as below, the values ​​are given in megabytes in this command.

Often the error in viewing and evaluating memory usage is that they evaluate the Used table of the Mem: field in the output as active memory usage, but the actual memory usage is not actually the value in the used section. The Linux kernel tries to optimize the use of memory in the system and stores the information stored in memory to keep it ready when it deems necessary. For this reason, the Mem: section shows both the amount of active memory used and the amount of cached cache on the ram that can be erased if necessary.

For these reasons, the part on the 2 lines of the free command shows the actual usage outside the cache on the disk.

The amount of memory you actually use in the system is the part used in the - / + buffers/cache: column.

Finally, we will inform you about the Swap: function in the free -m output. Swap is the amount of virtual memory that the operating system refers to in order not to become unstable when the amount of physical memory is completely exhausted. This virtual memory runs on hard drives on your server. Never confuse this with cache, if a server started using swap memory it will start pretty slow. If there is any usage in the used part of Swap: line in your server, we can say that your physical memory amount is insufficient at some point and Linux has applied to swap memory amount. (The logic of some applications is different in this regard. It can use the amount of swap memory as a priority.)

When you start using swaps, the load values ​​of your server increase, as swap accesses the data remaining in the memory at a speed much lower than the actual physical memory speed, which can cause serious performance problems. You can apply the commands at the bottom to free up swap memory.

Share:

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.