Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed TPS benchmark to work with latest changes #2515

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ exclude = ["version-compatibility"]
[profile.release]
codegen-units = 1
lto = "fat"
# The difference in performance for "fat" and "thin" is small,
# but "thin" LTO is much faster to compile.
# If you play with benchamrks or flamegraph, it is better to use "thin"
# To speedup iterations between compialtion.
#lto = "thin"
panic = "unwind"

[workspace.package]
Expand Down
2 changes: 2 additions & 0 deletions benches/benches/transaction_throughput.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Tests throughput of various transaction types
//! `cargo bench --bench transaction_throughput -p fuel-core-benches`

use criterion::{
criterion_group,
Expand Down Expand Up @@ -90,6 +91,7 @@ where
test_builder.utxo_validation = true;
test_builder.gas_limit = Some(10_000_000_000);
test_builder.block_size_limit = Some(1_000_000_000_000);
test_builder.max_txs = 100000;

// spin up node
let transactions: Vec<Transaction> =
Expand Down
6 changes: 5 additions & 1 deletion crates/fuel-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ uuid = { version = "1.1", features = ["v4"] }
[dev-dependencies]
assert_matches = "1.5"
fuel-core = { path = ".", features = ["smt", "test-helpers"] }
fuel-core-executor = { workspace = true, features = ["std", "test-helpers"] }
fuel-core-executor = { workspace = true, features = [
"std",
"test-helpers",
"limited-tx-count",
] }
fuel-core-services = { path = "./../services", features = ["test-helpers"] }
fuel-core-storage = { path = "./../storage", features = ["test-helpers"] }
fuel-core-trace = { path = "./../trace" }
Expand Down
1 change: 1 addition & 0 deletions crates/services/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ test-helpers = [
"fuel-core-types/test-helpers",
"fuel-core-storage/test-helpers",
]
limited-tx-count = []
4 changes: 2 additions & 2 deletions crates/services/executor/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ use alloc::{

/// The maximum amount of transactions that can be included in a block,
/// excluding the mint transaction.
#[cfg(not(feature = "test-helpers"))]
#[cfg(not(feature = "limited-tx-count"))]
pub const fn max_tx_count() -> u16 {
u16::MAX.saturating_sub(1)
}
#[cfg(feature = "test-helpers")]
#[cfg(feature = "limited-tx-count")]
pub const fn max_tx_count() -> u16 {
1024
}
Expand Down
1 change: 1 addition & 0 deletions crates/services/upgradable-executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ test-helpers = [
"fuel-core-storage/test-helpers",
"fuel-core-types/test-helpers",
]
limited-tx-count = ["fuel-core-executor/limited-tx-count"]
2 changes: 1 addition & 1 deletion tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ fuel-core-benches = { path = "../benches" }
fuel-core-bin = { path = "../bin/fuel-core", features = ["parquet", "p2p"] }
fuel-core-client = { path = "../crates/client", features = ["test-helpers"] }
fuel-core-compression = { path = "../crates/compression" }
fuel-core-executor = { workspace = true, features = ["test-helpers"] }
fuel-core-gas-price-service = { path = "../crates/services/gas_price_service" }
fuel-core-p2p = { path = "../crates/services/p2p", features = [
"test-helpers",
Expand Down Expand Up @@ -76,6 +75,7 @@ tokio = { workspace = true, features = [
] }

[dev-dependencies]
fuel-core-executor = { workspace = true, features = ["limited-tx-count"] }
pretty_assertions = "1.4"
proptest = { workspace = true }
tracing = { workspace = true }
Expand Down
13 changes: 12 additions & 1 deletion tests/test-helpers/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ pub struct TestSetupBuilder {
pub privileged_address: Address,
pub base_asset_id: AssetId,
pub trigger: Trigger,
pub max_txs: usize,
}

impl TestSetupBuilder {
Expand Down Expand Up @@ -231,9 +232,18 @@ impl TestSetupBuilder {
..StateConfig::default()
};

let mut txpool = fuel_core_txpool::config::Config::default();
txpool.pool_limits.max_txs = self.max_txs;
txpool.max_tx_update_subscriptions = self.max_txs;
txpool.service_channel_limits = fuel_core_txpool::config::ServiceChannelLimits {
max_pending_write_pool_requests: self.max_txs,
max_pending_read_pool_requests: self.max_txs,
};
txpool.heavy_work.size_of_verification_queue = self.max_txs;

let config = Config {
utxo_validation: self.utxo_validation,
txpool: fuel_core_txpool::config::Config::default(),
txpool,
block_production: self.trigger,
starting_gas_price: self.starting_gas_price,
..Config::local_node_with_configs(chain_conf, state)
Expand Down Expand Up @@ -265,6 +275,7 @@ impl Default for TestSetupBuilder {
privileged_address: Default::default(),
base_asset_id: AssetId::BASE,
trigger: Trigger::Instant,
max_txs: 100000,
}
}
}
Expand Down
Loading