-
Notifications
You must be signed in to change notification settings - Fork 734
Shared Cache Clock-Pro implementation #10063
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
Conversation
|
⚪ Test history | Ya make output | Test bloat
🟢 |
|
⚪ Test history | Ya make output | Test bloat
⚪ Test history | Ya make output | Test bloat | Test bloat
⚪ Test history | Ya make output | Test bloat | Test bloat | Test bloat
🟢 |
|
⚪ Test history | Ya make output | Test bloat
⚪ Test history | Ya make output | Test bloat | Test bloat
⚪ Test history | Ya make output | Test bloat | Test bloat | Test bloat
🟢 |
|
⚪ Test history | Ya make output | Test bloat
🟢 |
|
⚪ Test history | Ya make output | Test bloat
🟢 |
|
⚪ Test history | Ya make output | Test bloat
⚪ Test history | Ya make output | Test bloat | Test bloat
⚪ Test history | Ya make output | Test bloat | Test bloat | Test bloat
🟢 |
|
⚪ Test history | Ya make output | Test bloat
🟢 |
|
⚪ Test history | Ya make output | Test bloat
🟢 |
a878a3b to
3924cdf
Compare
|
⚪ Test history | Ya make output | Test bloat
🟢
*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation |
|
⚪ Test history | Ya make output | Test bloat
⚪ Test history | Ya make output | Test bloat | Test bloat
🟢
*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation |
| , ColdTarget(limit) | ||
| {} | ||
|
|
||
| TIntrusiveList<TPage> EvictNext() override { |
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.
Переделал чтобы тут возвращался список, ибо кажется что рекурсия RunHandCold-> RunHandTest -> RunHandCold может иногда и по 2 страницы эвиктить
|
|
||
| SizeTest += entry->Size; | ||
|
|
||
| while (SizeTest > Limit) { |
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.
А разве не нужно перед этим циклом сделать Advance(HandCold)? Ведь к этому моменту страница уже в Test, а не в Cold.
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.
Я тут честно не знаю, списывал отсюда
До конца не понял всех рекурсивных вызывов с додвиганиями стрелок, старался просто переписать 1 в 1, чтобы случайно не ухудшить эффективность алгоритма делая что-то иначе
Оставлю тудушку на подумать пока
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.
По-хорошему тут и рекурсию бы убрать, и сделать просто цикл
| } | ||
| } | ||
|
|
||
| Advance(HandCold); |
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.
Что-то я не понимаю алгоритм. Страница может попасть либо в Hot либо в Test, но при этом я не понимаю каким образом на неё станет указывать правильный HandHot или HandTest. Не говоря уже о том, что если страница не IsCold, то при продвижении HandCold всё странным образом смешивается. Видимо нужно подробнее читать алгоритм, но есть ощущение чего-то очень бажного.
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.
Опишу как я это понял.
Есть три типа страниц:
- 'Cold resident' — страница с данными, холодная
- 'Hot' — страница с данными, горячая
- 'Cold non-resident' (='Test') — страница без данных, которую выгрузили
Дальше все страницы выписываются в кольцо, в котором мы лимитируем число страниц каждого вида.
Страниц 'Cold non-resident' столько, чтобы они вмещались в лимит кэша (но они пустые).
Страницы 'Cold resident' и 'Hot' в сумме вмещаются в лимит кэша.
Дальше по этому кольцу мы возим 3 стрелки:
- HandTest — следующая страница которую будем удалять из 'Cold non-resident'
- HandCold — следующая страница которую будем пытаться удалить из 'Cold resident'
- HandHot — следующая страница которую будем пытаться удалить из 'Hot'
Иногда страница в кольце перемещается (например, при трансформации 'Cold non-resident' --> 'Hot' мы её перемещаем перед HandHot, видимо чтобы она подольше пожила), а иногда остаются где были (например, при трансформации 'Cold resident' --> 'Cold non-resident' страница остаётся где и была).
И видимо, (но явно этого нигде не написано ни в статье, ни в коде), эти три стрелки ездят друг за другом, то есть никогда не пересекаются, и от HandCold до HandHot страниц 'Cold non-resident' нет.
|
⚪ Test history | Ya make output | Test bloat
🟢
*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation |
|
⚪ Test history | Ya make output | Test bloat
⚪ Test history | Ya make output | Test bloat | Test bloat
🟢
*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation |
Changelog entry
...
Changelog category
Additional information
Implementation is based on https://github.com/cockroachdb/pebble/blob/master/internal/cache/clockpro.go code