The meaning of the “buff/cache“ and “avail Mem“ fields in the “top“ output

文章概述:
This article explains the meaning of the “buff/cache” and “avail Mem” fields in the “top” output in Dell Networking SONiC’s native CLI.

Question 1: What is buff/cache?
问题1:什么是buff/cache?

“buff/cache” is the amount of memory used for file system buffers and cache. This memory usage is a crucial part of how Linux manages and optimizes system performance. Let us break down what “buff/cache” means:
“buff/cache”是用于文件系统缓冲区和高速缓存的内存量。这种内存使用情况是 Linux 管理和优化系统性能的关键部分。让我们来解释一下“buff/cache”的含义:

Buffers: 缓冲器:
Buffers in this context indicate a portion of system memory (RAM) that is used to temporarily hold data that is being read from or written to disk. When a program reads data from a file, for example, the data is first loaded into a buffer in memory. Buffers help improve disk I/O performance because reading or writing to RAM is faster than accessing the physical disk. Buffers can also ensure that the data is written to disk more efficiently, reducing the number of disk I/O operations.
此上下文中的缓冲区表示系统内存 (RAM) 的一部分,用于临时保存从磁盘读取或写入磁盘的数据。例如,当程序从文件中读取数据时,数据首先加载到内存中的缓冲区中。缓冲区有助于提高磁盘 I/O 性能,因为读取或写入 RAM 比访问物理磁盘更快。缓冲区还可以确保数据更高效地写入磁盘,减少磁盘 I/O 操作的次数。

Cache: 缓存:
Cache, in this context, indicates the portion of memory used to store frequently accessed data from files and directories. Linux uses a mechanism called the “page cache” to cache data from files and directories that have been read or written to recently. This cached data is kept in memory so that if the same data is needed again, it can be quickly retrieved from RAM instead of reading it from the slower disk storage. This cache can significantly improve system performance by reducing the requirement to access the disk for frequently used data.
在此上下文中,高速缓存表示用于存储文件和目录中频繁访问的数据的内存部分。 Linux 使用一种称为“页面缓存”的机制来缓存最近读取或写入的文件和目录中的数据。这些缓存的数据保存在内存中,这样如果再次需要相同的数据,可以快速从 RAM 中检索它,而不是从速度较慢的磁盘存储中读取。该缓存可以减少对经常使用的数据访问磁盘的要求,从而显着提高系统性能。

When applications or the operating system need more memory for active processes, the buffer/cache memory can quickly be released to accommodate these needs.
当应用程序或操作系统需要更多内存用于活动进程时,可以快速释放缓冲区/高速缓存内存以满足这些需求。

The “top” command displays this value. It also displays the system’s current status, CPU usage, memory usage.
“top”命令显示该值。它还显示系统当前状态、CPU 使用情况、内存使用情况。

admin@sonic:~$ top
top - 16:43:51 up 8 days, 18:15,  1 user,  load average: 1.54, 1.50, 1.51
Tasks: 365 total,   2 running, 363 sleeping,   0 stopped,   0 zombie
%Cpu(s):  2.8 us,  4.2 sy,  0.0 ni, 93.1 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  15482.2 total,  11292.8 free,   2299.6 used,   1889.8 buff/cache
MiB Swap:      0.0 total,      0.0 free,      0.0 used.  12965.1 avail Mem

Question 2: What is the threshold for high buffer/cache memory utilization?
问题 2:高缓冲区/高速缓存内存利用率的阈值是多少?
Buffer/cache memory is used as a cache to store frequently accessed data. Hence it is possible that a significant portion of available RAM ends up allocated for this purpose. What is to be noted is that buffer/cache memory usage is highly dynamic and constantly changing based on the system demand. Therefore, It is more valuable to monitor the overall memory usage (or the corresponding “avail Mem”) and ensure that the system has sufficient free memory for running applications and processes.
缓冲区/高速缓冲存储器用作高速缓存来存储频繁访问的数据。因此,可能会为此目的分配很大一部分可用 RAM。需要注意的是,缓冲区/高速缓存内存的使用是高度动态的,并且根据系统需求不断变化。因此,监控总体内存使用情况(或相应的“ avail Mem ”)并确保系统有足够的可用内存来运行应用程序和进程是更有价值的。
在这里插入图片描述

A helpful command to express the percentage of system RAM available for use on a Dell Enterprise SONiC switch:
用于表示可在 Dell Enterprise SONiC 交换机上使用的系统 RAM 百分比的有用命令:

free | grep Mem | awk '{print $7/$2 * 100 }'

This command divides “avail Mem” by “MiB Mem total.”
该命令将“ availMem ”除以“ MiBMemtotal ”。

Here is another example comparing the above commands and indicating their relationships for your reference:
下面是另一个例子,比较上述命令并指出它们之间的关系,供您参考:

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值