diff --git a/.gitignore b/.gitignore index b5a7189..5a5393d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Local/private state .env .env.* +venv/ !.env.example secrets/ certs/private/ diff --git a/evidence/scaling-p95.png b/evidence/scaling-p95.png new file mode 100644 index 0000000..817a38c Binary files /dev/null and b/evidence/scaling-p95.png differ diff --git a/evidence/scaling-rps.png b/evidence/scaling-rps.png new file mode 100644 index 0000000..1d806eb Binary files /dev/null and b/evidence/scaling-rps.png differ diff --git a/scripts/plot-scaling.py b/scripts/plot-scaling.py new file mode 100644 index 0000000..6fbd70b --- /dev/null +++ b/scripts/plot-scaling.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 +from pathlib import Path + +import plotly.graph_objects as go + +ROOT = Path(__file__).resolve().parent.parent +EVIDENCE = ROOT / "evidence" + + +def make_rps_chart(): + fig = go.Figure() + fig.add_trace(go.Scatter( + x=[1, 2, 4], y=[135, 58, 35], + mode="lines+markers+text", + text=["135", "58", "35"], + textposition="top center", + line=dict(width=3, color="#d62728"), + marker=dict(size=14, color="#d62728"), + name="Before (least_conn, 30 clients)", + )) + fig.add_trace(go.Scatter( + x=[1, 2], y=[137, 174], + mode="lines+markers+text", + text=["137", "174"], + textposition="top center", + line=dict(width=3, color="#2ca02c"), + marker=dict(size=14, color="#2ca02c"), + name="After (round-robin, 20 clients)", + )) + fig.update_layout( + title="RPS vs API replicas", + xaxis=dict(title="Number of API replicas", tickmode="array", tickvals=[1, 2, 4]), + yaxis_title="RPS (median of 3 runs)", + template="plotly_white", + ) + fig.write_image(str(EVIDENCE / "scaling-rps.png")) + + +def make_p95_chart(): + fig = go.Figure() + fig.add_trace(go.Scatter( + x=[1, 2, 4], y=[260, 165, 421], + mode="lines+markers+text", + text=["260", "165", "421"], + textposition="top center", + line=dict(width=3, color="#d62728"), + marker=dict(size=14, color="#d62728"), + name="Before (least_conn, 30 clients)", + )) + fig.add_trace(go.Scatter( + x=[1, 2], y=[124, 180], + mode="lines+markers+text", + text=["124", "180"], + textposition="top center", + line=dict(width=3, color="#2ca02c"), + marker=dict(size=14, color="#2ca02c"), + name="After (round-robin, 20 clients)", + )) + fig.update_layout( + title="p95 latency vs API replicas", + xaxis=dict(title="Number of API replicas", tickmode="array", tickvals=[1, 2, 4]), + yaxis_title="p95 latency (ms, median of 3 runs)", + template="plotly_white", + ) + fig.write_image(str(EVIDENCE / "scaling-p95.png")) + + +def main(): + make_rps_chart() + make_p95_chart() + print(f"Saved charts to {EVIDENCE}") + + +if __name__ == "__main__": + main() \ No newline at end of file