forked from mtusi2026/mtusi2026lab3
Track 1 of grade 5 asks to compare one, two and four API replicas at a fixed total CPU and memory budget, to grow resources until a shared dependency saturates, to show with database, balancer and pool metrics why more replicas stop helping, and to confirm one improvement with a before and after measurement. The hypotheses are stated before any run: at 4 CPU / 2 GiB the 1x4, 2x2 and 4x1 layouts reach the same ceiling within 15 percent; with one CPU per replica throughput grows almost linearly up to four replicas and by less than 1.5 times from four to eight, because PostgreSQL saturates on the chat row lock held across three round trips and on CPU, while the balancer stays far from its limit. The new lab3-scaling-cost capability fixes the method: open-model k6 with the level 4 profile, three repeats per point, equal workers, pool and balancer concurrency across layouts, CPU pinning per component, raw samples per step, plots from summary files, and an improvement chosen only after the bottleneck is found. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>