To see the amount of RAM used we have many different commands such as:
free -m (Tính dung lượng theo MB) free (Tính dung lượng theo KB)
For example, an example of the free command:
free -m total used free shared buff/cache available Mem: 1838 553 494 11 789 1074 Swap: 4095 0 4095
- total Displays the total amount of RAM available.
- used Display RAM used.
- free Show available ram.
- shared Displays the ram used for the ramdisk service
- buffers show the ram used by kernel buffers.
- cached Ram used by page cache and slabs (Cached and Slab available in / proc / meminfo).
- buffers / cache Show total buffers and cache sizes.
Thực tế thì: Total = used + free + buff/cache.
However, the MemFree parameter returned is not the amount of free system memory.
Because Total memory in Linux is calculated by Active memory + Inactive memory (not including Swap). The problem is that Inactive memory, which is the memory when we run a process and turn it off, the system will cache this memory so that when we call this process again, it will use this inactive memory immediately instead of having to allocate it. replay. So when we open more and more processes, then turn it off, the more inactive memory takes up (Linux's Disk Caching technique)
When opening a new process, if the system lacks RAM, Linux will automatically switch the Inactive memory to Swap and dedicate all memory to the active process. As such, the system is not overloaded.
Conclusion, a sign to identify whether the system is short of RAM or not is to look at Swap, if Swap uses a lot of RAM, it is necessary to upgrade the memory for VPS / Server.
In the absence of a swap, please use the command
free -h and look at the line
-/+ buffers/cache to see how much memory the system is actually free.
For CentOS 6
The system has a total of 996MB RAM, used 193MB (19.37%) and had 802MB available. The 2GB swap hasn't been used yet.
For CentOS 7
The system has a total of 488MB RAM, with actual usage is only 125MB. 6MB and 357MB left available (used as buff / cache). Unused 1GB swap. What you need to be concerned about is the actual amount of free RAM that applications can use (available) - 286MB
Thus, the signal to worry about is when:
- Available memory or free of - / + buffers / cache goes to 0
- Swap usage increases
In case there are signs of using too much ram, you should check the service again or plan to upgrade the Ram to your VPS. For linux operating systems, the recommended level for any VPS to run website services should be at least 2GB.
Read more :
- AZDIGI livestream gave a stunning present
- Binance announced the "unscheduled" maintenance, the cryptocurrency community was outraged
- Poloniex announces the IEO LaunchBase platform and only accepts purchases with Tron (TRX)
- Full set of 18 JetPlugins for Elementor CrocoBlock - All-in-one Toolkit Elementor
- Instructions to manually sideload the app using AltStore + AltServer Patcher to install IPA on iOS / iPadOS devices - Cydia.vn