Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KVM宿主机占用缓存较大,hcache可能无法定位? #3

Open
oraclescjx opened this issue Sep 12, 2019 · 6 comments
Open

KVM宿主机占用缓存较大,hcache可能无法定位? #3

oraclescjx opened this issue Sep 12, 2019 · 6 comments

Comments

@oraclescjx
Copy link

1、服务器为KVM宿主机,启动了多个KVM虚拟机。

free -h
total used free shared buff/cache available
Mem: 251G 67G 770M 4.1G 183G 179G
Swap: 0B 0B 0B

2、 以下是./hcache --top 10 ,但是缓存占用在183G,其中是不是有其他比较大的文件缓存,但是通过hcache无法确认?有没有办法确认cache中的内容,谢谢。

3、/proc/meminfo信息

MemTotal: 263566160 kB
MemFree: 2093520 kB
MemAvailable: 169410064 kB
Buffers: 0 kB
Cached: 168794964 kB
SwapCached: 604572 kB
Active: 160983136 kB
Inactive: 94351416 kB
Active(anon): 78603948 kB
Inactive(anon): 8031548 kB
Active(file): 82379188 kB
Inactive(file): 86319868 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 15204348 kB
SwapFree: 13583428 kB
Dirty: 20 kB
Writeback: 0 kB
AnonPages: 85955084 kB
Mapped: 63308 kB
Shmem: 95256 kB
Slab: 4086124 kB
SReclaimable: 3335448 kB
SUnreclaim: 750676 kB
KernelStack: 9584 kB
PageTables: 181892 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 146987428 kB
Committed_AS: 90918056 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 901844 kB
VmallocChunk: 34224481256 kB
HardwareCorrupted: 0 kB
AnonHugePages: 79038464 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0

@elftech
Copy link

elftech commented Sep 22, 2021

我也碰到了类似的问题。宿主机free看cache占用很大。但是用hcache得到的cache缺很小。

@monchickey
Copy link

是的,因为用-top参数看到的是当前进程正在打开的文件,如果这个文件已经被缓存了但是进程并没有访问是看不到的,只能通过指定文件查看是否被缓存在页面中,看不了cache中全部的内容

@elftech
Copy link

elftech commented Mar 8, 2022

操作系统可能缓存了大量文件,但之前访问的进程可能都结束了,这时就会出现这种现象。

@meiq4096
Copy link

meiq4096 commented Dec 3, 2022

是的,因为用-top参数看到的是当前进程正在打开的文件,如果这个文件已经被缓存了但是进程并没有访问是看不到的,只能通过指定文件查看是否被缓存在页面中,看不了cache中全部的内容

进程打开的文件在 /proc/{pid}/fd 中可以看到的,不是在 /proc/{pid}/maps 里看。为什么不从 fd 目录这里取呢。
我实际也测试了,进程正在向文件中写入数据,但是这个文件在 /proc/{pid}/maps 这个目录是看不到的。

@grissomsh
Copy link

可以贡献一个 MR

@stay-foolish-forever
Copy link

提了一个 PR:#41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants