shrink slots at startup uses more threads (#20251)
This commit is contained in:
committed by
GitHub
parent
8266864adc
commit
9d91a6f1b7
@ -2776,10 +2776,10 @@ impl AccountsDb {
|
|||||||
pub fn shrink_all_slots(&self, is_startup: bool, last_full_snapshot_slot: Option<Slot>) {
|
pub fn shrink_all_slots(&self, is_startup: bool, last_full_snapshot_slot: Option<Slot>) {
|
||||||
const DIRTY_STORES_CLEANING_THRESHOLD: usize = 10_000;
|
const DIRTY_STORES_CLEANING_THRESHOLD: usize = 10_000;
|
||||||
const OUTER_CHUNK_SIZE: usize = 2000;
|
const OUTER_CHUNK_SIZE: usize = 2000;
|
||||||
const INNER_CHUNK_SIZE: usize = OUTER_CHUNK_SIZE / 8;
|
|
||||||
if is_startup && self.caching_enabled {
|
if is_startup && self.caching_enabled {
|
||||||
let slots = self.all_slots_in_storage();
|
let slots = self.all_slots_in_storage();
|
||||||
let inner_chunk_size = std::cmp::max(INNER_CHUNK_SIZE, 1);
|
let threads = num_cpus::get();
|
||||||
|
let inner_chunk_size = std::cmp::max(OUTER_CHUNK_SIZE / threads, 1);
|
||||||
slots.chunks(OUTER_CHUNK_SIZE).for_each(|chunk| {
|
slots.chunks(OUTER_CHUNK_SIZE).for_each(|chunk| {
|
||||||
chunk.par_chunks(inner_chunk_size).for_each(|slots| {
|
chunk.par_chunks(inner_chunk_size).for_each(|slots| {
|
||||||
for slot in slots {
|
for slot in slots {
|
||||||
|
Reference in New Issue
Block a user