DEV Community

Cover image for 🚨 Why Your Spring Boot API Takes 3 Seconds to Respond (And How We Reduced It to 200 ms)
Pramod Kumar
Pramod Kumar

Posted on

🚨 Why Your Spring Boot API Takes 3 Seconds to Respond (And How We Reduced It to 200 ms)

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)

Collapse
 
pramod_kumar_0820 profile image
Pramod Kumar

What’s the slowest API response time you’ve ever debugged?