当前位置:网站首页>运维排查-使用hcache插件排查Buffer/cache占用过高
运维排查-使用hcache插件排查Buffer/cache占用过高
2022-06-28 23:00:00 【健康平安的活着】
一 hcache插件
1.1 hcache插件的作用
hcache是基于pcstat的,pcstat可以查看某个文件是否被缓存和根据进程pid来查看都缓存了哪些文件。hcache在其基础上增加了查看整个操作系统Cache和根据使用Cache大小排序的特性。
1.2 buffer和cache产生的原因
1.当你的服务进程在对文件进行读写的时候,Linux内核为了提高服务的读写速度,则将会把文件放在此处的 buffer/cache 中进行缓存使用,由于 Linux服务的特点便是任何事物都会以文件的形式进行存在,所以你会发现不管你是否对文件做了大规模的读写,机器的 buffer/cache 是一直都存在的,并且持续的增高不下,这是因为服务器所产生的网络连接也好,用户协议的(UDP)套接字也好,这部分的数据系统都会为应用程序创建对应的文件描述符,而这些文件描述符的使用,则又都会重新进入 buffer/cache 中做读写使用,所以这也是你的机器始终都会存在较高 buffer/cache 的原因。
2. 在服务内存够用的情况下,Linux内核为了加快对文件的读写效率会将文件放入buffer/cache 中 以保证读写效率,但其实,尽管当你的应用程序对文件的读写运行结束后,buffer/cache 也不会自动释放该部分内存,而是作为缓冲进行保留,等到你的服务进程在下一次进行相同文件的读写时就可以直接使用,省去了各种重新进行内存初始化的操作;所以这将会导致,当你的应用进程频繁对不同的文件进行读写时,你会发现服务所可以直接使用的free内存将会越来越少的一个重要原因;难道 buffer/cache 在这样无休止的缓存当中就不会自动释放?当然不是,当服务器在内存压力较大的情况下时,则将会自动进行内存的回收,作为free空间分给其它进程使用,这其中主要回收的一个内存,则是 buffer/cache 的缓冲区内存块;
1.3 手动回收机制
除了在系统进程内存使用较大压力的情况下进行内存的回收外,我们也可以进行手动buffer/cache回收,但由于buffer/cache主要是用于文件的读写使用,所以进行文件回收时,一般常伴随系统的IO彪高,因为系统内核也对比cache中的数据与硬盘中的数据是否一致,如果不一致需要写会,然后才能进行内存的回收;
边栏推荐
- Is it safe and reliable for changtou school to help open a securities account? How to drive
- 在QT进行cin(全网最清晰教程)
- 【深度学习】(2) Transformer 网络解析,代码复现,附Pytorch完整代码
- 基于graph-linked embedding的多组学单细胞数据整合与调控推理
- Wave picking of WMS warehouse management system module
- 论文解读(DCN)《Towards K-means-friendly Spaces: Simultaneous Deep Learning and Clustering》
- 00 后云原生工程师:用 Zadig 为思创科技(广州公交)研发开源节流
- Career consultation | in the data analysis interview, it is only reliable to introduce yourself in this way
- The Best of Many Worlds_ Dual Mirror Descent for Online Allocation Problems
- 小样本利器2.文本对抗+半监督 FGSM & VAT & FGM代码实现
猜你喜欢

WMS仓库管理系统模块之波次拣货

After crossing, she said that the multiverse really exists

This simple little function saves 213 hours for our production research team in half a year

How to use London gold to draw support resistance line

Production environment sonarqube installation

台式机没声音怎么样才能解决

The love digital smart 2022 summit opens, sharing data strategy and building data-driven organization methodology

【深度学习】(3) Transformer 中的 Encoder 机制,附Pytorch完整代码
![Leetcode 324 swing sort ii[sort double pointer] the leetcode path of heroding](/img/41/b8ba8d771b7224eac1cc8c54fe9d29.png)
Leetcode 324 swing sort ii[sort double pointer] the leetcode path of heroding

Websocket for im instant messaging development: concept, principle and common sense of mistakes
随机推荐
Zadig + sonarqube, ensuring the safety of the development process
Zadig + cave Iast: let safety dissolve in continuous delivery
How to analyze the trend chart of London gold market with the moving average
Production environment sonarqube installation
云计算的迷路者
Differences among CPU, GPU, TPU and NPU
分享im即时通讯开发之WebSocket:概念、原理、易错常识
两栏布局左边图片显示部分由右边内容高度决定
A password error occurred when docker downloaded the MySQL image to create a database link
Interpretation of papers (DCN) towards k-means-friendly spaces: simultaneous deep learning and clustering
Qtcreater5.15.0 source code compilation process record
【剑指Offer】50. 第一个只出现一次的字符
论文解读(DCN)《Towards K-means-friendly Spaces: Simultaneous Deep Learning and Clustering》
月薪6万,互联网“降本增效”后,这类人开始被疯抢
【HackTheBox】 meow
【Try to Hack】nmap
Web API learning notes 1
网上办理股票开户安全性高吗?
邂逅阿维塔 11:强产品力下久违的新鲜感
Post-00 cloud native Engineer: use Zadig to increase revenue and reduce expenditure for the R & D of Sichuang Technology (Guangzhou public transport)