pingcap / pingcap/tidb

set the default value of tidb_mem_quota_query to min(5GB, 50%*MAX_MEM)

Open
#42,317 0 comments 0 reactions 0 assignees View on GitHub
type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement
Prior to the introduction of `tidb_server_memory_limit`, the default value of `tidb_mem_quota_query` was set to 1GB to mitigate OOM issues. When a query's memory usage exceeded `the tidb_mem_quota_query` limit, the query would be canceled and return the "Out Of Memory Quota" error. However, customers have reported frequent query cancellations due to this default value being too small.

To address this issue, we have enabled `tidb_mem_quota_query` by default to prevent OOM problems in many scenarios. Additionally, we can increase the default value of tidb_mem_quota_query to allow more queries to run successfully. As a suggestion, we can set the default value of `tidb_mem_quota_query` to `min(5GB, 50% * MAX_MEM)`, where MAX_MEM represents the maximum memory available to TiDB.

This change will help reduce the number of query cancellations caused by the current default value of `tidb_mem_quota_query`. This change should **ONLY** take affect on newly deployed cluster but not a cluster upgraded from a lower version.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.