mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 18:41:05 +00:00
Configurable state cache size and enforce exact state cache size (#2314)
* Allow configuring state cache size via cli * Track used cache size * Expose memory counter to informant * Enforce max cache size constraint exactly * Default to 64 MiB Co-Authored-By: cmichi <mich@elmueller.net> * Remove self as parameter
This commit is contained in:
committed by
Gavin Wood
parent
3f06fe32f3
commit
c6d15e2cea
@@ -457,6 +457,7 @@ impl<Factory: ServiceFactory> Components for FullComponents<Factory> {
|
||||
{
|
||||
let db_settings = client_db::DatabaseSettings {
|
||||
cache_size: config.database_cache_size.map(|u| u as usize),
|
||||
state_cache_size: config.state_cache_size,
|
||||
path: config.database_path.as_str().into(),
|
||||
pruning: config.pruning.clone(),
|
||||
};
|
||||
@@ -532,6 +533,7 @@ impl<Factory: ServiceFactory> Components for LightComponents<Factory> {
|
||||
{
|
||||
let db_settings = client_db::DatabaseSettings {
|
||||
cache_size: None,
|
||||
state_cache_size: config.state_cache_size,
|
||||
path: config.database_path.as_str().into(),
|
||||
pruning: config.pruning.clone(),
|
||||
};
|
||||
|
||||
@@ -48,6 +48,8 @@ pub struct Configuration<C, G: Serialize + DeserializeOwned + BuildStorage> {
|
||||
pub database_path: String,
|
||||
/// Cache Size for internal database in MiB
|
||||
pub database_cache_size: Option<u32>,
|
||||
/// Size of internal state cache in Bytes
|
||||
pub state_cache_size: usize,
|
||||
/// Pruning settings.
|
||||
pub pruning: PruningMode,
|
||||
/// Additional key seeds.
|
||||
@@ -93,6 +95,7 @@ impl<C: Default, G: Serialize + DeserializeOwned + BuildStorage> Configuration<C
|
||||
keystore_path: Default::default(),
|
||||
database_path: Default::default(),
|
||||
database_cache_size: Default::default(),
|
||||
state_cache_size: Default::default(),
|
||||
keys: Default::default(),
|
||||
custom: Default::default(),
|
||||
pruning: PruningMode::default(),
|
||||
|
||||
Reference in New Issue
Block a user