Skip to content

Commit a03ad48

Browse files
authored
Remove benchmark feature (#4330)
## Motivation This code doesn't need to be behind a feature anymore ## Proposal Remove benchmark feature ## Test Plan CI ## Release Plan - Nothing to do / These changes follow the usual release cycle.
1 parent 4af2d23 commit a03ad48

File tree

17 files changed

+123
-105
lines changed

17 files changed

+123
-105
lines changed

.github/workflows/rust.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ jobs:
195195
cargo run --release -p linera-storage-service -- memory --endpoint $LINERA_STORAGE_SERVICE &
196196
- name: Run the benchmark test
197197
run: |
198-
cargo build --locked -p linera-service --bin linera-benchmark --features benchmark,storage-service
199-
cargo test --locked -p linera-service --features benchmark,storage-service benchmark
198+
cargo build --locked -p linera-service --bin linera-benchmark --features storage-service
199+
cargo test --locked -p linera-service --features storage-service benchmark
200200
201201
ethereum-tests:
202202
needs: changed-files

CLI.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ This document contains the help content for the `linera` command-line program.
2424
* [`linera remove-validator`](#linera-remove-validator)
2525
* [`linera revoke-epochs`](#linera-revoke-epochs)
2626
* [`linera resource-control-policy`](#linera-resource-control-policy)
27+
* [`linera benchmark`](#linera-benchmark)
28+
* [`linera multi-benchmark`](#linera-multi-benchmark)
2729
* [`linera create-genesis-config`](#linera-create-genesis-config)
2830
* [`linera watch`](#linera-watch)
2931
* [`linera service`](#linera-service)
@@ -88,6 +90,8 @@ A Byzantine-fault tolerant sidechain with low-latency finality and high throughp
8890
* `remove-validator` — Remove a validator (admin only)
8991
* `revoke-epochs` — Deprecates all committees up to and including the specified one
9092
* `resource-control-policy` — View or update the resource control policy
93+
* `benchmark` — Start a benchmark, maintaining a given TPS or just sending one transfer per chain in bulk mode
94+
* `multi-benchmark` — Runs multiple `linera benchmark` processes in parallel
9195
* `create-genesis-config` — Create genesis configuration for a Linera deployment. Create initial user chains and print information to be used for initialization of validator setup. This will also create an initial wallet for the owner of the initial "root" chains
9296
* `watch` — Watch the network for notifications
9397
* `service` — Run a GraphQL service to explore and extend the chains of the wallet
@@ -207,6 +211,7 @@ Open (i.e. activate) a new chain deriving the UID from an existing one
207211
* `--initial-balance <BALANCE>` — The initial balance of the new chain. This is subtracted from the parent chain's balance
208212

209213
Default value: `0`
214+
* `--super-owner` — Whether to create a super owner for the new chain
210215

211216

212217

@@ -520,6 +525,81 @@ View or update the resource control policy
520525

521526

522527

528+
## `linera benchmark`
529+
530+
Start a benchmark, maintaining a given TPS or just sending one transfer per chain in bulk mode
531+
532+
**Usage:** `linera benchmark [OPTIONS]`
533+
534+
###### **Options:**
535+
536+
* `--num-chains <NUM_CHAINS>` — How many chains to use
537+
538+
Default value: `10`
539+
* `--tokens-per-chain <TOKENS_PER_CHAIN>` — How many tokens to assign to each newly created chain. These need to cover the transaction fees per chain for the benchmark
540+
541+
Default value: `0.1`
542+
* `--transactions-per-block <TRANSACTIONS_PER_BLOCK>` — How many transactions to put in each block
543+
544+
Default value: `1`
545+
* `--fungible-application-id <FUNGIBLE_APPLICATION_ID>` — The application ID of a fungible token on the wallet's default chain. If none is specified, the benchmark uses the native token
546+
* `--bps <BPS>` — The fixed BPS (Blocks Per Second) rate that block proposals will be sent at
547+
548+
Default value: `10`
549+
* `--close-chains` — If provided, will close the chains after the benchmark is finished. Keep in mind that closing the chains might take a while, and will increase the validator latency while they're being closed
550+
* `--health-check-endpoints <HEALTH_CHECK_ENDPOINTS>` — A comma-separated list of host:port pairs to query for health metrics. If provided, the benchmark will check these endpoints for validator health and terminate if any validator is unhealthy. Example: "127.0.0.1:21100,validator-1.some-network.linera.net:21100"
551+
* `--wrap-up-max-in-flight <WRAP_UP_MAX_IN_FLIGHT>` — The maximum number of in-flight requests to validators when wrapping up the benchmark. While wrapping up, this controls the concurrency level when processing inboxes and closing chains
552+
553+
Default value: `5`
554+
* `--confirm-before-start` — Confirm before starting the benchmark
555+
* `--runtime-in-seconds <RUNTIME_IN_SECONDS>` — How long to run the benchmark for. If not provided, the benchmark will run until it is interrupted
556+
* `--delay-between-chains-ms <DELAY_BETWEEN_CHAINS_MS>` — The delay between chains, in milliseconds. For example, if set to 200ms, the first chain will start, then the second will start 200 ms after the first one, the third 200 ms after the second one, and so on. This is used for slowly ramping up the TPS, so we don't pound the validators with the full TPS all at once
557+
* `--config-path <CONFIG_PATH>` — Path to YAML file containing chain IDs to send transfers to. If not provided, only transfers between chains in the same wallet
558+
559+
560+
561+
## `linera multi-benchmark`
562+
563+
Runs multiple `linera benchmark` processes in parallel
564+
565+
**Usage:** `linera multi-benchmark [OPTIONS] --faucet <FAUCET>`
566+
567+
###### **Options:**
568+
569+
* `--processes <PROCESSES>` — The number of `linera benchmark` processes to run in parallel
570+
571+
Default value: `1`
572+
* `--faucet <FAUCET>` — The faucet (which implicitly defines the network)
573+
* `--client-state-dir <CLIENT_STATE_DIR>` — If specified, a directory with a random name will be created in this directory, and the client state will be stored there. If not specified, a temporary directory will be used for each client
574+
* `--num-chains <NUM_CHAINS>` — How many chains to use
575+
576+
Default value: `10`
577+
* `--tokens-per-chain <TOKENS_PER_CHAIN>` — How many tokens to assign to each newly created chain. These need to cover the transaction fees per chain for the benchmark
578+
579+
Default value: `0.1`
580+
* `--transactions-per-block <TRANSACTIONS_PER_BLOCK>` — How many transactions to put in each block
581+
582+
Default value: `1`
583+
* `--fungible-application-id <FUNGIBLE_APPLICATION_ID>` — The application ID of a fungible token on the wallet's default chain. If none is specified, the benchmark uses the native token
584+
* `--bps <BPS>` — The fixed BPS (Blocks Per Second) rate that block proposals will be sent at
585+
586+
Default value: `10`
587+
* `--close-chains` — If provided, will close the chains after the benchmark is finished. Keep in mind that closing the chains might take a while, and will increase the validator latency while they're being closed
588+
* `--health-check-endpoints <HEALTH_CHECK_ENDPOINTS>` — A comma-separated list of host:port pairs to query for health metrics. If provided, the benchmark will check these endpoints for validator health and terminate if any validator is unhealthy. Example: "127.0.0.1:21100,validator-1.some-network.linera.net:21100"
589+
* `--wrap-up-max-in-flight <WRAP_UP_MAX_IN_FLIGHT>` — The maximum number of in-flight requests to validators when wrapping up the benchmark. While wrapping up, this controls the concurrency level when processing inboxes and closing chains
590+
591+
Default value: `5`
592+
* `--confirm-before-start` — Confirm before starting the benchmark
593+
* `--runtime-in-seconds <RUNTIME_IN_SECONDS>` — How long to run the benchmark for. If not provided, the benchmark will run until it is interrupted
594+
* `--delay-between-chains-ms <DELAY_BETWEEN_CHAINS_MS>` — The delay between chains, in milliseconds. For example, if set to 200ms, the first chain will start, then the second will start 200 ms after the first one, the third 200 ms after the second one, and so on. This is used for slowly ramping up the TPS, so we don't pound the validators with the full TPS all at once
595+
* `--config-path <CONFIG_PATH>` — Path to YAML file containing chain IDs to send transfers to. If not provided, only transfers between chains in the same wallet
596+
* `--delay-between-processes <DELAY_BETWEEN_PROCESSES>` — The delay between starting the benchmark processes, in seconds. If --cross-wallet-transfers is true, this will be ignored
597+
598+
Default value: `10`
599+
* `--cross-wallet-transfers` — Whether to send transfers between chains in different wallets
600+
601+
602+
523603
## `linera create-genesis-config`
524604

525605
Create genesis configuration for a Linera deployment. Create initial user chains and print information to be used for initialization of validator setup. This will also create an initial wallet for the owner of the initial "root" chains

linera-chain/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ repository.workspace = true
1212
version.workspace = true
1313

1414
[features]
15-
benchmark = ["linera-base/test"]
1615
metrics = ["prometheus", "linera-views/metrics", "linera-execution/metrics"]
1716
test = [
1817
"dep:anyhow",

linera-chain/src/data_types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ pub struct LiteVote {
366366

367367
impl LiteVote {
368368
/// Returns the full vote, with the value, if it matches.
369-
#[cfg(any(feature = "benchmark", with_testing))]
369+
#[cfg(with_testing)]
370370
pub fn with_value<T: CertificateValue>(self, value: T) -> Option<Vote<T>> {
371371
if self.value.value_hash != value.hash() {
372372
return None;

linera-client/Cargo.toml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,6 @@ version.workspace = true
1313

1414
[features]
1515
test = ["linera-views/test", "linera-execution/test"]
16-
benchmark = [
17-
"linera-base/test",
18-
"dep:linera-sdk",
19-
"dep:num-format",
20-
"dep:reqwest",
21-
"dep:anyhow",
22-
"dep:prometheus-parse",
23-
"dep:rand",
24-
"dep:serde_yaml",
25-
]
2616
wasmer = [
2717
"linera-core/wasmer",
2818
"linera-execution/wasmer",
@@ -55,7 +45,7 @@ indexed-db = ["web", "indexed_db_futures", "serde-wasm-bindgen", "gloo-utils"]
5545
web-default = ["web", "wasmer", "indexed-db"]
5646

5747
[dependencies]
58-
anyhow = { workspace = true, optional = true }
48+
anyhow.workspace = true
5949
bcs.workspace = true
6050
clap.workspace = true
6151
futures.workspace = true
@@ -66,16 +56,16 @@ linera-core.workspace = true
6656
linera-execution.workspace = true
6757
linera-persistent = { version = "0.15.0", path = "../linera-persistent" }
6858
linera-rpc.workspace = true
69-
linera-sdk = { workspace = true, optional = true }
59+
linera-sdk.workspace = true
7060
linera-storage.workspace = true
7161
linera-version = { workspace = true }
7262
linera-views.workspace = true
73-
num-format = { workspace = true, optional = true }
74-
prometheus-parse = { workspace = true, optional = true }
75-
rand = { workspace = true, optional = true }
76-
reqwest = { workspace = true, optional = true }
63+
num-format.workspace = true
64+
prometheus-parse.workspace = true
65+
rand.workspace = true
66+
reqwest.workspace = true
7767
serde.workspace = true
78-
serde_yaml = { workspace = true, optional = true }
68+
serde_yaml.workspace = true
7969
thiserror.workspace = true
8070
thiserror-context.workspace = true
8171
tokio.workspace = true

linera-client/src/client_context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use linera_rpc::node_provider::{NodeOptions, NodeProvider};
2424
use linera_version::VersionInfo;
2525
use thiserror_context::Context;
2626
use tracing::{debug, info};
27-
#[cfg(feature = "benchmark")]
27+
#[cfg(not(web))]
2828
use {
2929
crate::benchmark::{Benchmark, BenchmarkError},
3030
futures::{stream, StreamExt, TryStreamExt},
@@ -663,7 +663,7 @@ where
663663
}
664664
}
665665

666-
#[cfg(feature = "benchmark")]
666+
#[cfg(not(web))]
667667
impl<Env: Environment, W> ClientContext<Env, W>
668668
where
669669
W: Persist<Target = Wallet>,

linera-client/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use linera_persistent as persistent;
99
use linera_version::VersionInfo;
1010
use thiserror_context::Context;
1111

12-
#[cfg(feature = "benchmark")]
12+
#[cfg(not(web))]
1313
use crate::benchmark::BenchmarkError;
1414
use crate::util;
1515

@@ -40,7 +40,7 @@ pub(crate) enum Inner {
4040
Arithmetic(#[from] linera_base::data_types::ArithmeticError),
4141
#[error("incorrect chain ownership")]
4242
ChainOwnership,
43-
#[cfg(feature = "benchmark")]
43+
#[cfg(not(web))]
4444
#[error("Benchmark error: {0}")]
4545
Benchmark(#[from] BenchmarkError),
4646
#[error("Validator version {remote} is not compatible with local version {local}.")]

linera-client/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mod error;
1717
pub mod util;
1818
pub mod wallet;
1919

20-
#[cfg(feature = "benchmark")]
20+
#[cfg(not(web))]
2121
pub mod benchmark;
2222

2323
#[cfg(test)]

linera-indexer/example/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ version.workspace = true
1313

1414
[features]
1515
default = ["rocksdb"]
16-
benchmark = ["linera-base/test", "linera-indexer/benchmark"]
1716
rocksdb = ["linera-indexer/rocksdb", "linera-indexer-plugins/rocksdb"]
1817
dynamodb = ["linera-indexer/dynamodb", "linera-indexer-plugins/dynamodb"]
1918
scylladb = ["linera-indexer/scylladb", "linera-indexer-plugins/scylladb"]

linera-indexer/lib/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ version.workspace = true
1313

1414
[features]
1515
default = ["rocksdb"]
16-
benchmark = ["linera-base/test"]
1716
rocksdb = ["linera-views/rocksdb", "linera-core/rocksdb"]
1817
dynamodb = ["linera-views/dynamodb", "linera-core/dynamodb"]
1918
scylladb = ["linera-views/scylladb", "linera-core/scylladb"]

0 commit comments

Comments
 (0)