Card 06/ 06

RecapDifficulty: Advanced1 min

Recap: Where a Spring Boot API Gets Slow

N+1 queries and their cost, remote calls without limits, and measuring first.

Finding why an API is slow comes down to the four ideas below, each listed with the card that covers it.

What the topic established, and which card it was on
The ideaWhere
Lazy loading in a loop turns one list query into N+1The N+1 Query Problem
The extra queries add up: 30 at 20 ms is 600 ms before anything elseN+1 Example: What the Extra Queries Cost in Milliseconds
A remote call needs a timeout, and ideally a circuit breakerTimeouts and Circuit Breakers for Remote Calls
Measure, identify, optimise, repeat: a query log beats a guessMeasuring Performance Before Optimising

Most slow Spring Boot endpoints turn out to be one of the first three, and the fourth is how you find out which.