-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[package] | ||
name = "sui-rpc-benchmark" | ||
version.workspace = true | ||
authors = ["Mysten Labs <[email protected]>"] | ||
license = "Apache-2.0" | ||
publish = false | ||
edition = "2021" | ||
|
||
[dependencies] | ||
anyhow.workspace = true | ||
async-trait.workspace = true | ||
clap = { workspace = true, features = ["derive"] } | ||
tokio = { workspace = true, features = ["full"] } | ||
tracing.workspace = true | ||
futures.workspace = true | ||
serde.workspace = true | ||
serde_json.workspace = true | ||
|
||
sui-types.workspace = true | ||
sui-sdk.workspace = true | ||
telemetry-subscribers.workspace = true | ||
|
||
[[bin]] | ||
name = "sui-rpc-benchmark" | ||
path = "src/main.rs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# sui-rpc-benchmark: Benchmarking Tool for SUI RPC Performance | ||
|
||
`sui-rpc-benchmark` is a benchmarking utility designed to measure and compare performance across different RPC access methods in Sui: | ||
|
||
- Direct database reads | ||
- JSON RPC endpoints | ||
- GraphQL queries | ||
|
||
## Overview | ||
|
||
The benchmark tool helps evaluate: | ||
- Query latency and throughput | ||
- Resource utilization | ||
- Performance at scale | ||
|
||
## Usage Examples | ||
|
||
Run benchmarks with: | ||
|
||
``` | ||
# Direct database queries: | ||
cargo run --release --bin sui-rpc-benchmark direct --num-queries 100 --num-threads 1 | ||
# JSON RPC endpoints: | ||
cargo run --release --bin sui-rpc-benchmark jsonrpc --endpoint http://127.0.0.1:9000 --num-queries 100 --num-threads 1 | ||
# GraphQL queries: | ||
cargo run --release --bin sui-rpc-benchmark graphql --endpoint http://127.0.0.1:9000/graphql --num-queries 100 --num-threads 1 | ||
``` | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use clap::{Parser, Subcommand}; | ||
use anyhow::Result; | ||
|
||
#[derive(Parser)] | ||
#[clap( | ||
name = "sui-rpc-benchmark", | ||
about = "Benchmark tool for comparing Sui RPC access methods" | ||
)] | ||
pub struct Opts { | ||
#[clap(subcommand)] | ||
pub command: Command, | ||
} | ||
|
||
#[derive(Subcommand)] | ||
pub enum Command { | ||
/// Benchmark direct database queries | ||
#[clap(name = "direct")] | ||
DirectQuery { | ||
#[clap(long, default_value = "100")] | ||
num_queries: u64, | ||
#[clap(long, default_value = "1")] | ||
num_threads: usize, | ||
}, | ||
|
||
/// Benchmark JSON RPC endpoints | ||
#[clap(name = "jsonrpc")] | ||
JsonRpc { | ||
#[clap(long, default_value = "http://127.0.0.1:9000")] | ||
endpoint: String, | ||
#[clap(long, default_value = "100")] | ||
num_queries: u64, | ||
#[clap(long, default_value = "1")] | ||
num_threads: usize, | ||
}, | ||
|
||
/// Benchmark GraphQL queries | ||
#[clap(name = "graphql")] | ||
GraphQL { | ||
#[clap(long, default_value = "http://127.0.0.1:9000/graphql")] | ||
endpoint: String, | ||
#[clap(long, default_value = "100")] | ||
num_queries: u64, | ||
#[clap(long, default_value = "1")] | ||
num_threads: usize, | ||
}, | ||
} | ||
|
||
pub fn run_benchmarks() -> Result<()> { | ||
let opts: Opts = Opts::parse(); | ||
|
||
match opts.command { | ||
Command::DirectQuery { num_queries, num_threads } => { | ||
println!("Running direct query benchmark with {} queries and {} threads", num_queries, num_threads); | ||
Ok(()) | ||
} | ||
Command::JsonRpc { endpoint, num_queries, num_threads } => { | ||
println!("Running JSON RPC benchmark against {} with {} queries and {} threads", endpoint, num_queries, num_threads); | ||
// TODO: Implement JSON RPC benchmark | ||
Ok(()) | ||
} | ||
Command::GraphQL { endpoint, num_queries, num_threads } => { | ||
println!("Running GraphQL benchmark against {} with {} queries and {} threads", endpoint, num_queries, num_threads); | ||
// TODO: Implement GraphQL benchmark | ||
Ok(()) | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use anyhow::Result; | ||
|
||
use sui_rpc_benchmark::run_benchmarks; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<()> { | ||
run_benchmarks() | ||
} |