xy720 opened a new pull request, #68141:
URL: https://github.com/apache/doris/pull/68141

   ### What problem does this PR solve?
   
   Problem Summary:
   
   Before this patch each MTMV kept two MTMVCache (cacheWithGuard / 
cacheWithoutGuard) that held Nereids plan trees.
   
   The lifetime of MTMVCache is same as the MTMV object, when these MTMVCaches 
are at large scale (e.g. thousands of mtmv were created and refreshed, but they 
were not dropped afterwards) may ocupy lots of FE heap space.
   
   A heap-histogram check showing 72540 MTMVCache instances held ~30GB in FE 
heap on the affected cluster.
   
   This pr replace the origin MTMVCaches with Caffeine cache keyed by (mtmvId, 
guarded), using maximumSize + expireAfterAccess so cold entries are evicted 
under memory pressure instead of accumulating forever.
   
   Initial config, all mutable via ADMIN SET FRONTEND CONFIG:
   
   ```
   mtmv_cache_manage_num=3000, 
   expire_mtmv_cache_in_fe_second=86400,
   mtmv_cache_hot_show_num=500.
   ```
   
   Also support observability:
   
   ```
   SHOW PROC '/mtmv_cache/stat' returns:
   size / hitCount / missCount / evictionCount / loadFailureCount / hitRate
   
   SHOW PROC '/mtmv_cache/hot' returns MtmvId / DbName / MvName / Guarded / 
IdleMs
   ordered by most-recently-accessed for MVs
   ```
   
   
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [x] Regression test
       - [x] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason <!-- Add your reason?  -->
   
   - Behavior changed:
       - [x] No.
       - [ ] Yes. <!-- Explain the behavior change -->
   
   - Does this need documentation?
       - [x] No.
       - [ ] Yes. <!-- Add document PR link here. eg: 
https://github.com/apache/doris-website/pull/1214 -->
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label <!-- Add branch pick label that this PR should 
merge into -->
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to