Skip to content

Commit

Permalink
use more conservative constants (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsutton committed Dec 12, 2023
1 parent 8a1da52 commit 60f593e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions consensus/src/consensus/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,25 @@ impl ConsensusStorage {

// Calculate cache sizes which are related to pruning depth
let daa_excluded_cache_size =
perf::bounded_cache_size(params.pruning_depth as usize, 100_000_000, size_of::<Hash>() + size_of::<BlockHashSet>()); // required only above the pruning point; 100MB budget; expected empty sets
perf::bounded_cache_size(params.pruning_depth as usize, 40_000_000, size_of::<Hash>() + size_of::<BlockHashSet>()); // required only above the pruning point; expected empty sets
let statuses_cache_size =
perf::bounded_cache_size(pruning_size_for_caches, 100_000_000, size_of::<Hash>() + size_of::<BlockStatus>());
perf::bounded_cache_size(pruning_size_for_caches, 40_000_000, size_of::<Hash>() + size_of::<BlockStatus>());
let reachability_data_cache_size =
perf::bounded_cache_size(pruning_size_for_caches, 100_000_000, size_of::<ReachabilityData>());
let reachability_sets_cache_size = perf::bounded_cache_size(pruning_size_for_caches, 200_000_000, size_of::<Hash>());
perf::bounded_cache_size(pruning_size_for_caches, 40_000_000, size_of::<Hash>() + size_of::<ReachabilityData>());
let reachability_sets_cache_size = perf::bounded_cache_size(pruning_size_for_caches, 20_000_000, size_of::<Hash>());
let ghostdag_compact_cache_size =
perf::bounded_cache_size(pruning_size_for_caches, 50_000_000, size_of::<CompactGhostdagData>());
perf::bounded_cache_size(pruning_size_for_caches, 20_000_000, size_of::<Hash>() + size_of::<CompactGhostdagData>());

// Cache sizes which are tracked per unit
let relations_cache_size = 200_000_000 / size_of::<Hash>();
let reachability_relations_cache_size = 100_000_000 / size_of::<Hash>();
let transactions_cache_size = 4000usize; // Tracked units are txs
let relations_cache_size = 50_000_000 / size_of::<Hash>();
let reachability_relations_cache_size = 50_000_000 / size_of::<Hash>();
let transactions_cache_size = 2000usize; // Tracked units are txs

// Cache sizes represented and tracked as bytes
// TODO: unit approx for noise magnitude + higher block levels lower bound
let ghostdag_cache_bytes = 200_000_000usize; // 200MB
let headers_cache_bytes = 1_000_000_000usize; // 1GB
let utxo_diffs_cache_bytes = 200_000_000usize; // 200MB
let ghostdag_cache_bytes = 50_000_000usize;
let headers_cache_bytes = 50_000_000usize;
let utxo_diffs_cache_bytes = 50_000_000usize;

// Add stochastic noise to cache sizes to avoid predictable and equal sizes across all network nodes
let noise = |size| size + rand::thread_rng().gen_range(0..16);
Expand Down

0 comments on commit 60f593e

Please sign in to comment.