Skip to content

Commit

Permalink
move maybe_evict_cache() off default rayon pool (#15068)
Browse files Browse the repository at this point in the history
  • Loading branch information
msmouse authored Oct 24, 2024
1 parent 63a91dc commit c070f4c
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions storage/aptosdb/src/versioned_node_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

use crate::{lru_node_cache::LruNodeCache, metrics::OTHER_TIMERS_SECONDS, state_merkle_db::Node};
use aptos_experimental_runtimes::thread_manager::THREAD_MANAGER;
use aptos_infallible::RwLock;
use aptos_jellyfish_merkle::node_type::NodeKey;
use aptos_types::transaction::Version;
Expand Down Expand Up @@ -73,14 +74,16 @@ impl VersionedNodeCache {
};

if let Some((version, cache)) = to_evict {
cache
.iter()
.collect::<Vec<_>>()
.into_par_iter()
.with_min_len(100)
.for_each(|(node_key, node)| {
lru_cache.put(node_key.clone(), node.clone());
});
THREAD_MANAGER.get_non_exe_cpu_pool().install(|| {
cache
.iter()
.collect::<Vec<_>>()
.into_par_iter()
.with_min_len(100)
.for_each(|(node_key, node)| {
lru_cache.put(node_key.clone(), node.clone());
});
});

let evicted = self.inner.write().pop_front();
assert_eq!(evicted, Some((version, cache)));
Expand Down

0 comments on commit c070f4c

Please sign in to comment.