Skip to content

Commit

Permalink
total suplly in value cache
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-aptos committed Nov 5, 2024
1 parent 243ea97 commit a9a56e8
Show file tree
Hide file tree
Showing 4 changed files with 637 additions and 427 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/workflow-run-execution-performance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ on:
default: false
type: boolean
description: Whether to run or skip move-only e2e tests at the beginning.
USE_FA_APT:
USE_COIN_APT:
required: false
default: true
default: false
type: boolean
description: Whether to exclusively use FA APT. If disabled, uses Coin APT.
description: By default, FA APT is exclusively used. If set Coin APT is used instead.
SOURCE:
required: false
default: CI
Expand Down Expand Up @@ -87,11 +87,11 @@ on:
default: false
type: boolean
description: Whether to skip move-only e2e tests at the beginning.
USE_FA_APT:
required: true
default: true
USE_COIN_APT:
required: false
default: false
type: boolean
description: Whether to exclusively use FA APT or Coin APT
description: By default, FA APT is exclusively used. If set Coin APT is used instead.
IGNORE_TARGET_DETERMINATION:
required: false
default: true
Expand Down Expand Up @@ -134,7 +134,7 @@ jobs:

- name: Run single node execution benchmark in performance build mode
shell: bash
run: TABULATE_INSTALL=lib-only pip install tabulate && FLOW="${{ inputs.FLOW }}" SOURCE="${{ inputs.SOURCE }}" RUNNER_NAME="${{ inputs.RUNNER_NAME }}" SKIP_MOVE_E2E="${{ inputs.SKIP_MOVE_E2E && '1' || '' }}" DISABLE_FA_APT="${{ inputs.USE_FA_APT && '' || '1' }}" NUMBER_OF_EXECUTION_THREADS="${{ inputs.NUMBER_OF_EXECUTION_THREADS }}" testsuite/single_node_performance.py
run: TABULATE_INSTALL=lib-only pip install tabulate && FLOW="${{ inputs.FLOW }}" SOURCE="${{ inputs.SOURCE }}" RUNNER_NAME="${{ inputs.RUNNER_NAME }}" SKIP_MOVE_E2E="${{ inputs.SKIP_MOVE_E2E && '1' || '' }}" DISABLE_FA_APT="${{ inputs.USE_COIN_APT && '1' || '' }}" NUMBER_OF_EXECUTION_THREADS="${{ inputs.NUMBER_OF_EXECUTION_THREADS }}" testsuite/single_node_performance.py
if: ${{ (inputs.IGNORE_TARGET_DETERMINATION || needs.test-target-determinator.outputs.run_execution_performance_test == 'true') }}

- run: echo "Skipping single node execution performance! Unrelated changes detected."
Expand Down
40 changes: 20 additions & 20 deletions execution/executor-benchmark/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ use aptos_transaction_generator_lib::{
TransactionType::{self, CoinTransfer},
};
use aptos_types::on_chain_config::Features;
use aptos_vm::VMBlockExecutor;
use aptos_vm::{aptos_vm::AptosVMBlockExecutor, VMBlockExecutor};
use db_reliable_submitter::DbReliableTransactionSubmitter;
use metrics::TIMER;
use pipeline::PipelineConfig;
Expand All @@ -56,11 +56,8 @@ use std::{
};
use tokio::runtime::Runtime;

