Skip to content
Draft
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
106 changes: 68 additions & 38 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ members = [
"crates/encoding/derive",
"crates/codederror/derive",
"server",
"lite",
"benchmarks",
"tools/bifrost-benchpress",
"tools/mock-service-endpoint",
Expand Down Expand Up @@ -50,6 +51,7 @@ restate-encoding = { path = "crates/encoding" }
restate-errors = { path = "crates/errors" }
restate-fs-util = { path = "crates/fs-util" }
restate-futures-util = { path = "crates/futures-util" }
restate-hyper-uds = { path = "crates/hyper-uds" }
restate-ingress-http = { path = "crates/ingress-http" }
restate-ingress-kafka = { path = "crates/ingress-kafka" }
restate-invoker-api = { path = "crates/invoker-api" }
Expand All @@ -68,6 +70,7 @@ restate-queue = { path = "crates/queue" }
restate-rocksdb = { path = "crates/rocksdb" }
restate-serde-util = { path = "crates/serde-util" }
restate-server = { path = "server" }
restate-lite = { path = "lite" }
restate-service-client = { path = "crates/service-client" }
restate-service-protocol = { path = "crates/service-protocol" }
restate-service-protocol-v4 = { path = "crates/service-protocol-v4" }
Expand Down Expand Up @@ -190,7 +193,7 @@ rangemap = "1.5.1"
rayon = { version = "1.10" }
regex = { version = "1.11" }
regress = { version = "0.10" }
reqwest = { version = "0.12.5", default-features = false, features = [
reqwest = { version = "0.12", default-features = false, features = [
"json",
"rustls-tls",
"stream",
Expand Down
29 changes: 22 additions & 7 deletions benchmarks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,21 @@
// by the Apache License, Version 2.0.

#![allow(clippy::async_yields_async)]

//! Utilities for benchmarking the Restate runtime

use std::net::SocketAddr;
use std::time::Duration;

use anyhow::anyhow;
use futures_util::{TryFutureExt, future};
use http::Uri;
use http::header::CONTENT_TYPE;
use pprof::flamegraph::Options;
use tokio::net::TcpListener;
use tokio::runtime::Runtime;
use tokio::sync::oneshot;
use tracing::warn;

use restate_core::{TaskCenter, TaskCenterBuilder, TaskKind, cancellation_token, task_center};
use restate_node::Node;
use restate_rocksdb::RocksDbManager;
Expand All @@ -26,11 +34,8 @@ use restate_types::config::{
};
use restate_types::config_loader::ConfigLoaderBuilder;
use restate_types::logs::metadata::ProviderKind;
use restate_types::net::listener::AddressBook;
use restate_types::retries::RetryPolicy;
use std::time::Duration;
use tokio::runtime::Runtime;
use tokio::sync::oneshot;
use tracing::warn;

pub fn discover_deployment(current_thread_rt: &Runtime, address: Uri) {
let client = reqwest::Client::builder()
Expand Down Expand Up @@ -102,16 +107,23 @@ pub fn spawn_restate(config: Configuration) -> task_center::Handle {
.build()
.expect("task_center builds")
.into_handle();

let mut prometheus = Prometheus::install(&config.common);
restate_types::config::set_current_config(config.clone());

let mut address_book = AddressBook::new(restate_types::config::node_filepath(""));
let live_config = Configuration::live();

tc.block_on(async {
RocksDbManager::init();
prometheus.start_upkeep_task();

if let Err(err) = address_book.bind_from_config(&live_config.pinned()).await {
panic!("Failed to bind address book: {err}");
}

TaskCenter::spawn(TaskKind::SystemBoot, "restate", async move {
let node = Node::create(live_config, prometheus)
let node = Node::create(live_config, prometheus, address_book)
.await
.expect("Restate node must build");
node.start().await
Expand All @@ -126,9 +138,12 @@ pub fn spawn_mock_service_endpoint(task_center_handle: &task_center::Handle) {
task_center_handle.block_on(async {
let (running_tx, running_rx) = oneshot::channel();
TaskCenter::spawn(TaskKind::TestRunner, "mock-service-endpoint", async move {
let addr: SocketAddr = ([127, 0, 0, 1], 9080).into();
let listener = TcpListener::bind(addr).await?;

cancellation_token()
.run_until_cancelled(mock_service_endpoint::listener::run_listener(
"127.0.0.1:9080".parse().expect("valid socket addr"),
listener,
|| {
let _ = running_tx.send(());
},
Expand Down
5 changes: 4 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ dist = true
formula = "restate"

[features]
default = ["cloud", "no-trace-logging"]
default = ["cloud", "no-trace-logging", "dev-cmd"]
dev-cmd = ["restate-lite", "mock-service-endpoint"]
cloud = []
no-trace-logging = ["tracing/max_level_trace", "tracing/release_max_level_debug"]

Expand All @@ -30,6 +31,8 @@ restate-cloud-tunnel-client = { workspace = true }
restate-serde-util = { workspace = true }
restate-time-util = { workspace = true }
restate-types = { workspace = true }
restate-lite = { workspace = true, optional = true }
mock-service-endpoint = { workspace = true, optional = true }

anyhow = { workspace = true }
arc-swap = { workspace = true }
Expand Down
4 changes: 4 additions & 0 deletions cli/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ pub struct GlobalOpts {

#[derive(Run, Subcommand, Clone)]
pub enum Command {
#[cfg(feature = "dev-cmd")]
#[clap(name = "dev", visible_alias = "up")]
Dev(dev::Dev),

/// Prints general information about the configured environment
#[clap(name = "whoami")]
WhoAmI(whoami::WhoAmI),
Expand Down
Loading
Loading