mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-23 23:04:53 +00:00
Add LRU cache to database (#837)
* Add LRU caches to store * Improvements to LRU caches * Take state by value in `Store::put_state` * Store blocks by value, configurable cache sizes * Use a StateBatch to efficiently store skip states * Fix store tests * Add CloneConfig test, remove unused metrics * Use Mutexes instead of RwLocks for LRU caches
This commit is contained in:
@@ -46,6 +46,22 @@ lazy_static! {
|
||||
/*
|
||||
* Beacon State
|
||||
*/
|
||||
pub static ref BEACON_STATE_GET_COUNT: Result<IntCounter> = try_create_int_counter(
|
||||
"store_beacon_state_get_total",
|
||||
"Total number of beacon states requested from the store (cache or DB)"
|
||||
);
|
||||
pub static ref BEACON_STATE_HOT_GET_COUNT: Result<IntCounter> = try_create_int_counter(
|
||||
"store_beacon_state_hot_get_total",
|
||||
"Total number of hot beacon states requested from the store (cache or DB)"
|
||||
);
|
||||
pub static ref BEACON_STATE_CACHE_HIT_COUNT: Result<IntCounter> = try_create_int_counter(
|
||||
"store_beacon_state_cache_hit_total",
|
||||
"Number of hits to the store's state cache"
|
||||
);
|
||||
pub static ref BEACON_STATE_CACHE_CLONE_TIME: Result<Histogram> = try_create_histogram(
|
||||
"store_beacon_state_cache_clone_time",
|
||||
"Time to load a beacon block from the block cache"
|
||||
);
|
||||
pub static ref BEACON_STATE_READ_TIMES: Result<Histogram> = try_create_histogram(
|
||||
"store_beacon_state_read_seconds",
|
||||
"Total time required to read a BeaconState from the database"
|
||||
@@ -81,6 +97,14 @@ lazy_static! {
|
||||
/*
|
||||
* Beacon Block
|
||||
*/
|
||||
pub static ref BEACON_BLOCK_GET_COUNT: Result<IntCounter> = try_create_int_counter(
|
||||
"store_beacon_block_get_total",
|
||||
"Total number of beacon blocks requested from the store (cache or DB)"
|
||||
);
|
||||
pub static ref BEACON_BLOCK_CACHE_HIT_COUNT: Result<IntCounter> = try_create_int_counter(
|
||||
"store_beacon_block_cache_hit_total",
|
||||
"Number of hits to the store's block cache"
|
||||
);
|
||||
pub static ref BEACON_BLOCK_READ_TIMES: Result<Histogram> = try_create_histogram(
|
||||
"store_beacon_block_read_overhead_seconds",
|
||||
"Overhead on reading a beacon block from the DB (e.g., decoding)"
|
||||
|
||||
Reference in New Issue
Block a user