Increase the default pruning parameters (#11558)

* Log block number and earliest available block when snapshots fail to start

* Increase default pruning history to 128
Increase default pruning memory to 48Mb

* Decrease SNAPSHOT_PERIOD to 200 to get them snapshots started quicker

* Sync updates to defaults with the args parser

* Fix tests

* Restore the SNAPSHOT_PERIOD to 5000

* One more

* Update ethcore/src/client/config.rs
This commit is contained in:
David 2020-03-19 11:34:30 +01:00 committed by GitHub
parent 874462bfc0
commit 87fd914c94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 16 deletions

View File

@ -115,6 +115,9 @@ impl ChainNotify for Watcher {
// frequency of snapshots and ensures more snapshots are produced from similar points in // frequency of snapshots and ensures more snapshots are produced from similar points in
// the chain. // the chain.
.filter(|num| num % self.period == 0 ) .filter(|num| num % self.period == 0 )
.inspect(|num| {
trace!(target: "snapshot_sync", "Candidate for taking a snapshot: #{}", num);
})
// Pick newest of the candidates: this is where we want to snapshot from. // Pick newest of the candidates: this is where we want to snapshot from.
.fold(0, ::std::cmp::max); .fold(0, ::std::cmp::max);

View File

@ -737,8 +737,7 @@ impl Client {
debug!(target: "client", "Cleanup journal: DB Earliest = {:?}, Latest = {:?}", state_db.journal_db().earliest_era(), state_db.journal_db().latest_era()); debug!(target: "client", "Cleanup journal: DB Earliest = {:?}, Latest = {:?}", state_db.journal_db().earliest_era(), state_db.journal_db().latest_era());
let history = if config.history < MIN_HISTORY_SIZE { let history = if config.history < MIN_HISTORY_SIZE {
info!(target: "client", "Ignoring pruning history parameter of {}\ info!(target: "client", "Ignoring pruning history parameter of {} , falling back to minimum of {}",
, falling back to minimum of {}",
config.history, MIN_HISTORY_SIZE); config.history, MIN_HISTORY_SIZE);
MIN_HISTORY_SIZE MIN_HISTORY_SIZE
} else { } else {
@ -2558,6 +2557,7 @@ impl SnapshotClient for Client {
let block_number = self.block_number(at).ok_or_else(|| SnapshotError::InvalidStartingBlock(at))?; let block_number = self.block_number(at).ok_or_else(|| SnapshotError::InvalidStartingBlock(at))?;
let earliest_era = db.earliest_era().unwrap_or(0); let earliest_era = db.earliest_era().unwrap_or(0);
if db.is_prunable() && earliest_era > block_number { if db.is_prunable() && earliest_era > block_number {
warn!(target: "snapshot", "Tried to take a snapshot at #{} but the earliest available block is #{}", block_number, earliest_era);
return Err(SnapshotError::OldBlockPrunedDB.into()); return Err(SnapshotError::OldBlockPrunedDB.into());
} }

View File

@ -99,6 +99,9 @@ pub struct ClientConfig {
impl Default for ClientConfig { impl Default for ClientConfig {
fn default() -> Self { fn default() -> Self {
let mb = 1024 * 1024; let mb = 1024 * 1024;
// Note/TODO: the defaults here are overridden by the command line
// argument parser and changes to defaults here must be performed "over
// there" as well (see `cli/mod.rs` and https://github.com/openethereum/openethereum/issues/11574).
ClientConfig { ClientConfig {
queue: Default::default(), queue: Default::default(),
blockchain: Default::default(), blockchain: Default::default(),
@ -113,8 +116,8 @@ impl Default for ClientConfig {
verifier_type: VerifierType::Canon, verifier_type: VerifierType::Canon,
state_cache_size: 1 * mb, state_cache_size: 1 * mb,
jump_table_size: 1 * mb, jump_table_size: 1 * mb,
history: 64, history: 128,
history_mem: 32 * mb, history_mem: 64 * mb,
check_seal: true, check_seal: true,
transaction_verification_queue_size: 8192, transaction_verification_queue_size: 8192,
max_round_blocks_to_import: 12, max_round_blocks_to_import: 12,

View File

@ -860,11 +860,11 @@ usage! {
"--pruning=[METHOD]", "--pruning=[METHOD]",
"Configure pruning of the state/storage trie. METHOD may be one of auto, archive, fast: archive - keep all state trie data. No pruning. fast - maintain journal overlay. Fast but 50MB used. auto - use the method most recently synced or default to fast if none synced.", "Configure pruning of the state/storage trie. METHOD may be one of auto, archive, fast: archive - keep all state trie data. No pruning. fast - maintain journal overlay. Fast but 50MB used. auto - use the method most recently synced or default to fast if none synced.",
ARG arg_pruning_history: (u64) = 64u64, or |c: &Config| c.footprint.as_ref()?.pruning_history.clone(), ARG arg_pruning_history: (u64) = 128u64, or |c: &Config| c.footprint.as_ref()?.pruning_history.clone(),
"--pruning-history=[NUM]", "--pruning-history=[NUM]",
"Set a minimum number of recent states to keep in memory when pruning is active.", "Set a minimum number of recent states to keep in memory when pruning is active.",
ARG arg_pruning_memory: (usize) = 32usize, or |c: &Config| c.footprint.as_ref()?.pruning_memory.clone(), ARG arg_pruning_memory: (usize) = 64usize, or |c: &Config| c.footprint.as_ref()?.pruning_memory.clone(),
"--pruning-memory=[MB]", "--pruning-memory=[MB]",
"The ideal amount of memory in megabytes to use to store recent states. As many states as possible will be kept within this limit, and at least --pruning-history states will always be kept.", "The ideal amount of memory in megabytes to use to store recent states. As many states as possible will be kept within this limit, and at least --pruning-history states will always be kept.",

View File

@ -1271,8 +1271,8 @@ mod tests {
file_path: Some("blockchain.json".into()), file_path: Some("blockchain.json".into()),
format: Default::default(), format: Default::default(),
pruning: Default::default(), pruning: Default::default(),
pruning_history: 64, pruning_history: 128,
pruning_memory: 32, pruning_memory: 64,
compaction: Default::default(), compaction: Default::default(),
tracing: Default::default(), tracing: Default::default(),
fat_db: Default::default(), fat_db: Default::default(),
@ -1294,8 +1294,8 @@ mod tests {
dirs: Default::default(), dirs: Default::default(),
file_path: Some("blockchain.json".into()), file_path: Some("blockchain.json".into()),
pruning: Default::default(), pruning: Default::default(),
pruning_history: 64, pruning_history: 128,
pruning_memory: 32, pruning_memory: 64,
format: Default::default(), format: Default::default(),
compaction: Default::default(), compaction: Default::default(),
tracing: Default::default(), tracing: Default::default(),
@ -1317,8 +1317,8 @@ mod tests {
dirs: Default::default(), dirs: Default::default(),
file_path: Some("state.json".into()), file_path: Some("state.json".into()),
pruning: Default::default(), pruning: Default::default(),
pruning_history: 64, pruning_history: 128,
pruning_memory: 32, pruning_memory: 64,
format: Default::default(), format: Default::default(),
compaction: Default::default(), compaction: Default::default(),
tracing: Default::default(), tracing: Default::default(),
@ -1342,8 +1342,8 @@ mod tests {
dirs: Default::default(), dirs: Default::default(),
file_path: Some("blockchain.json".into()), file_path: Some("blockchain.json".into()),
pruning: Default::default(), pruning: Default::default(),
pruning_history: 64, pruning_history: 128,
pruning_memory: 32, pruning_memory: 64,
format: Some(DataFormat::Hex), format: Some(DataFormat::Hex),
compaction: Default::default(), compaction: Default::default(),
tracing: Default::default(), tracing: Default::default(),
@ -1398,8 +1398,8 @@ mod tests {
dirs: Default::default(), dirs: Default::default(),
spec: Default::default(), spec: Default::default(),
pruning: Default::default(), pruning: Default::default(),
pruning_history: 64, pruning_history: 128,
pruning_memory: 32, pruning_memory: 64,
daemon: None, daemon: None,
logger_config: Default::default(), logger_config: Default::default(),
miner_options: Default::default(), miner_options: Default::default(),