Memory Issues in tidb-server

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

Original topic: tidb-server内存方面的问题

| username: yulei7633

As for the memory of tidb-server, the only parameter I currently know is: tidb_mem_quota_query ===> the size of the cache occupied by each SQL query.
Are there any other memory configurations, similar to MySQL’s buffer_pool?

| username: yulei7633 | Original post link

tidb_mem_oom_action====>When the memory usage of each SQL query exceeds the value of tidb_mem_quota_query, this parameter controls whether to cancel or continue using it.

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

tidb_server_memory_limit

There is also this parameter:

  • This variable specifies the memory limit for the TiDB instance. When the memory usage reaches this limit, TiDB will cancel the currently highest memory-consuming SQL statement. After the SQL statement is successfully canceled, TiDB will attempt to call Golang GC to immediately reclaim memory, alleviating memory pressure as quickly as possible.
    Additionally, similar to buffer_pool is TiKV’s storage.block-cache.capacity. Since TiDB separates the compute and storage nodes, most of the cached data is in TiKV. This parameter sets the size of the cache data storage for TiKV.
| username: yulei7633 | Original post link

Let me ask again, the variable tidb_server_memory_limit specifies the memory limit of the TiDB instance. How can I check the memory size of the TiDB instance?

| username: Fly-bird | Original post link

tidb_server_memory_limit

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

Are you referring to the current memory usage of the TiDB instance? Can’t you just check it from the system level or look at it in the Grafana monitoring?

| username: yulei7633 | Original post link

I would like to ask if the memory allocated to the tidb-server instance can be adjusted? Not the memory used by tidb-server, but something similar to MySQL’s buffer_pool.

| username: yulei7633 | Original post link

This parameter is a percentage. I want to know the specific memory size allocated by tidb-server? Or does tidb-server not allocate a specific memory size and just use as much as needed as long as it does not exceed the above percentage of physical memory?

| username: yulei7633 | Original post link

In Grafana, you can only see the memory usage of the TiDB server. How can you see how much memory the TiDB server has actually allocated? Or is it directly determined by the physical memory limit of the machine?

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

There is currently no detailed memory usage information for each component of the tidb-server instance. The percentage parameter refers to the memory usage of the entire machine. Generally, setting it to 85% means that tidb can use up to 85% of the total memory of the machine.

| username: yulei7633 | Original post link

Got it, thanks.

| username: zhanggame1 | Original post link

Log in to the server, use the top command, press shift+m to sort by memory, and you will be able to see the tidb-server process and its memory usage.

| username: yulei7633 | Original post link

Got it, thanks.

| username: system | Original post link

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