Files
mtusi2026lab3/evidence/track1.json
T
vika 59f8c55f93 Поставить несколько реплик API за общий балансировщик.
Сессия и ключ идемпотентности общие для реплик, миграция выполняется один раз, остановка одной реплики не теряет подтверждённые сообщения.
2026-10-30 01:15:28 +03:00

230 lines
5.8 KiB
JSON

{
"hypothesis": "With a fixed total of 1.0 CPU and 1024 MiB, more API replicas will not raise RPS, because each process gets a smaller CPU slice. Extra replicas should help only when each keeps its own CPU. A larger DB pool or a global cap lock was checked as a possible next limit.",
"conclusion": "Fixed budget: cap off, 1 replica 184.7 RPS, 2 replicas 165.2, 4 replicas 109.2. Grow budget at 0.50 CPU each: 84.7, 148.0, 329.2 RPS. Pool 4 to 16 at 4x0.50 CPU did not raise RPS (329.2 to 319.0). Postgres stayed under 0.35 core. The confirmed improvement is giving each replica its own 0.50 CPU instead of slicing 1.0 CPU into four processes.",
"profile": {
"tool": "tests/load.py closed-loop POST messages",
"duration_seconds": 12,
"concurrency": 8,
"fixed_total": "1.0 CPU and 1024 MiB split across 1/2/4 replicas",
"grow": "0.50 CPU and 256 MiB per replica, count 1/2/4"
},
"host": {
"platform": "Windows-10-10.0.26100-SP0",
"python": "3.11.5",
"cpu_count": 16,
"docker_info": "16 8173215744"
},
"runs": [
{
"series": "fixed-strict",
"replicas": 1,
"cpus_each": "1.0",
"memory_each": "1024M",
"cap": "strict",
"pool_max": 4,
"instances_seen": 1,
"successful_rps": 158.286,
"failed_requests": 0,
"successful_requests": 1939,
"latency_ms": {
"p50": 47.0,
"p95": 94.0,
"p99": 125.0
},
"cpu_api_mean": 74.21,
"cpu_postgres_mean": 23.25,
"cpu_lb_mean": 10.45,
"load_exit": 0
},
{
"series": "fixed-strict",
"replicas": 2,
"cpus_each": "0.50",
"memory_each": "512M",
"cap": "strict",
"pool_max": 4,
"instances_seen": 2,
"successful_rps": 174.844,
"failed_requests": 0,
"successful_requests": 2131,
"latency_ms": {
"p50": 32.0,
"p95": 109.0,
"p99": 187.0
},
"cpu_api_mean": 30.32,
"cpu_postgres_mean": 26.05,
"cpu_lb_mean": 6.4,
"load_exit": 0
},
{
"series": "fixed-strict",
"replicas": 4,
"cpus_each": "0.25",
"memory_each": "256M",
"cap": "strict",
"pool_max": 4,
"instances_seen": 4,
"successful_rps": 136.692,
"failed_requests": 0,
"successful_requests": 1666,
"latency_ms": {
"p50": 46.0,
"p95": 188.0,
"p99": 281.0
},
"cpu_api_mean": 18.74,
"cpu_postgres_mean": 15.16,
"cpu_lb_mean": 8.94,
"load_exit": 0
},
{
"series": "fixed-off",
"replicas": 1,
"cpus_each": "1.0",
"memory_each": "1024M",
"cap": "off",
"pool_max": 4,
"instances_seen": 1,
"successful_rps": 184.701,
"failed_requests": 0,
"successful_requests": 2277,
"latency_ms": {
"p50": 32.0,
"p95": 93.0,
"p99": 109.0
},
"cpu_api_mean": 80.13,
"cpu_postgres_mean": 15.36,
"cpu_lb_mean": 8.82,
"load_exit": 0
},
{
"series": "fixed-off",
"replicas": 2,
"cpus_each": "0.50",
"memory_each": "512M",
"cap": "off",
"pool_max": 4,
"instances_seen": 2,
"successful_rps": 165.162,
"failed_requests": 0,
"successful_requests": 2013,
"latency_ms": {
"p50": 31.0,
"p95": 125.0,
"p99": 203.0
},
"cpu_api_mean": 36.09,
"cpu_postgres_mean": 15.01,
"cpu_lb_mean": 10.63,
"load_exit": 0
},
{
"series": "fixed-off",
"replicas": 4,
"cpus_each": "0.25",
"memory_each": "256M",
"cap": "off",
"pool_max": 4,
"instances_seen": 4,
"successful_rps": 109.204,
"failed_requests": 0,
"successful_requests": 1336,
"latency_ms": {
"p50": 31.0,
"p95": 281.0,
"p99": 329.0
},
"cpu_api_mean": 16.83,
"cpu_postgres_mean": 11.07,
"cpu_lb_mean": 7.92,
"load_exit": 0
},
{
"series": "grow-off",
"replicas": 1,
"cpus_each": "0.50",
"memory_each": "256M",
"cap": "off",
"pool_max": 4,
"instances_seen": 1,
"successful_rps": 84.703,
"failed_requests": 0,
"successful_requests": 1031,
"latency_ms": {
"p50": 94.0,
"p95": 203.0,
"p99": 219.0
},
"cpu_api_mean": 42.47,
"cpu_postgres_mean": 7.93,
"cpu_lb_mean": 4.44,
"load_exit": 0
},
{
"series": "grow-off",
"replicas": 2,
"cpus_each": "0.50",
"memory_each": "256M",
"cap": "off",
"pool_max": 4,
"instances_seen": 2,
"successful_rps": 147.996,
"failed_requests": 0,
"successful_requests": 1806,
"latency_ms": {
"p50": 32.0,
"p95": 141.0,
"p99": 203.0
},
"cpu_api_mean": 31.2,
"cpu_postgres_mean": 15.35,
"cpu_lb_mean": 9.64,
"load_exit": 0
},
{
"series": "grow-off",
"replicas": 4,
"cpus_each": "0.50",
"memory_each": "256M",
"cap": "off",
"pool_max": 4,
"instances_seen": 4,
"successful_rps": 329.198,
"failed_requests": 0,
"successful_requests": 4007,
"latency_ms": {
"p50": 16.0,
"p95": 78.0,
"p99": 125.0
},
"cpu_api_mean": 34.41,
"cpu_postgres_mean": 34.01,
"cpu_lb_mean": 30.12,
"load_exit": 0
},
{
"series": "pool-16",
"replicas": 4,
"cpus_each": "0.50",
"memory_each": "256M",
"cap": "off",
"pool_max": 16,
"instances_seen": 4,
"successful_rps": 319.011,
"failed_requests": 0,
"successful_requests": 3883,
"latency_ms": {
"p50": 16.0,
"p95": 78.0,
"p99": 171.0
},
"cpu_api_mean": 30.75,
"cpu_postgres_mean": 31.35,
"cpu_lb_mean": 21.05,
"load_exit": 0
}
]
}