In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces when you need to pay attention to the memory usage of Linux, the content is very detailed, interested friends can refer to, I hope it can be helpful to you.
Memory management on Linux is complex. Although the utilization rate is high, there may not be a problem. You should pay attention to other things, too.
Running out of memory on Linux usually does not mean that there is a serious problem. Why? Because healthy Linux systems cache disk activity in memory, basically taking up unused memory, this is obviously a good thing.
In other words, it doesn't let memory be wasted. Use free memory to increase disk access speed and do not consume the memory of running applications. You can also imagine that using this in-memory cache is hundreds of times faster than directly accessing a hard disk drive (HDD) and significantly faster than directly accessing a solid-state drive. Full or almost full memory usually means that the system is running as efficiently as possible-- it's not a problem running.
How caching works
Disk caching simply means that the system makes full use of unused resources (free memory) to speed up disk reads and writes. The application doesn't lose anything and gets more memory on demand most of the time. In addition, disk caching does not cause applications to switch to swap partitions. Instead, the memory space used for the disk cache is returned as soon as it is needed, and the disk contents are updated.
Primary and secondary page failures
The Linux system allocates space for processes by dividing physical memory, calling the segmented blocks "pages", and mapping these pages to the virtual memory of each process. Pages that are no longer used may be removed from memory, although the related processes are still running. A failure occurs when the process needs a page that is not mapped or is not in memory. Therefore, this "fault fault" does not mean "error error" but "unavailable unavailables", and faults play an important role in memory management.
A secondary failure means that a page in memory is not allocated to the requested process or is not marked as present in the memory management unit. The main failure means that the page is not kept in memory.
If you want to feel the frequency of secondary and major page failures, try the ps command like this. Note that we want items related to the page fault and the command that generated it. Many lines are omitted from the output. MINFL shows the number of secondary failures, while MAJFL indicates the number of major failures.
$ps-eo min_flt,maj_flt Cmd MINFL MAJFL CMD230760 150 / usr/lib/systemd/systemd-- switched-root-- system-- deserialize 18 00 [kthreadd] 0 0 [rcu_gp] 0 0 [rcu_par_gp] 0 0 [kworker/0:0H-kblockd]... 166 20 gpg-agent-- homedir / var/lib/fwupd/gnupg-- use-standard-socket-- daemon 525 1 / usr/libexec/gvfsd- Trash-- spawner: 1.16 / org/gtk/gvfs/exec_spaw/0 4966 4 / usr/libexec/gnome-terminal-server 3617 0 bash 0 0 [kworker/1:0H-kblockd] 927 0 gdm-session-worker [pam/gdm-password]
To report a single process, you can try this command (LCTT: the 1 in the parameter is the PID of the process you want to view):
$ps-o min_flt,maj_flt 1 MINFL MAJFL230064 150
You can also add other display fields, such as the UID and GID of the process owner.
How much is full of $ps-o min_flt,maj_flt,cmd,args,uid,gid 1 MINFL MAJFL CMD COMMAND UID GID230064 150 / usr/lib/systemd/systemd-/ usr/lib/systemd/systemd-00?
A better way to find out how much memory is being used is with the free-m command. The-m option specifies that the units of numbers are MiBmebibyte instead of bytes.
$free-m total used free shared buff/cache availableMem: 3244 3069 35 49 140 667Swap: 3535 0 3535
Note that free (unused) may run out of memory, while available (which can be used to launch new applications) will show a larger amount. The difference between the two is worthy of our attention. A free available means it can be restored when needed, while a free free means it can be used now.
When do you have to worry
If the performance on the Linux system is good-- the application is responsive and the command line does not show a problem-- it is likely that the system is in good health. Remember, some applications may slow down for some reason, but it doesn't affect the entire system.
Too many hard failures may indicate that there is a problem, but compare it with the observed performance.
A good way to worry is to start worrying when available memory is close to zero or when the "swap swap used" item grows or fluctuates significantly. If the "available" items account for a reasonable percentage of the total memory available, then don't worry, as in the following example:
$free-m total used free shared buff/cache availableMem: 3244 3069 35 49 140 667Swap: 3535 0 3535Linux performance is very complex
All that aside, memory on Linux systems may become full and performance may degrade. Do not use a single memory usage report as an indicator when there is a problem with the system.
The memory management of the Linux system is complex because it takes steps to ensure that system resources are utilized. Don't be fooled into thinking that there is something wrong with the system when you are full of memory at first.
About when you need to pay attention to the memory consumption of Linux, I hope the above content can be of some help to you and 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.