Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions kubernetes/linera-validator/helmfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ releases:
- name: crds.enabled
value: "true"
- name: scylla
version: v1.13.0
version: v1.16.0
namespace: scylla
chart: scylla/scylla
timeout: 900
Expand All @@ -44,7 +44,7 @@ releases:
values:
- {{ env "LINERA_HELMFILE_VALUES_SCYLLA" | default "scylla.values.yaml" }}
- name: scylla-manager
version: v1.13.0
version: v1.16.0
namespace: scylla-manager
chart: scylla/scylla-manager
timeout: 900
Expand All @@ -53,7 +53,7 @@ releases:
values:
- {{ env "LINERA_HELMFILE_VALUES_SCYLLA_MANAGER" | default "scylla-manager.values.yaml" }}
- name: scylla-operator
version: v1.13.0
version: v1.16.0
namespace: scylla-operator
chart: scylla/scylla-operator
timeout: 900
Expand All @@ -62,7 +62,7 @@ releases:
values:
- {{ env "LINERA_HELMFILE_VALUES_SCYLLA_OPERATOR" | default "scylla-operator.values.yaml" }}
- name: cert-manager
version: v1.15.3
version: v1.17.0
namespace: cert-manager
chart: jetstack/cert-manager
timeout: 900
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/linera-validator/scylla.values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sysctls:
datacenter: validator
racks:
- name: rack-1
members: 1
members: 3
scyllaConfig: "scylla-config"
storage:
capacity: 2Gi
Expand Down
41 changes: 40 additions & 1 deletion linera-client/src/client_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ use thiserror_context::Context;
use tracing::{debug, info};
#[cfg(feature = "benchmark")]
use {
crate::benchmark::Benchmark,
crate::benchmark::{Benchmark, BenchmarkError},
futures::{stream, StreamExt, TryStreamExt},
linera_base::{data_types::Amount, identifiers::ApplicationId},
linera_core::client::ChainClientError,
linera_execution::{
committee::{Committee, Epoch},
system::{OpenChainConfig, SystemOperation, OPEN_CHAIN_MESSAGE_INDEX},
Expand Down Expand Up @@ -704,6 +706,43 @@ where
Ok((chain_clients, epoch, blocks_infos, committee))
}

pub async fn wrap_up_benchmark(
&mut self,
chain_clients: HashMap<ChainId, ChainClient<NodeProvider, S>>,
close_chains: bool,
wrap_up_max_in_flight: usize,
) -> Result<(), Error> {
if close_chains {
info!("Closing chains...");
let stream = stream::iter(chain_clients.values().cloned())
.map(|chain_client| async move {
Benchmark::<S>::close_benchmark_chain(&chain_client).await?;
info!("Closed chain {:?}", chain_client.chain_id());
Ok::<(), BenchmarkError>(())
})
.buffer_unordered(wrap_up_max_in_flight);
stream.try_collect::<Vec<_>>().await?;
} else {
info!("Processing inbox for all chains...");
let stream = stream::iter(chain_clients.values().cloned())
.map(|chain_client| async move {
chain_client.process_inbox().await?;
info!("Processed inbox for chain {:?}", chain_client.chain_id());
Ok::<(), ChainClientError>(())
})
.buffer_unordered(wrap_up_max_in_flight);
stream.try_collect::<Vec<_>>().await?;

info!("Updating wallet from chain clients...");
for chain_client in chain_clients.values() {
self.wallet.as_mut().update_from_state(chain_client).await;
}
self.save_wallet().await?;
}

Ok(())
}

async fn process_inboxes_and_force_validator_updates(&mut self) {
let chain_clients = self
.wallet
Expand Down
4 changes: 4 additions & 0 deletions linera-service/src/linera/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,10 @@ pub enum ClientCommand {
/// closing chains.
#[arg(long, default_value = "5")]
wrap_up_max_in_flight: usize,

/// Confirm before starting the benchmark.
#[arg(long)]
confirm_before_start: bool,
},

/// Create genesis configuration for a Linera deployment.
Expand Down
60 changes: 20 additions & 40 deletions linera-service/src/linera/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ use serde_json::Value;
use tokio::task::JoinSet;
use tokio_util::sync::CancellationToken;
use tracing::{debug, error, info, warn, Instrument as _};
#[cfg(feature = "benchmark")]
use {
futures::{stream, TryStreamExt},
linera_client::benchmark::BenchmarkError,
linera_core::client::ChainClientError,
};

mod command;
mod net_up_utils;
Expand Down Expand Up @@ -750,6 +744,7 @@ impl Runnable for Job {
close_chains,
health_check_endpoints,
wrap_up_max_in_flight,
confirm_before_start,
} => {
assert!(num_chains > 0, "Number of chains must be greater than 0");
assert!(
Expand All @@ -773,6 +768,22 @@ impl Runnable for Job {
)
.await?;

if confirm_before_start {
info!("Ready to start benchmark. Say 'yes' when you want to proceed. Only 'yes' will be accepted");
if !std::io::stdin()
.lines()
.next()
.unwrap()?
.eq_ignore_ascii_case("yes")
{
info!("Benchmark cancelled by user");
context
.wrap_up_benchmark(chain_clients, close_chains, wrap_up_max_in_flight)
.await?;
return Ok(());
}
}

linera_client::benchmark::Benchmark::<S>::run_benchmark(
num_chains,
transactions_per_block,
Expand All @@ -786,40 +797,9 @@ impl Runnable for Job {
)
.await?;

if close_chains {
info!("Closing chains...");
let stream = stream::iter(chain_clients.values().cloned())
.map(|chain_client| async move {
linera_client::benchmark::Benchmark::<S>::close_benchmark_chain(
&chain_client,
)
.await?;
info!("Closed chain {:?}", chain_client.chain_id());
Ok::<(), BenchmarkError>(())
})
.buffer_unordered(wrap_up_max_in_flight);
stream.try_collect::<Vec<_>>().await?;
} else {
info!("Processing inbox for all chains...");
let stream = stream::iter(chain_clients.values().cloned())
.map(|chain_client| async move {
chain_client.process_inbox().await?;
info!("Processed inbox for chain {:?}", chain_client.chain_id());
Ok::<(), ChainClientError>(())
})
.buffer_unordered(wrap_up_max_in_flight);
stream.try_collect::<Vec<_>>().await?;

info!("Updating wallet from chain clients...");
for chain_client in chain_clients.values() {
context
.wallet
.as_mut()
.update_from_state(chain_client)
.await;
}
context.save_wallet().await?;
}
context
.wrap_up_benchmark(chain_clients, close_chains, wrap_up_max_in_flight)
.await?;
}

Watch { chain_id, raw } => {
Expand Down
2 changes: 1 addition & 1 deletion linera-views/src/backends/scylla_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ impl AdminKeyValueStore for ScyllaDbStoreInternal {
// Create a keyspace if it doesn't exist
let query = "CREATE KEYSPACE IF NOT EXISTS kv WITH REPLICATION = { \
'class' : 'SimpleStrategy', \
'replication_factor' : 1 \
'replication_factor' : 3 \
}";

// Execute the query
Expand Down