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::Reverted { .. }) => {}
Ok(LogSyncEvent::TxSynced { tx }) => {
if let Err(e) = chunk_pool.update_file_info(&tx).await {
error!(
"Failed to update file info. tx seq={}, tx_root={}, error={}",
tx.seq, tx.data_merkle_root, e
);
}
// This may take a while, so execute it asynchronously to ensure the
// channel will not be saturated.
let chunk_pool_cloned = chunk_pool.clone();
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) => {
// program terminated

View File

@ -19,7 +19,9 @@ use tokio::sync::mpsc::UnboundedReceiver;
use tokio::sync::{oneshot, RwLock};
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;
#[derive(Clone, Debug)]

View File

@ -13,7 +13,7 @@ class MineTest(TestFramework):
self.zgs_node_configs[0] = {
"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.log.info("Contract Info: Est. block time %.2f, Mine period %d", self.block_time, self.mine_period)