Tidb: The meaning of `max-memory` in config has changed

Created on 19 May 2020  路  7Comments  路  Source: pingcap/tidb

Bug Report

Please answer these questions before submitting your issue. Thanks!

Since the GlobalMemoryUsageTracker is introduced, its size is decided by performance.max-memory configuration. But this configuration is still used by prepared plan cache to set the maximum plan cache size, better to remove this usage for prepare plan cache or change its name to avoid possible incorrect configurations, a single configuration should not have two usages.

1. Minimal reproduce step (Required)

2. What did you expect to see? (Required)

3. What did you see instead (Required)

4. Affected version (Required)

5. Root Cause Analysis

epimemory-management need-more-info severitmoderate siexecution typbug

Most helpful comment

IMO, for best compatibility for upgraded servers from old versions, we should,

  1. Fix the annotation in tidb.toml.example and tell the readers that max-memory is only for Plan Cache in tidb.toml.example in all release branches(v2.1, v3.0, v3.1, v4.0).
  2. max-memory should be changed back to the old meaning, and only be scoped in Plan Cache according to the documentation, then hide and deprecate in the future versions (v4.1, v5.0).
  3. For the memory limit of a whole server, introduce a new configuration named like memory-quota-server in the [performance] section.

All 7 comments

@SunRunAway PTAL

Good catch. Thank you @cfzjywxk

The annotation in config file says,

# Max memory size to use, 0 use the total usable memory in the machine.

The configuration description clearly says that max-memory is the max memory to use (for tidb-server perhaps everyone would assume that).

But, The documentation says it's only used for plan cache.

The maximum memory limit for the Prepared Least Recently Used (LRU) caching.

IMO, for best compatibility for upgraded servers from old versions, we should,

  1. Fix the annotation in tidb.toml.example and tell the readers that max-memory is only for Plan Cache in tidb.toml.example in all release branches(v2.1, v3.0, v3.1, v4.0).
  2. max-memory should be changed back to the old meaning, and only be scoped in Plan Cache according to the documentation, then hide and deprecate in the future versions (v4.1, v5.0).
  3. For the memory limit of a whole server, introduce a new configuration named like memory-quota-server in the [performance] section.

@Yisaer Would you like to take a look?

cc @fzhedu @XuHuaiyu

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: https://github.com/pingcap/tidb/issues/20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Was this page helpful?
0 / 5 - 0 ratings