Card 06/ 06
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.
| The idea | Where |
|---|---|
| Lazy loading in a loop turns one list query into N+1 | The N+1 Query Problem |
| The extra queries add up: 30 at 20 ms is 600 ms before anything else | N+1 Example: What the Extra Queries Cost in Milliseconds |
| A remote call needs a timeout, and ideally a circuit breaker | Timeouts and Circuit Breakers for Remote Calls |
| Measure, identify, optimise, repeat: a query log beats a guess | Measuring 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.
← → move through sections and cards