The memory usage of TiKV nodes remains high

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: TIKV节点的内存占用居高不下。

| username: TiDBer_RQobNXGv

The memory usage of the TiKV node remains high. It decreased somewhat after a previous restart, but after running for a while, the memory usage is high again.




| username: 啦啦啦啦啦 | Original post link

Refer to this link to adjust the parameters:

| username: hey-hoho | Original post link

There is a block cache in TiKV, which will stably occupy memory and improve data query efficiency. Check if the memory usage is similar to the set block cache size.

| username: TiDBer_RQobNXGv | Original post link

Currently, the memory usage of TiKV is much higher than the size of the block cache that is set.

| username: TiDBer_RQobNXGv | Original post link

The parameter settings here don’t seem to match the issue I described.

| username: 啦啦啦啦啦 | Original post link

Yes, check if large memory pages are enabled. Also, since you are using a mixed deployment, ensure that the block size is set appropriately.

| username: TiDBer_RQobNXGv | Original post link

Are you referring to large memory pages like this?

| username: 啦啦啦啦啦 | Original post link

Check if it is “never”.

| username: cy6301567 | Original post link

Our TiKV, PD, and TiFlash placed together also result in high memory usage.

| username: TiDBer_RQobNXGv | Original post link

The image is not visible. Please provide the text you need translated.

| username: TiDBer_RQobNXGv | Original post link

Is it resolved? In my case, the memory usage of the TiKV process is high, while the memory usage of others is not.

| username: TiDBer_vfJBUcxl | Original post link

Check out the memory tracking in this, it seems very useful, haven’t tried it yet.

单条SQL执行的内存使用问题 - TiDB 的问答社区.

| username: TiDBer_vfJBUcxl | Original post link

| username: TiDBer_RQobNXGv | Original post link

The block-cache is set to 8GB.

| username: redgame | Original post link

I looked at ours, it’s even higher than this…

| username: cassblanca | Original post link

The cache is too high, take a look at this column Column - Summary of TiKV Main Memory Structure and OOM Troubleshooting | TiDB Community and optimize it.

| username: 像风一样的男子 | Original post link

I took a look at my KV, and even with 64GB of memory, it’s over 60%.

| username: TiDBer_RQobNXGv | Original post link

Under normal circumstances, the memory size of TiKV should be consistent with the set block-cache size. The memory usage will only increase during a large number of query operations and will return to the block-cache size after the queries are completed.

| username: tidb菜鸟一只 | Original post link

show config where name like ‘%storage.block-cache.capacity%’;—Check how much it is, it seems your configuration can only be set to a maximum of 12G.
set tikv config storage.block-cache.capacity=12G;

| username: TiDBer_RQobNXGv | Original post link

Set to 8GB