update the lag knob

This commit is contained in:
Yi Wu 2022-02-28 15:40:40 -08:00
parent 27df6df950
commit 264b3811af
3 changed files with 11 additions and 10 deletions

View File

@ -808,7 +808,7 @@ void ServerKnobs::initialize(Randomize randomize, ClientKnobs* clientKnobs, IsSi
init( REDWOOD_LAZY_CLEAR_MIN_PAGES, 0 );
init( REDWOOD_LAZY_CLEAR_MAX_PAGES, 1e6 );
init( REDWOOD_REMAP_CLEANUP_WINDOW_BYTES, 4LL * 1024 * 1024 * 1024 );
init( REDWOOD_REMAP_CLEANUP_LAG, 0.1 );
init( REDWOOD_REMAP_CLEANUP_TOLERANCE_RATIO, 0.05 );
init( REDWOOD_PAGEFILE_GROWTH_SIZE_PAGES, 20000 ); if( randomize && BUGGIFY ) { REDWOOD_PAGEFILE_GROWTH_SIZE_PAGES = deterministicRandom()->randomInt(200, 1000); }
init( REDWOOD_METRICS_INTERVAL, 5.0 );
init( REDWOOD_HISTOGRAM_INTERVAL, 30.0 );

View File

@ -756,8 +756,8 @@ public:
// queue is empty
int64_t REDWOOD_REMAP_CLEANUP_WINDOW_BYTES; // Total size of remapped pages to keep before being removed by
// remap cleanup
double REDWOOD_REMAP_CLEANUP_LAG; // Maximum allowed remap remover lag behind the cleanup window as a multiple of
// the window size
double REDWOOD_REMAP_CLEANUP_TOLERANCE_RATIO; // Maximum ratio of the remap cleanup window that remap cleanup is
// allowed to be ahead or hehind
int REDWOOD_PAGEFILE_GROWTH_SIZE_PAGES; // Number of pages to grow page file by
double REDWOOD_METRICS_INTERVAL;
double REDWOOD_HISTOGRAM_INTERVAL;

View File

@ -3439,9 +3439,10 @@ public:
state RemappedPage cutoff(oldestRetainedVersion);
// Maximum number of remaining remap entries to keep before obeying stop command.
state uint64_t maxRemapEntries =
self->remapCleanupWindow *
(1 + (BUGGIFY ? deterministicRandom()->randomInt(0, 20) / 100.0 : SERVER_KNOBS->REDWOOD_REMAP_CLEANUP_LAG));
double toleranceRatio = BUGGIFY ? deterministicRandom()->randomInt(0, 10) / 100.0
: SERVER_KNOBS->REDWOOD_REMAP_CLEANUP_TOLERANCE_RATIO;
state uint64_t minRemapEntries = static_cast<uint64_t>(self->remapCleanupWindow * (1.0 - toleranceRatio));
state uint64_t maxRemapEntries = static_cast<uint64_t>(self->remapCleanupWindow * (1.0 + toleranceRatio));
debug_printf("DWALPager(%s) remapCleanup oldestRetainedVersion=%" PRId64 " remapCleanupWindow=%" PRId64
" maxRemapEntries=%" PRId64 " items=%" PRId64 "\n",
@ -3460,13 +3461,13 @@ public:
// Stop if we have cleanup enough remap entries, or if the stop flag is set and the remaining remap
// entries are less than that allowed by the lag.
int64_t remainingEntries = self->remapQueue.numEntries;
if (remainingEntries <= self->remapCleanupWindow ||
if (remainingEntries <= minRemapEntries ||
(self->remapCleanupStop && remainingEntries <= maxRemapEntries)) {
debug_printf("DWALPager(%s) remapCleanup finished remainingEntries=%" PRId64
" remapCleanupWindow=%" PRId64 " maxRemapEntries=%" PRId64,
debug_printf("DWALPager(%s) remapCleanup finished remainingEntries=%" PRId64 " minRemapEntries=%" PRId64
" maxRemapEntries=%" PRId64,
self->filename.c_str(),
remainingEntries,
self->remapCleanupWindow,
minRemapEntries,
maxRemapEntries);
break;
}