Keep decode caches in page cache based on page height minimum set by a knob with a default value of 2.
This commit is contained in:
parent
6546d04f2d
commit
5961b801cc
|
@ -823,6 +823,7 @@ void ServerKnobs::initialize(Randomize randomize, ClientKnobs* clientKnobs, IsSi
|
|||
init( REDWOOD_METRICS_INTERVAL, 5.0 );
|
||||
init( REDWOOD_HISTOGRAM_INTERVAL, 30.0 );
|
||||
init( REDWOOD_EVICT_UPDATED_PAGES, true ); if( randomize && BUGGIFY ) { REDWOOD_EVICT_UPDATED_PAGES = false; }
|
||||
init( REDWOOD_DECODECACHE_REUSE_MIN_HEIGHT, 2 ); if( randomize && BUGGIFY ) { REDWOOD_DECODECACHE_REUSE_MIN_HEIGHT = deterministicRandom()->randomInt(1, 7); }
|
||||
|
||||
// Server request latency measurement
|
||||
init( LATENCY_SAMPLE_SIZE, 100000 );
|
||||
|
|
|
@ -777,6 +777,7 @@ public:
|
|||
double REDWOOD_METRICS_INTERVAL;
|
||||
double REDWOOD_HISTOGRAM_INTERVAL;
|
||||
bool REDWOOD_EVICT_UPDATED_PAGES; // Whether to prioritize eviction of updated pages from cache.
|
||||
int REDWOOD_DECODECACHE_REUSE_MIN_HEIGHT; // Minimum height for which to keep and reuse page decode caches
|
||||
|
||||
// Server request latency measurement
|
||||
int LATENCY_SAMPLE_SIZE;
|
||||
|
|
|
@ -6053,8 +6053,15 @@ private:
|
|||
inline BTreePage::BinaryTree::Cursor getCursor(const ArenaPage* page,
|
||||
const RedwoodRecordRef& lowerBound,
|
||||
const RedwoodRecordRef& upperBound) {
|
||||
if (!page->extra.valid()) {
|
||||
debug_printf("Creating DecodeCache for ptr=%p lower=%s upper=%s %s\n",
|
||||
|
||||
Reference<BTreePage::BinaryTree::DecodeCache> cache;
|
||||
|
||||
if (page->extra.valid()) {
|
||||
cache = page->extra.getReference<BTreePage::BinaryTree::DecodeCache>();
|
||||
} else {
|
||||
cache = makeReference<BTreePage::BinaryTree::DecodeCache>(lowerBound, upperBound, m_pDecodeCacheMemory);
|
||||
|
||||
debug_printf("Created DecodeCache for ptr=%p lower=%s upper=%s %s\n",
|
||||
page->data(),
|
||||
lowerBound.toString(false).c_str(),
|
||||
upperBound.toString(false).c_str(),
|
||||
|
@ -6066,12 +6073,13 @@ private:
|
|||
upperBound)
|
||||
.c_str());
|
||||
|
||||
page->extra =
|
||||
makeReference<BTreePage::BinaryTree::DecodeCache>(lowerBound, upperBound, m_pDecodeCacheMemory);
|
||||
// Store decode cache into page based on height
|
||||
if (((BTreePage*)page->data())->height >= SERVER_KNOBS->REDWOOD_DECODECACHE_REUSE_MIN_HEIGHT) {
|
||||
page->extra = cache;
|
||||
}
|
||||
}
|
||||
|
||||
return BTreePage::BinaryTree::Cursor(page->extra.getReference<BTreePage::BinaryTree::DecodeCache>(),
|
||||
((BTreePage*)page->mutateData())->tree());
|
||||
return BTreePage::BinaryTree::Cursor(cache, ((BTreePage*)page->mutateData())->tree());
|
||||
}
|
||||
|
||||
// Get cursor into a BTree node from a child link
|
||||
|
|
Loading…
Reference in New Issue