The server-memory-quota parameter is not effective

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

Original topic: server-memory-quota参数不生效

| username: Miracle

[Test Environment for TiDB]

[TiDB Version] V5.4.0

[Reproduction Path] Operations that led to the issue

  1. Set server-memory-quota to 1G
    image
  2. 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]

  1. 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.
  2. 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:

  1. Does the global memory limit parameter seem ineffective?
  2. 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?
  3. 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]

| username: yilong | Original post link

This is still an experimental feature, and parameter calculations may not be very accurate. Additionally, starting from v6.5.0, this configuration item has been deprecated. Please use the tidb_server_memory_limit system variable for configuration.

| username: Miracle | Original post link

Thank you for the reply. Previously, when the business was in use, it reported an “out of global memory limit” error. I couldn’t reproduce it myself, so I had this question. I will upgrade to 6.5 and try the first issue again.

| username: Miracle | Original post link

The reason why mem-quota-query did not take effect is because oom-use-tmp-storage was enabled. After disabling this parameter, the SQL execution will be terminated and an “Out Of Memory Quota!” error will be returned. However, the actual memory usage still exceeds 1GB.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.