PageStorage gc may take long time in removing external pages from all tables
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1k
- Forks
- 423
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 24
Description
Enhancement
The time cost in PageStorageImpl::cleanExternalPage is not ignorable, especially when there are many tables inside a TiFlash instance.
# create 1000 empty tables for testing
for ((i=0;i!=1000;++i)) do; mycli -h 172.16.5.85 -P 8010 --no-warn -D test -e "create table t${i} (c int);"; done
With 1000 empty tables, the time cost in scanning takes about 90ms.
[2022/08/25 13:33:19.193 +08:00] [DEBUG] [PageStorageImpl.cpp:330] ["PageStorage:__global__.data GC finished without full gc. [total time=88ms] [dump snapshots=0ms] [gc in mem entries=1ms] [blobstore remove entries=0ms] [blobstore get status=0ms] [get gc entries=0ms] [blobstore full gc=0ms] [gc apply=0ms] [external callbacks=1052] [external gc=87ms] [get alive=2.67ms] [scanner=82.25ms] [remover=1.89ms]"] [thread_id=96]
[2022/08/25 13:34:19.614 +08:00] [DEBUG] [PageStorageImpl.cpp:330] ["PageStorage:__global__.data GC finished without full gc. [total time=84ms] [dump snapshots=0ms] [gc in mem entries=0ms] [blobstore remove entries=0ms] [blobstore get status=0ms] [get gc entries=0ms] [blobstore full gc=0ms] [gc apply=0ms] [external callbacks=1052] [external gc=84ms] [get alive=2.49ms] [scanner=79.38ms] [remover=1.81ms]"] [thread_id=130]
[2022/08/25 13:35:23.486 +08:00] [DEBUG] [PageStorageImpl.cpp:330] ["PageStorage:__global__.data GC finished without full gc. [total time=87ms] [dump snapshots=0ms] [gc in mem entries=0ms] [blobstore remove entries=0ms] [blobstore get status=0ms] [get gc entries=0ms] [blobstore full gc=0ms] [gc apply=0ms] [external callbacks=1052] [external gc=86ms] [get alive=2.61ms] [scanner=81.73ms] [remover=1.79ms]"] [thread_id=63]
with 5000 empty tables, the time cost in scanning takes about 390ms
[2022/08/25 18:05:15.185 +08:00] [DEBUG] [PageStorageImpl.cpp:335] ["PageStorage:__global__.data GC finished without full gc. [total time=416ms] [dump snapshots=0ms] [gc in mem entries=2ms] [blobstore remove entries=0ms] [blobstore get status=0ms] [get gc entries=0ms] [blobstore full gc=0ms] [gc apply=0ms] [external callbacks=5052] [external gc=410ms] [get alive=15.62ms] [scanner=385.87ms] [remover=9.12ms]"] [thread_id=179]
[2022/08/25 18:06:20.775 +08:00] [DEBUG] [PageStorageImpl.cpp:335] ["PageStorage:__global__.data GC finished without full gc. [total time=420ms] [dump snapshots=0ms] [gc in mem entries=2ms] [blobstore remove entries=0ms] [blobstore get status=0ms] [get gc entries=0ms] [blobstore full gc=0ms] [gc apply=0ms] [external callbacks=5052] [external gc=415ms] [get alive=16.40ms] [scanner=389.31ms] [remover=9.33ms]"] [thread_id=57]
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at PageStorageImpl::cleanExternalPage in PageStorageImpl.cpp and trace the external GC scanner and callbacks described in the issue. Reproduce the benchmark with many empty tables, then measure the change against the reported 1000- and 5000-table timings; done means external-page cleanup no longer incurs the current table-count-dependent scan cost.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100