当前位置:网站首页>运维排查-使用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中的数据与硬盘中的数据是否一致,如果不一致需要写会,然后才能进行内存的回收;
边栏推荐
- How to use the apipost script - global variables
- Linux Installation mysql5.7 (centos7.6) tutorial
- TDD案例实战
- Post-00 cloud native Engineer: use Zadig to increase revenue and reduce expenditure for the R & D of Sichuang Technology (Guangzhou public transport)
- FANUC机器人_KAREL编程入门(2)_通用IO信号的使用方法
- Small sample sharp weapon 2 Text confrontation + semi supervised FGSM & VAT & FGM code implementation
- 超级工厂里的生意图鉴
- SqlServer复习
- Qt5.15中qsrand,srand随机数生成函数已弃用问题
- 【Flutter 问题系列第 71 篇】Flutter 中 Uint8List 和 Image 之间的相互转换
猜你喜欢

Pytorch builds transformer to realize multivariable and multi step time series forecasting (load forecasting)

Ansible production environment usage scenario (7): batch deployment of elk clients

Interpretation of papers (DCN) towards k-means-friendly spaces: simultaneous deep learning and clustering

月薪6万,互联网“降本增效”后,这类人开始被疯抢

一文读懂,WMS仓储管理系统与ERP有什么区别
Oracle set password complexity and timeout exit function

穿越过后,她说多元宇宙真的存在

微搭低代码中实现二维码生成

Deep virtual memory (VM)

FANUC机器人_KAREL编程入门(2)_通用IO信号的使用方法
随机推荐
Can we still enter the "pit" data analysis now? Look at the hot jobs of data analysis in 2022!
Panxiaoming, senior vice president of IC nansha|amd and President of Greater China: process, architecture and platform optimization break through the computing boundary
网上办理股票开户安全性高吗?
Embedded dynamic Arabic string conversion LCD display string [thanks for Jianguo ambition]
计数排序和排序的稳定性
A password error occurred when docker downloaded the MySQL image to create a database link
Is the account opening of Guosheng securities really safe and reliable
云计算的迷路者
Simple understanding of counting and sorting
见丰知夏|国漫鼻祖丰子恺,数字藏品独家发售
WEB API学习笔记1
Linux Installation mysql5.7 (centos7.6) tutorial
【Try to Hack】nmap
Basic knowledge diagram of K-line Diagram -- meaning of single K-line
在线文本过滤小于指定长度工具
How powerful is the Zadig build? Practice together
Interpretation of papers (DCN) towards k-means-friendly spaces: simultaneous deep learning and clustering
Qsrand, srand random number generating function in qt5.15 has been discarded
【Word 教程系列第 2 篇】Word 中如何设置每页的表格都有表头
如何使用伦敦金画出支撑阻力线