Project

General

Profile

Multi-pass mode to reduce keep-balance memory footprint » History » Version 1

Tom Clegg, 12/02/2024 10:32 PM

1 1 Tom Clegg
h1. Multi-pass mode to reduce keep-balance memory footprint
2
3
Background: Currently keep-balance's RAM footprint increases with the number of stored blocks. On a large site, even the largest available machine might not have enough RAM to complete a keep-balance cycle.
4
5
Proposal: On large clusters, balance in N passes where each pass considers 1/N of the possible block locators -- for example, if N=16, the first pass considers blocks whose locators begin with "0", the next pass "1", etc. For simplicity, N must be a power of 16.
6
7
New behaviors relating to trash/pull lists:
8
* When starting a new sweep, clear trash lists (no change to existing behavior)
9
* [keepstore] When posting a new trash/pull list, check @X-Keep-List-Prefix@ header, and don't clear existing entries that have a different prefix
10
* [keep-balance] When posting a new trash/pull list, set @X-Keep-List-Prefix@ header, so keepstore knows which entries to clear
11
* [keep-balance] Run a pass for each prefix, then merge resulting statistics to produce full cluster summary
12
13
New behaviors relating to setting @replication_confirmed@:
14
* [rails] add collections column @replication_confirmed_partial@, default null
15
* [rails] reset @replication_confirmed_partial=null@ when updating a collection (just like existing behavior of @replication_confirmed@)
16
* [keep-balance] when starting a multi-pass sweep, clear @replication_confirmed_partial@:
17
** @update collections set replication_confirmed_partial=NULL@
18
* [keep-balance] after each pass (single prefix), set or reduce replication_confirmed_partial:
19
** @update collections set replication_confirmed_partial=min($1,coalesce(replication_confirmed_partial,$1)) where portable_data_hash=$2@
20
* [keep-balance] after all passes (prefixes) are done, copy replication_confirmed_partial to replication_confirmed:
21
** @update collections set replication_confirmed=replication_confirmed_partial, replication_confirmed_at=$1 where replication_confirmed_partial is not NULL@
22
23
Concurrency:
24
* For now, a single keep-balance process will perform N passes serially, then merge results.
25
* In future, we may allow multiple keep-balance processes on different nodes running passes concurrently. This will require further coordination such that a single "coordinator" process merges statistics produced by "worker" processes and updates @replication_confirmed@ when all workers are finished.