目录
- 一、修改tidb内存
- 1、安装numa及常用命令:
- 2、设置tidb的内存:
- 二、修改tikv的内存
- 1、memory-usage-limit
- 2、storage.block-cache
- `capacity`
一、修改tidb内存
1、安装numa及常用命令:
在tidb节点上安装numa
yum-y install numactlnumactl— 控制 NUMA 策略(最常用)
# 查看系统 NUMA 拓扑numactl--hardware# 示例输出:tikv-60:~# numactl --hardwareavailable: 2 nodes(0-1)node 0 cpus: 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 node 0 size: 192031 MB node 0 free: 120064 MB node 1 cpus: 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 node 1 size: 193503 MB node 1 free: 89192 MB node distances: node 0 1 0: 10 21 1: 21 10# 将进程绑定到 node 0 的 CPU 和内存numactl--cpunodebind=0--membind=0./tidb-server# 仅绑定 CPU,不限制内存分配numactl--physcpubind=0-7./tidb-servernumastat— 查看 NUMA 内存统计
# 查看各节点的内存分配情况numastat-m# 示例输出:tikv-60:~# numastat -mPer-node system memory usage(in MBs): Token SwapCached not in hash table.Token SecPageTables not in hash table.Token FileHugePages not in hash table.Token FilePmdMapped not in hash table.Token Unaccepted not in hash table.Token SwapCached not in hash table.Token SecPageTables not in hash table.Token FileHugePages not in hash table.Token FilePmdMapped not in hash table.Token Unaccepted not in hash table.Node 0 Node 1 Total---------------------------------------------MemTotal 192031.82 193503.77 385535.59 MemFree 124772.26 107456.18 232228.44 MemUsed 67259.57 86047.58 153307.15 Active 6965.14 8508.30 15473.45 Inactive 55267.55 74556.52 129824.07 Active(anon)1805.60 1418.86 3224.46 Inactive(anon)30293.76 72021.29 102315.05 Active