fix reproducibility

This commit is contained in:
2026-10-23 18:21:10 +03:00
parent a7f3ab11a7
commit 0ae9e07b09
21 changed files with 667 additions and 300 deletions
+5 -15
View File
@@ -55,8 +55,6 @@ def dual_axis(ax, xs, rps, p99, xlabel, title):
def main():
series_a = sorted(load_series("A"), key=lambda row: row["replicas"])
series_b = sorted(load_series("B"), key=lambda row: row["db_cpu"])
repeat = load_series("R")
tuned = load_series("P")
if not series_a or not series_b:
raise SystemExit("need series A and B JSON in evidence/")
@@ -66,30 +64,22 @@ def main():
[row["replicas"] for row in series_a],
[row["rps"] for row in series_a],
[row["p99"] for row in series_a],
"API replicas (total CPU = 1.0, DB CPU = 2.0)",
"Серия A: реплики API при фиксированном суммарном CPU",
"API replicas (total CPU = 1.0, total RAM = 512 MiB, DB CPU = 2.0)",
"Серия A: реплики API при фиксированных суммарных CPU и RAM",
)
fig.tight_layout()
fig.savefig(EVIDENCE / "api_scaling.png", dpi=140)
plt.close(fig)
fig, ax = plt.subplots(figsize=(7.2, 4.4))
twin = dual_axis(
dual_axis(
ax,
[row["db_cpu"] for row in series_b],
[row["rps"] for row in series_b],
[row["p99"] for row in series_b],
"PostgreSQL CPU limit (4 API × 0.25 CPU)",
"Серия B: CPU базы и парный прогон тюнинга",
"PostgreSQL CPU limit (4 API × 0.25 CPU, total API RAM = 512 MiB)",
"Серия B: RPS и p99 от CPU базы",
)
if repeat and tuned:
base, point = repeat[-1], tuned[-1]
ax.scatter([base["db_cpu"]], [base["rps"]], marker="x", s=80, color="#1f4e79", zorder=5, label="repeat baseline RPS")
ax.scatter([point["db_cpu"] + 0.08], [point["rps"]], marker="*", s=160, color="#1f4e79", zorder=5, label="tuned RPS")
twin.scatter([base["db_cpu"]], [base["p99"]], marker="x", s=80, color="#b85c38", zorder=5, label="repeat baseline p99")
twin.scatter([point["db_cpu"] + 0.08], [point["p99"]], marker="*", s=160, color="#b85c38", zorder=5, label="tuned p99")
handles = ax.get_lines() + twin.get_lines() + list(ax.collections) + list(twin.collections)
ax.legend(handles, [h.get_label() for h in handles], loc="best", fontsize=8)
fig.tight_layout()
fig.savefig(EVIDENCE / "db_scaling.png", dpi=140)
plt.close(fig)