Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: server-memory-quota参数不生效

[Test Environment for TiDB]
[TiDB Version] V5.4.0
[Reproduction Path] Operations that led to the issue
- Set server-memory-quota to 1G
- Use sysbench for testing
sysbench oltp_read_write.lua
–mysql-host=xxxx
–mysql-port=4000
–mysql-user=sbtest
–mysql-password=‘12345’
–mysql-db=sbtest
–db-driver=mysql
–time=72000
–report-interval=1
–threads=100
–tables=20
–table-size=100000
run
[Encountered Issues: Phenomenon and Impact]
- Observed through Grafana that TiDB’s memory usage exceeded 1G, approximately 1.2G, but sysbench continued running without reporting an out of global memory limit error.
- After exceeding 1G, executed a memory-intensive SQL as per the official documentation: select * from t1 t1 join t1 t2 join t1 t3 order by t1.id, but it did not report an out of global memory limit error and instead directly caused an OOM.
Therefore, I have a few questions:
- Does the global memory limit parameter seem ineffective?
- Is the parameter to limit the maximum memory for a single SQL to 1G also ineffective? Or does it use 4G of memory first and then return an out of memory limit error?
- When TiDB OOMed, the monitoring metrics did not exceed 4G. Am I looking at the wrong metrics?
[Resource Configuration]
TiDB allocated memory is 4G
[Attachments: Screenshots/Logs/Monitoring]