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

Refactor benchmark output handling and add JSON/HTML support #1416

Merged
merged 1 commit into from
Jan 25, 2025
Merged
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
134 changes: 100 additions & 34 deletions Cargo.lock

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

11 changes: 10 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ codegen-units = 1

[workspace]
resolver = "2"
members = ["bench", "cli", "examples", "integration", "sdk", "server", "tools"]
members = [
"bench",
"bench/report",
"cli",
"examples",
"integration",
"sdk",
"server",
"tools"
]

[workspace.metadata.cargo-machete]
ignored = ["openssl"]
10 changes: 5 additions & 5 deletions bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ license = "Apache-2.0"

[dependencies]
async-trait = "0.1.85"
charming = "0.4.0"
chrono = "0.4.31"
clap = { version = "4.5.26", features = ["derive"] }
colored = "3.0.0"
csv = "1.3.1"
derive-new = "0.7.0"
derive_more = "1.0.0"
figlet-rs = "0.1.5"
futures = "0.3.31"
human_format = "1.1.0"
iggy = { path = "../sdk" }
iggy-benchmark-report = { path = "report" }
integration = { path = "../integration" }
nonzero_lit = "0.1.2"
serde = { version = "1.0.217", features = ["derive"] }
tokio = { version = "1.43.0", features = ["full"] }
toml = "0.8.19"
tracing = { version = "0.1.41" }
tracing-appender = "0.2.3"
tracing-subscriber = { version = "0.3.19", features = ["fmt", "env-filter"] }
uuid = { version = "1.12.1", features = ["serde"] }

[[bin]]
name = "iggy-bench"
Expand Down
18 changes: 18 additions & 0 deletions bench/report/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "iggy-benchmark-report"
version = "0.1.0"
edition = "2021"
description = "Benchmark report and chart generation library for iggy-bench binary and iggy-benchmarks-dashboard web app"
license = "Apache-2.0"

[dependencies]
byte-unit = "5.1.6"
charming = "0.4.0"
colored = "3.0.0"
derive-new = "0.7.0"
derive_more = { version = "1.0.0", features = ["full"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
sysinfo = "0.33.1"
tracing = "0.1"
uuid = { version = "1.12.1", features = ["serde"] }
115 changes: 115 additions & 0 deletions bench/report/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
pub mod plotting;
pub mod types;

mod prints;
mod utils;

use crate::report::BenchmarkReport;
use actor_kind::ActorKind;
use charming::Chart;
use group_metrics_kind::GroupMetricsKind;
use plotting::chart::IggyChart;
use plotting::chart_kind::ChartKind;

pub use types::*;

pub fn create_throughput_chart(report: &BenchmarkReport, dark: bool) -> Chart {
let title = report.title(ChartKind::Throughput);

let mut chart = IggyChart::new(&title, &report.subtext(), dark)
.with_time_x_axis()
.with_dual_y_axis("Throughput [MB/s]", "Throughput [msg/s]");

// Add individual metrics series
for metrics in &report.individual_metrics {
let actor_type = match metrics.summary.actor_kind {
ActorKind::Producer => "Producer",
ActorKind::Consumer => "Consumer",
};

chart = chart.add_dual_time_line_series(
&format!("{} {} [MB/s]", actor_type, metrics.summary.actor_id),
metrics.throughput_mb_ts.as_charming_points(),
None,
0.4,
0,
1.0,
);
chart = chart.add_dual_time_line_series(
&format!("{} {} [msg/s]", actor_type, metrics.summary.actor_id),
metrics.throughput_msg_ts.as_charming_points(),
None,
0.4,
1,
1.0,
);
}

// Add group metrics series
for metrics in &report.group_metrics {
// Skip aggregate metrics in charts
if metrics.summary.kind == GroupMetricsKind::ProducersAndConsumers {
continue;
}

chart = chart.add_dual_time_line_series(
&format!("All {}s [MB/s]", metrics.summary.kind.actor()),
metrics.avg_throughput_mb_ts.as_charming_points(),
None,
1.0,
0,
2.0,
);
chart = chart.add_dual_time_line_series(
&format!("All {}s [msg/s]", metrics.summary.kind.actor()),
metrics.avg_throughput_msg_ts.as_charming_points(),
None,
1.0,
1,
2.0,
);
}

chart.inner
}

pub fn create_latency_chart(report: &BenchmarkReport, dark: bool) -> Chart {
let title = report.title(ChartKind::Latency);

let mut chart = IggyChart::new(&title, &report.subtext(), dark)
.with_time_x_axis()
.with_y_axis("Latency [ms]");

// Add individual metrics series
for metrics in &report.individual_metrics {
let actor_type = match metrics.summary.actor_kind {
ActorKind::Producer => "Producer",
ActorKind::Consumer => "Consumer",
};

chart = chart.add_time_series(
&format!("{} {} [ms]", actor_type, metrics.summary.actor_id),
metrics.latency_ts.as_charming_points(),
None,
0.3,
);
}

for metrics in &report.group_metrics {
// Skip aggregate metrics in charts
if metrics.summary.kind == GroupMetricsKind::ProducersAndConsumers {
continue;
}

chart = chart.add_dual_time_line_series(
&format!("Avg {}s [ms]", metrics.summary.kind.actor()),
metrics.avg_latency_ts.as_charming_points(),
None,
1.0,
0,
3.0,
);
}

chart.inner
}
Loading
Loading