Here are 15 real production scenario-based questions:1. Your Spring Boot service CPU suddenly spikes to 90% in production. How will you investigate and fix it?2. After deployment, your service starts throwing intermittent 500 errors. How will you debug this issue?3. One microservice goes down and causes a chain failure in other services. How will you prevent this in future?4. Your API response time increased from 200ms to 3 seconds after a new release. How will you identify the root cause?5. Database connections are getting exhausted under load. What steps will you take to fix this?6. A third-party service you depend on is timing out frequently. How will you handle this in your system?7. You observe duplicate transactions happening in your system. How will you prevent this?8. Logs are too large and distributed, making debugging difficult. How will you improve observability?9. Memory usage keeps increasing and your service crashes after some time. How will you detect and fix memory leaks?10. Your microservice works fine locally but fails in production. How will you approach debugging?11. A new deployment breaks one feature but works for others. How will you safely roll back?12. Traffic suddenly spikes 5x during peak hours and your service becomes slow. How will you scale?13. Inter-service communication is failing due to network latency. How will you optimize it?14. You need to trace a single request across multiple services during a failure. How will you implement tracing?15. A bug in one service causes inconsistent data across multiple services. How will you handle data consistency?
Cpu Spike
Bir başka örnek burada
Database connections are getting exhausted under load
Örnek şöyle
@Servicepublic class UserService {@Autowiredprivate JdbcTemplate jdbcTemplate; // OK@Transactionalpublic void updateUsers(List<User> users) {users.forEach(user ->jdbcTemplate.update("UPDATE users SET last_login = ? WHERE id = ?",LocalDateTime.now(), user.getId()));@Async@Transactionalpublic void asycnUpdateUser(User user) {jdbcTemplate.update("UPDATE users SET last_login = ? WHERE id = ?",LocalDateTime.now(), user.getId());}}
Açıklaması şöyle
Async threads can scale independently, but database connections cannot. This quickly overwhelms the connection pool.