如何快速及时释放TIDB、TIKV占用内存

:ok_hand:好的

麻烦问下,这块是怎么怀疑出来的?

@spc_monkey @hey-hoho @来了老弟
经过PingCAP的同学耐心的指导和排查问题,如果发现有内存泄漏的问题,可以执行如下操作:
1、set global tidb_analyze_version = 1; //使用v1版本的 analyze
2、执行以下sql产生的语句:select distinct(concat('DROP STATS ',table_schema, '.', table_name,';')) from information_schema.tables, mysql.stats_histograms where stats_ver = 2 and table_id = tidb_table_id ;
3、步骤二产生的语句全部执行完后,确认stats_ver = 2以下语句没有内容,select distinct(concat(table_schema, '.', table_name)) from information_schema.tables, mysql.stats_histograms where stats_ver = 2 and table_id = tidb_table_id ;
4、重启tidb-server

经过上述步骤可以解决内存不断上涨的问题,据说5.1、5.2版本tidb-server部分环境可能会有这种现象,后续版本将进行改良优化

5 个赞

:+1::+1::+1:

:+1::+1::+1:

非常棒~

大佬 5.4会有这个问题吗 我的tikv 内存也是不断上涨 但是没有涨那么快

:+1::+1::+1:

5.4依然存在,我试过了

是不是6.1版本还存在

你测试一下,如果是的话,发一个帖子咨询一下~

产品测试的时候测了两次,感觉可能还存在,过程数据未保存,直接切换版本1继续跑了。什么时候不作为实验室特性发布了再试试。

你好 你问题解决了吗?

5.4版本 使用此步骤 好像还是无法解决问题

经过PingCAP的同学耐心的指导和排查问题,如果发现有内存泄漏的问题,可以执行如下操作:
1、set global tidb_analyze_version = 1; //使用v1版本的 analyze
2、执行以下sql产生的语句: select distinct(concat('DROP STATS ',table_schema, '.', table_name,';')) from information_schema.tables, mysql.stats_histograms where stats_ver = 2 and table_id = tidb_table_id ;
3、步骤二产生的语句全部执行完后,确认stats_ver = 2以下语句没有内容, select distinct(concat(table_schema, '.', table_name)) from information_schema.tables, mysql.stats_histograms where stats_ver = 2 and table_id = tidb_table_id ;
4、重启tidb-server

你这个是遇到oom了 慢sql引起的

5.4.0 版本使用
tidb_analyze_version = 1; 依然无法解决内存一直缓慢增长问题

学习了

此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。