Before optimization: ~3000 ms
After optimization: ~200 ms
Our Spring Boot API suddenly started taking 3 seconds to respond in production.
But in development it was only 150โ200 ms.
After profiling the system we discovered the issue wasn't one big problem.
It was several small performance bottlenecks working together:
- N+1 Hibernate queries
- missing database indexes
- blocking controller operations
- excessive logging
- large JSON responses
After fixing them step by step, the response time dropped from 3 seconds to around 200 ms.
Here are the exact improvements that made the difference.
๐ Originally published on Medium. Republished here for the Dev.to community:
https://medium.com/@pramod.er90/why-your-spring-boot-api-takes-3-seconds-to-respond-and-how-to-fix-it-160f37a4aaa7
Top comments (1)
Whatโs the slowest API response time youโve ever debugged?