23 lines
941 B
Python
23 lines
941 B
Python
#!/usr/bin/env python3
|
|
import json
|
|
from pathlib import Path
|
|
import matplotlib.pyplot as plt
|
|
|
|
root = Path(__file__).resolve().parents[1]
|
|
fixed = json.loads((root / 'evidence/scale_results.json').read_text())
|
|
resources = json.loads((root / 'evidence/scale_resource_results.json').read_text())
|
|
|
|
fig, axes = plt.subplots(1, 2, figsize=(10, 4))
|
|
axes[0].plot([x['replicas'] for x in fixed], [x['successful_rps'] for x in fixed], 'o-')
|
|
axes[0].set_title('Фиксированные 2 CPU / 1 GB')
|
|
axes[0].set_xlabel('API-реплики')
|
|
axes[0].set_ylabel('Успешные RPS')
|
|
axes[0].grid(True)
|
|
axes[1].plot([x['total_cpu_limit'] for x in resources], [x['successful_rps'] for x in resources], 'o-')
|
|
axes[1].set_title('4 реплики, рост CPU')
|
|
axes[1].set_xlabel('Суммарный лимит CPU')
|
|
axes[1].set_ylabel('Успешные RPS')
|
|
axes[1].grid(True)
|
|
fig.tight_layout()
|
|
fig.savefig(root / 'evidence/scale_plot.png', dpi=150)
|