Give state_col 90% of memory budget and fix other col calculation (#4208)

* Give `state_col` 90% of memory budget and fix other col calculation

* Set default db cache size to 1024
This commit is contained in:
Bastian Köcher
2019-11-26 13:25:43 +01:00
committed by Robert Habermeier
parent fdbfd0b150
commit 9ead395bff
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -733,7 +733,7 @@ where
config.database = DatabaseConfig::Path {
path: config.in_chain_config_dir(DEFAULT_DB_CONFIG_PATH).expect("We provided a base_path."),
cache_size: cli.database_cache_size,
cache_size: Some(cli.database_cache_size),
};
config.state_cache_size = cli.state_cache_size;
+2 -2
View File
@@ -385,8 +385,8 @@ pub struct RunCmd {
pub light: bool,
/// Limit the memory the database cache can use.
#[structopt(long = "db-cache", value_name = "MiB")]
pub database_cache_size: Option<u32>,
#[structopt(long = "db-cache", value_name = "MiB", default_value = "1024")]
pub database_cache_size: u32,
/// Specify the state cache size.
#[structopt(long = "state-cache-size", value_name = "Bytes", default_value = "67108864")]
+2 -2
View File
@@ -215,8 +215,8 @@ pub fn open_database(
let mut db_config = DatabaseConfig::with_columns(Some(NUM_COLUMNS));
if let Some(cache_size) = cache_size {
let state_col_budget = (*cache_size as f64 * 0.7) as usize;
let other_col_budget = cache_size - state_col_budget;
let state_col_budget = (*cache_size as f64 * 0.9) as usize;
let other_col_budget = (cache_size - state_col_budget) / (NUM_COLUMNS as usize - 1);
let mut memory_budget = std::collections::HashMap::new();
for i in 0..NUM_COLUMNS {