Handle chunk write of rpc in parallel. (#126)

* Handle chunk write of rpc in parallel.

* double mine period.

* Increase the log sync channel capacity.

* Increase capacity.
This commit is contained in:
peilun-conflux 2024-07-15 15:50:51 +08:00 committed by GitHub
parent b1c52c7ad6
commit 504a67fdd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 8 deletions

View File

@ -265,12 +265,17 @@ impl MemoryChunkPool {
Ok(LogSyncEvent::ReorgDetected { .. }) => {} Ok(LogSyncEvent::ReorgDetected { .. }) => {}
Ok(LogSyncEvent::Reverted { .. }) => {} Ok(LogSyncEvent::Reverted { .. }) => {}
Ok(LogSyncEvent::TxSynced { tx }) => { Ok(LogSyncEvent::TxSynced { tx }) => {
if let Err(e) = chunk_pool.update_file_info(&tx).await { // This may take a while, so execute it asynchronously to ensure the
error!( // channel will not be saturated.
"Failed to update file info. tx seq={}, tx_root={}, error={}", let chunk_pool_cloned = chunk_pool.clone();
tx.seq, tx.data_merkle_root, e tokio::spawn(async move {
); if let Err(e) = chunk_pool_cloned.update_file_info(&tx).await {
} error!(
"Failed to update file info. tx seq={}, tx_root={}, error={}",
tx.seq, tx.data_merkle_root, e
);
}
});
} }
Err(RecvError::Closed) => { Err(RecvError::Closed) => {
// program terminated // program terminated

View File

@ -19,7 +19,9 @@ use tokio::sync::mpsc::UnboundedReceiver;
use tokio::sync::{oneshot, RwLock}; use tokio::sync::{oneshot, RwLock};
const RETRY_WAIT_MS: u64 = 500; const RETRY_WAIT_MS: u64 = 500;
const BROADCAST_CHANNEL_CAPACITY: usize = 16;
// A RPC query can return at most 10000 entries.
const BROADCAST_CHANNEL_CAPACITY: usize = 10000;
const CATCH_UP_END_GAP: u64 = 10; const CATCH_UP_END_GAP: u64 = 10;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]

View File

@ -13,7 +13,7 @@ class MineTest(TestFramework):
self.zgs_node_configs[0] = { self.zgs_node_configs[0] = {
"miner_key": GENESIS_PRIV_KEY, "miner_key": GENESIS_PRIV_KEY,
} }
self.mine_period = int(20 / self.block_time) self.mine_period = int(40 / self.block_time)
self.launch_wait_seconds = 15 self.launch_wait_seconds = 15
self.log.info("Contract Info: Est. block time %.2f, Mine period %d", self.block_time, self.mine_period) self.log.info("Contract Info: Est. block time %.2f, Mine period %d", self.block_time, self.mine_period)