Spring Boot-இல் performance tuning பெரும்பாலும் database boundary பற்றியது: connection pooling, caching, மற்றும் N+1 query problem-ஐ கொல்வது. முதலில் அளவிடுங்கள் (Micrometer + Actuator metrics), பிறகு மிகப்பெரிய செலவைத் தாக்குங்கள்.
N+1 problem — முதன்மையான JPA கொலைகாரன்
Lazy association-கள் ஒவ்வொரு parent-க்கும் ஒரு query-ஐ வெளியிடுகின்றன, பிறகு ஒவ்வொரு child access-க்கும் மேலும் ஒன்றை:
List<Order> orders = orderRepo.findAll();
(Order o : orders) {
o.getItems().size();
}
