Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

planner: instance/node level plan cache - phase 1 #54057

Open
qw4990 opened this issue Jun 17, 2024 · 0 comments · Fixed by #54089
Open

planner: instance/node level plan cache - phase 1 #54057

qw4990 opened this issue Jun 17, 2024 · 0 comments · Fixed by #54089
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@qw4990
Copy link
Contributor

qw4990 commented Jun 17, 2024

Enhancement

We only support Session Level Plan Cache now, which have 2 downsides:

  1. Unnecessary memory consumption since different sessions might cache the same Plan, for example, on our prior test, the avg memory of a cached plan is 100KB, so if there are 500 same sessions, 1000 plans of each, then the total memory consumptions is 100KB5001000=50GB; After we support Instance Level Plan Cache, it can be reduced 500 times to 100KB*1000=100MB.
  2. Can't control the overall memory consumption of Plan Cache, instead we can only control memory consumption for each single session by using tidb_session_plan_cache_size.

Instance Level Plan Cache can solve these 2 problems, decrease the memory consumption and bring a higher cache hit ratio to improve performance further.

In phase-1 we're going to do 2 things:

  1. a new performant and thread-safe LRU Cache for this feature;
  2. solve the cross-session sharing problem to let the optimizer can share the same plan across multiple sessions at the same time safely;
@qw4990 qw4990 added the type/enhancement The issue or PR belongs to an enhancement. label Jun 17, 2024
@ti-chi-bot ti-chi-bot bot closed this as completed in 4869956 Jun 25, 2024
@qw4990 qw4990 reopened this Jun 26, 2024
ti-chi-bot bot pushed a commit that referenced this issue Jun 26, 2024
ti-chi-bot bot pushed a commit that referenced this issue Aug 2, 2024
ti-chi-bot bot pushed a commit that referenced this issue Aug 6, 2024
ti-chi-bot bot pushed a commit that referenced this issue Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant