Reduce deploy-time backend latency via lazy Spring initialization#99
Conversation
|
@copilot check there are no thread.sleep delays introduced recently and remove them. I don't need these new changes suggested, please rever them. |
Addressed in commit 44ddf5f. I reverted the lazy-initialization changes and removed the |
There was a problem hiding this comment.
Pull request overview
This PR currently removes an artificial random delay from the backend credit card listing path, improving /api/cards response latency. However, the implementation does not match the described lazy Spring initialization startup optimization.
Changes:
- Removed the random
Thread.sleepfromCreditCardService.getAllCreditCards().
Show a summary per file
| File | Description |
|---|---|
backend/src/main/java/com/threeriversbank/service/CreditCardService.java |
Removes artificial request-path latency from the all-cards service method. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 1
| @@ -33,7 +33,6 @@ public class CreditCardService { | |||
| @Transactional(readOnly = true) | |||
| public List<CreditCardDto> getAllCreditCards() { | |||
| log.info("Fetching all credit cards from H2 database"); | |||
✨ Enhancement
Deployment under active load triggered a response-time spike driven by Spring Boot cold start (~35–37s) during rolling replacement, while request traffic remained healthy (2xx). This PR applies a startup optimization in backend runtime config to reduce cold-start overhead without changing API behavior.
What does this improve?
/api/cards*during revision rollout.Why is this valuable?
Implementation approach:
backend/src/main/resources/application.ymlbackend/src/test/java/com/threeriversbank/repository/CreditCardRepositoryTest.java