-
Notifications
You must be signed in to change notification settings - Fork 6k
Open
Labels
type/enhancementThe issue or PR belongs to an enhancement.The issue or PR belongs to an enhancement.
Description
Enhancement
We only support Session Level Plan Cache now, which have 2 downsides:
- 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.
- 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:
- a new performant and thread-safe LRU Cache for this feature;
- solve the cross-session sharing problem to let the optimizer can share the same plan across multiple sessions at the same time safely;
hawkingrei, fzzf678, dbsid and AilinKid
Metadata
Metadata
Assignees
Labels
type/enhancementThe issue or PR belongs to an enhancement.The issue or PR belongs to an enhancement.