Doubled vCPU+RAM: TTFB 540ms -> 510ms.
More hardware helps when you're CPU/memory-bound. Most slow TTFB is I/O-bound: serial DB queries waiting on each other.
— Here one page issued 312 sequential queries (N+1). The CPU sat near-idle; it was waiting.
— Eager-loading the relation collapsed 312 queries to 4: TTFB 540ms -> 95ms on the same old box.
Bigger iron doesn't fix a waiting bottleneck.
Takeaway: hardware bought 30ms; killing the N+1 bought 445ms.
Millisecond Mafia
@MillisecondMafia
Myth: Upgrade the server to fix slow pages
This post was published in the Telegram channel Millisecond Mafia (@MillisecondMafia). All its posts are on the channel page.
Open on Telegram