Is it necessary to enable memory limits for TiDB services? What impact does enabling or disabling it have on cluster performance?

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

Original topic: tidb服务的内存限制有没有必要打开?打开或关闭对集群性能有啥影响没?

| username: xiaoxiaozuofang

[TiDB Usage Environment] Production Environment
[TiDB Version] tidb v6.1.0
[Reproduction Path] What operations were performed when the issue occurred
[Encountered Issue: Issue Phenomenon and Impact] Is it necessary to enable memory limits for the TiDB service? What impact does enabling or disabling it have on the cluster?
[Resource Configuration]
[Attachments: Screenshots/Logs/Monitoring]

| username: xfworld | Original post link

It can help you control the scope of resources affected by slow queries, quickly reclaim these resources, and reduce the risk of TiDB OOM, so it is necessary.

If the review of queries is strict, then it is not necessary… (But in most scenarios, there is no review, and they are directly executed…)

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

To prevent OOM, having the TiDB process killed by the system would still impact the business, especially if it’s a mixed deployment.

| username: zhanggame1 | Original post link

It also depends on the hardware configuration. If the machine has a lot of memory, it’s fine to enable it. If the memory is too low, don’t try it, as it can easily lead to an OOM (Out of Memory) error.

| username: 胡杨树旁 | Original post link

I suggest keeping it on to prevent OOM (Out of Memory).