Skip to content

Commit

Permalink
[executor-benchmark] adjustments
Browse files Browse the repository at this point in the history
1. create-db pipelines execution and commission
2. up to 1M accounts involved in p2p test
3. shorten commit queue length, 50->3, to save some memory and make it more realistic (less SMT nodes cached in mem); for db-create, also shorten the execution queue 50->3, there's no point buffering too much and it makes the progress bar I'll introduce later too not accurate.
  • Loading branch information
msmouse authored and bors-libra committed Dec 23, 2021
1 parent 42df9cd commit 09b9119
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
17 changes: 14 additions & 3 deletions execution/executor-benchmark/src/db_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use crate::{
transaction_executor::TransactionExecutor, transaction_generator::TransactionGenerator,
TransactionCommitter,
};
use diem_config::{config::RocksdbConfig, utils::get_genesis_txn};
use diem_jellyfish_merkle::metrics::{
Expand Down Expand Up @@ -59,8 +60,10 @@ pub fn run(
maybe_bootstrap::<DiemVM>(&db_rw, get_genesis_txn(&config).unwrap(), waypoint).unwrap();

let executor = Arc::new(BlockExecutor::new(db_rw));
let executor_2 = executor.clone();
let genesis_block_id = executor.committed_block_id();
let (block_sender, block_receiver) = mpsc::sync_channel(50 /* bound */);
let (block_sender, block_receiver) = mpsc::sync_channel(3 /* bound */);
let (commit_sender, commit_receiver) = mpsc::sync_channel(3 /* bound */);

// Set a progressing bar
let bar = Arc::new(ProgressBar::new(num_accounts as u64 * 2));
Expand All @@ -69,7 +72,7 @@ pub fn run(
);
let exe_thread_bar = Arc::clone(&bar);

// Spawn two threads to run transaction generator and executor separately.
// Spawn threads to run transaction generator, executor and committer separately.
let gen_thread = std::thread::Builder::new()
.name("txn_generator".to_string())
.spawn(move || {
Expand All @@ -86,7 +89,7 @@ pub fn run(
executor,
genesis_block_id,
0, /* start_verison */
None,
Some(commit_sender),
);
while let Ok(transactions) = block_receiver.recv() {
let version_bump = transactions.len() as u64;
Expand All @@ -95,12 +98,20 @@ pub fn run(
}
})
.expect("Failed to spawn transaction executor thread.");
let commit_thread = std::thread::Builder::new()
.name("txn_committer".to_string())
.spawn(move || {
let mut committer = TransactionCommitter::new(executor_2, 0, commit_receiver);
committer.run();
})
.expect("Failed to spawn transaction committer thread.");

// Wait for generator to finish.
let mut generator = gen_thread.join().unwrap();
generator.drop_sender();
// Wait until all transactions are committed.
exe_thread.join().unwrap();
commit_thread.join().unwrap();
// Do a sanity check on the sequence number to make sure all transactions are committed.
generator.verify_sequence_number(db.as_ref());

Expand Down
2 changes: 1 addition & 1 deletion execution/executor-benchmark/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub fn run_benchmark(
let executor_2 = executor_1.clone();

let (block_sender, block_receiver) = mpsc::sync_channel(50 /* bound */);
let (commit_sender, commit_receiver) = mpsc::sync_channel(50 /* bound */);
let (commit_sender, commit_receiver) = mpsc::sync_channel(3 /* bound */);

let mut generator =
TransactionGenerator::new_with_metafile(genesis_key, block_sender, source_dir);
Expand Down
2 changes: 1 addition & 1 deletion execution/executor-benchmark/src/transaction_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use std::{
use storage_interface::DbReader;

const META_FILENAME: &str = "metadata.toml";
const MAX_ACCOUNTS_INVOLVED_IN_P2P: usize = 100_000;
const MAX_ACCOUNTS_INVOLVED_IN_P2P: usize = 1_000_000;

#[derive(Serialize, Deserialize)]
#[serde(tag = "type", content = "args")]
Expand Down

0 comments on commit 09b9119

Please sign in to comment.