pub fn init_db_and_executor<V>(config: &NodeConfig) -> (DbReaderWriter, BlockExecutor<V>)
where
V: VMBlockExecutor,
{
let db = DbReaderWriter::new(
pub fn init_db(config: &NodeConfig) -> DbReaderWriter {
DbReaderWriter::new(
AptosDB::open(
config.storage.get_dir_paths(),
false, /* readonly */
Expand All @@ -72,11 +69,7 @@ where
None,
)
.expect("DB should open."),
);

let executor = BlockExecutor::new(db.clone());

(db, executor)
)
}

fn create_checkpoint(
Expand Down Expand Up @@ -132,7 +125,7 @@ pub fn run_benchmark<V>(
config.storage.dir = checkpoint_dir.as_ref().to_path_buf();
config.storage.storage_pruner_config = pruner_config;
config.storage.rocksdb_configs.enable_storage_sharding = enable_storage_sharding;
let (db, executor) = init_db_and_executor::<V>(&config);
let db = init_db(&config);
let root_account = TransactionGenerator::read_root_account(genesis_key, &db);
let root_account = Arc::new(root_account);

Expand Down Expand Up @@ -167,7 +160,7 @@ pub fn run_benchmark<V>(
let (main_signer_accounts, burner_accounts) =
accounts_cache.split(num_main_signer_accounts);

let (transaction_generator_creator, phase) = init_workload::<V>(
let (transaction_generator_creator, phase) = init_workload::<AptosVMBlockExecutor>(
transaction_mix.clone(),
root_account.clone(),
main_signer_accounts,
Expand All @@ -189,6 +182,7 @@ pub fn run_benchmark<V>(
};

let start_version = db.reader.expect_synced_version();
let executor = BlockExecutor::<V>::new(db.clone());
let (pipeline, block_sender) =
Pipeline::new(executor, start_version, &pipeline_config, Some(num_blocks));

Expand Down Expand Up @@ -382,7 +376,8 @@ fn add_accounts_impl<V>(
config.storage.dir = output_dir.as_ref().to_path_buf();
config.storage.storage_pruner_config = pruner_config;
config.storage.rocksdb_configs.enable_storage_sharding = enable_storage_sharding;
let (db, executor) = init_db_and_executor::<V>(&config);
let db = init_db(&config);
let executor = BlockExecutor::<V>::new(db.clone());

let start_version = db.reader.get_latest_ledger_info_version().unwrap();

Expand Down Expand Up @@ -770,7 +765,7 @@ fn log_total_supply(db_reader: &Arc<dyn DbReader>) {
mod tests {
use crate::{
db_generator::bootstrap_with_genesis,
init_db_and_executor,
init_db,
native::{
aptos_vm_uncoordinated::AptosVMParallelUncoordinatedBlockExecutor,
native_config::NativeConfig,
Expand All @@ -787,6 +782,7 @@ mod tests {
};
use aptos_config::config::NO_OP_STORAGE_PRUNER_CONFIG;
use aptos_crypto::HashValue;
use aptos_executor::block_executor::BlockExecutor;
use aptos_executor_types::BlockExecutorTrait;
use aptos_sdk::{transaction_builder::aptos_stdlib, types::LocalAccount};
use aptos_temppath::TempPath;
Expand Down Expand Up @@ -881,7 +877,9 @@ mod tests {
config.storage.rocksdb_configs.enable_storage_sharding = false;

let (txn, vm_result) = {
let (vm_db, vm_executor) = init_db_and_executor::<AptosVMBlockExecutor>(&config);
let vm_db = init_db(&config);
let vm_executor = BlockExecutor::<AptosVMBlockExecutor>::new(vm_db.clone());

let root_account = TransactionGenerator::read_root_account(genesis_key, &vm_db);
let dst = LocalAccount::generate(&mut thread_rng());

Expand All @@ -908,7 +906,9 @@ mod tests {
(txn, result)
};

let (_other_db, other_executor) = init_db_and_executor::<E>(&config);
let other_db = init_db(&config);
let other_executor = BlockExecutor::<AptosVMBlockExecutor>::new(other_db.clone());

let parent_block_id = other_executor.committed_block_id();
let block_id = HashValue::random();
other_executor
Expand Down Expand Up @@ -1109,22 +1109,22 @@ mod tests {
// correct execution not yet implemented, so cannot be checked for validity
test_generic_benchmark::<
NativeParallelUncoordinatedBlockExecutor<NativeRawTransactionExecutor>,
>(Some(TransactionTypeArg::AptFaTransfer), false);
>(Some(TransactionTypeArg::NoOp), false);
}

#[test]
fn test_native_value_cache_loose_block_executor_benchmark() {
// correct execution not yet implemented, so cannot be checked for validity
test_generic_benchmark::<
NativeParallelUncoordinatedBlockExecutor<NativeValueCacheRawTransactionExecutor>,
>(Some(TransactionTypeArg::AptFaTransfer), false);
>(Some(TransactionTypeArg::NoOp), false);
}

#[test]
fn test_native_direct_raw_loose_block_executor_benchmark() {
// correct execution not yet implemented, so cannot be checked for validity
test_generic_benchmark::<
NativeParallelUncoordinatedBlockExecutor<NativeNoStorageRawTransactionExecutor>,
>(Some(TransactionTypeArg::AptFaTransfer), false);
>(Some(TransactionTypeArg::NoOp), false);
}
}
Loading

0 comments on commit a9a56e8

Please sign in to comment.