-
Notifications
You must be signed in to change notification settings - Fork 225
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
Add a background region cache GC goroutine #664
Conversation
c985d93
to
c1437f9
Compare
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
c1437f9
to
9ec1fe4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Have we met such cases?
Probably. Some customer finds memory leak but the version they use does not include #566 yet. In their case, they drop |
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/cc @jackysp |
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
* Add a background region cache GC goroutine Signed-off-by: Yilin Chen <sticnarf@gmail.com> * Change interval to 1s and regionPerRound to 50 Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
* RuntimeStat: Clone `SnapshotRuntimeStats` Completely (#641) * add more info for cloning SnapshotRuntimeStats Signed-off-by: TonsnakeLin <lpbgytong@163.com> * add more info for cloning SnapshotRuntimeStats Signed-off-by: TonsnakeLin <lpbgytong@163.com> * shallow copy SnapshotRuntimeStats Signed-off-by: TonsnakeLin <lpbgytong@163.com> Signed-off-by: TonsnakeLin <lpbgytong@163.com> Co-authored-by: Yilin Chen <sticnarf@gmail.com> * fix data race in the LockKeys (#655) Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com> * Add a background region cache GC goroutine (#664) Signed-off-by: Yilin Chen <sticnarf@gmail.com> * Rewind after cacheGC reaches the end (#678) Signed-off-by: Yilin Chen <sticnarf@gmail.com> --------- Signed-off-by: TonsnakeLin <lpbgytong@163.com> Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com> Signed-off-by: Yilin Chen <sticnarf@gmail.com> Co-authored-by: TonsnakeLin <87681388+TonsnakeLin@users.noreply.github.com> Co-authored-by: Weizhen Wang <wangweizhen@pingcap.com>
* Add a background region cache GC goroutine (#664) * Add a background region cache GC goroutine Signed-off-by: Yilin Chen <sticnarf@gmail.com> * Change interval to 1s and regionPerRound to 50 Signed-off-by: Yilin Chen <sticnarf@gmail.com> * Rewind after cacheGC reaches the end (#678) Signed-off-by: Yilin Chen <sticnarf@gmail.com> --------- Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Refers to pingcap/tidb#40461.
#566 can solve high CPU cost problems like #532. But in some cases, there will still be memory leaks when some of the stale regions are never touched again.
This PR adds a background goroutine to iterate over the cache to clean up stale region info. We don't want this goroutine to affect performance, so it runs at low frequency and each round is very fast.