75 lines
2.2 KiB
Python
75 lines
2.2 KiB
Python
#!/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() |