Skip to content

Commit

Permalink
window_service: use the service thread as a rayon worker thread
Browse files Browse the repository at this point in the history
This reduces latency in processing a small number of shreds, since
they'll be processed directly on the current thread avoiding the rayon
fork/join overhead.

On current mnb traffic this improves
replay-loop-timing.wait_receive_elapsed_us ~2.5x.
  • Loading branch information
alessandrod committed Dec 4, 2024
1 parent cfc53c7 commit 4f2c74a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions core/src/window_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,15 +489,19 @@ impl WindowService {
let handle_error = || {
inc_new_counter_error!("solana-window-insert-error", 1, 1);
};
let thread_pool = rayon::ThreadPoolBuilder::new()
.num_threads(get_thread_count().min(8))
.thread_name(|i| format!("solWinInsert{i:02}"))
.build()
.unwrap();
let reed_solomon_cache = ReedSolomonCache::default();
Builder::new()
.name("solWinInsert".to_string())
.spawn(move || {
let thread_pool = rayon::ThreadPoolBuilder::new()
.num_threads(get_thread_count().min(8))
// Use the current thread as one of the workers. This reduces overhead when the
// pool is used to process a small number of shreds, since they'll be processed
// directly on the current thread.
.use_current_thread()
.thread_name(|i| format!("solWinInsert{i:02}"))
.build()
.unwrap();
let handle_duplicate = |possible_duplicate_shred| {
let _ = check_duplicate_sender.send(possible_duplicate_shred);
};
Expand Down

0 comments on commit 4f2c74a

Please sign in to comment.