{ "question": "With a whole core per API replica, extra replicas stop helping when Postgres CPU is the shared cap.", "conclusion": "At a 0.20 CPU Postgres cap, 1/2/4 replicas gave 135.440 / 141.407 / 107.017 RPS. Postgres mean CPU rose toward the cap (13.31, 15.00, 16.89; the cap is about 20 in these units) while API CPU per replica fell, so the API cores were idle. The same 4 replicas with the Postgres cap released to 1.0 CPU gave 352.885 RPS and Postgres used 44.90, under its new cap. LB stayed at 28.18 against a 0.50 cap. The shared limit that stopped replica growth is Postgres CPU.", "method": "tests/load.py closed-loop POST, 12s, concurrency 16, one run each. Postgres limit 0.20 CPU for 1/2/4 replicas, then the same 4 replicas with Postgres limit 1.0.", "host": { "platform": "Windows-10-10.0.26100-SP0", "python": "3.11.5", "docker_info": "16 8173215744" }, "note": "docker stats 100 percent is one core. A 0.20 CPU limit is saturated near 20 percent.", "runs": [ { "name": "pg020-r1", "replicas": 1, "api_cpus_each": "1.0", "postgres_cpus": "0.20", "lb_cpus": "0.50", "pool_max": 4, "concurrency": 16, "duration_seconds": 12, "successful_rps": 135.44, "failed_requests": 0, "successful_requests": 1693, "latency_ms": { "p50": 94.0, "p95": 203.0, "p99": 375.0 }, "cpu_api_mean": 63.85, "cpu_postgres_mean": 13.31, "cpu_lb_mean": 6.64, "load_exit": 0 }, { "name": "pg020-r2", "replicas": 2, "api_cpus_each": "1.0", "postgres_cpus": "0.20", "lb_cpus": "0.50", "pool_max": 4, "concurrency": 16, "duration_seconds": 12, "successful_rps": 141.407, "failed_requests": 0, "successful_requests": 1783, "latency_ms": { "p50": 109.0, "p95": 219.0, "p99": 328.0 }, "cpu_api_mean": 43.39, "cpu_postgres_mean": 15.0, "cpu_lb_mean": 9.32, "load_exit": 0 }, { "name": "pg020-r4", "replicas": 4, "api_cpus_each": "1.0", "postgres_cpus": "0.20", "lb_cpus": "0.50", "pool_max": 4, "concurrency": 16, "duration_seconds": 12, "successful_rps": 107.017, "failed_requests": 0, "successful_requests": 1336, "latency_ms": { "p50": 110.0, "p95": 312.0, "p99": 453.0 }, "cpu_api_mean": 23.35, "cpu_postgres_mean": 16.89, "cpu_lb_mean": 8.5, "load_exit": 0 }, { "name": "pg100-r4", "replicas": 4, "api_cpus_each": "1.0", "postgres_cpus": "1.0", "lb_cpus": "0.50", "pool_max": 4, "concurrency": 16, "duration_seconds": 12, "successful_rps": 352.885, "failed_requests": 0, "successful_requests": 4422, "latency_ms": { "p50": 31.0, "p95": 156.0, "p99": 203.0 }, "cpu_api_mean": 49.66, "cpu_postgres_mean": 44.9, "cpu_lb_mean": 28.18, "load_exit": 0 } ] }