【 TiDB 使用环境】生产环境
【 TiDB 版本】v5.3.1
【遇到的问题】kv节点内存使用超过限制
【复现路径】无
【问题现象及影响】
线上设置了 .block_cache.capacity 是10G,但是发现tikv的运行内存远比这个设置大,通过观察内存信息 可以见到 kv实例分配了很多anon 的内存页。想问一下 如何限制kv 使用内存,以及这些内存大概都使用在了哪里?
tiup ctl:v5.3.1 tikv --host XX.XX.XXX.35:20171 modify-tikv-config -n storage.block_cache.capacity -v 10GB
cat /proc/meminfo
MemTotal: 131450928 kB
MemFree: 1358108 kB
MemAvailable: 14216480 kB
Buffers: 2250768 kB
Cached: 12492908 kB
SwapCached: 0 kB
Active: 125394308 kB
Inactive: 2681780 kB
Active(anon): 114261576 kB
Inactive(anon): 456692 kB
Active(file): 11132732 kB
Inactive(file): 2225088 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 8120 kB
Writeback: 20 kB
AnonPages: 113332932 kB
Mapped: 143440 kB
Shmem: 1385764 kB
Slab: 699524 kB
SReclaimable: 562296 kB
SUnreclaim: 137228 kB
KernelStack: 24384 kB
PageTables: 655756 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 65725464 kB
Committed_AS: 6470792 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
HardwareCorrupted: 0 kB
AnonHugePages: 40960 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 14716928 kB
DirectMap2M: 116844544 kB
DirectMap1G: 4194304 kB
cat /proc/40339/status
Name: tikv-server
Umask: 0022
State: S (sleeping)
Tgid: 40339
Ngid: 0
Pid: 40339
PPid: 1
TracerPid: 0
Uid: 1000 1000 1000 1000
Gid: 1000 1000 1000 1000
FDSize: 65536
Groups: 1000
NStgid: 40339
NSpid: 40339
NSpgid: 40339
NSsid: 40339
VmPeak: 185634276 kB
VmSize: 185583056 kB
VmLck: 0 kB
VmPin: 0 kB
VmHWM: 71749592 kB
VmRSS: 59719276 kB
RssAnon: 59714084 kB
RssFile: 5192 kB
RssShmem: 0 kB
VmData: 185305160 kB
VmStk: 264 kB
VmExe: 46204 kB
VmLib: 3028 kB
VmPTE: 327968 kB
VmPMD: 684 kB
VmSwap: 0 kB
HugetlbPages: 0 kB
Threads: 182
SigQ: 0/513382
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000001000
SigCgt: 0000000180004e43
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000
CapBnd: 0000003fffffffff
CapAmb: 0000000000000000
Seccomp: 0
Speculation_Store_Bypass: thread vulnerable
Cpus_allowed: ff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff
Cpus_allowed_list: 0-263
Mems_allowed: 00000000,00000003
Mems_allowed_list: 0-1
voluntary_ctxt_switches: 18603
nonvoluntary_ctxt_switches: 98
【附件】
请提供各个组件的 version 信息,如 cdc/tikv,可通过执行 cdc version/tikv-server --version 获取。