File tree Expand file tree Collapse file tree 3 files changed +26
-9
lines changed Expand file tree Collapse file tree 3 files changed +26
-9
lines changed Original file line number Diff line number Diff line change @@ -71,3 +71,4 @@ mod core_mempool;
71
71
pub mod counters;
72
72
mod logging;
73
73
mod shared_mempool;
74
+ pub ( crate ) mod thread_pool;
Original file line number Diff line number Diff line change 2
2
// SPDX-License-Identifier: Apache-2.0
3
3
4
4
//! Tasks that are executed by coordinators (short-lived compared to coordinators)
5
+ use crate :: thread_pool:: IO_POOL ;
5
6
use crate :: {
6
7
core_mempool:: { CoreMempool , TimelineState , TxnPointer } ,
7
8
counters,
@@ -235,16 +236,18 @@ where
235
236
236
237
let start_storage_read = Instant :: now ( ) ;
237
238
// Track latency: fetching seq number
238
- let seq_numbers = transactions
239
- . par_iter ( )
240
- . map ( |t| {
241
- get_account_sequence_number ( smp. db . clone ( ) , t. sender ( ) ) . map_err ( |e| {
242
- error ! ( LogSchema :: new( LogEntry :: DBError ) . error( & e) ) ;
243
- counters:: DB_ERROR . inc ( ) ;
244
- e
239
+ let seq_numbers = IO_POOL . install ( || {
240
+ transactions
241
+ . par_iter ( )
242
+ . map ( |t| {
243
+ get_account_sequence_number ( smp. db . clone ( ) , t. sender ( ) ) . map_err ( |e| {
244
+ error ! ( LogSchema :: new( LogEntry :: DBError ) . error( & e) ) ;
245
+ counters:: DB_ERROR . inc ( ) ;
246
+ e
247
+ } )
245
248
} )
246
- } )
247
- . collect :: < Vec < _ > > ( ) ;
249
+ . collect :: < Vec < _ > > ( )
250
+ } ) ;
248
251
// Track latency for storage read fetching sequence number
249
252
let storage_read_latency = start_storage_read. elapsed ( ) ;
250
253
counters:: PROCESS_TXN_BREAKDOWN_LATENCY
Original file line number Diff line number Diff line change
1
+ // Copyright (c) Aptos
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ #![ forbid( unsafe_code) ]
5
+
6
+ use once_cell:: sync:: Lazy ;
7
+
8
+ pub ( crate ) static IO_POOL : Lazy < rayon:: ThreadPool > = Lazy :: new ( || {
9
+ rayon:: ThreadPoolBuilder :: new ( )
10
+ . thread_name ( |index| format ! ( "mempool_io_{}" , index) )
11
+ . build ( )
12
+ . unwrap ( )
13
+ } ) ;
You can’t perform that action at this time.
0 commit comments