Senior
Application metrics also change: usually 2ms, but every 10th request — 300-400ms. Resources are fine. The app only makes requests to Redis and RDS. What could be the reasons?
sobes.tech AI
Answer from AI
The reasons for periodic response time increases (every 10th request — 300-400 ms) with normal resources and using only Redis and RDS could be:
- Cache misses in Redis: some requests may not hit the cache, leading to database access, which is slower.
- Peak load on RDS: even with normal resources, there could be locks or long queries due to contention or complex queries.
- Connection pool issues: if the connection pool to the database or Redis is limited, some requests wait for a connection to be freed.
- Garbage collection (GC) in the application: periodic GC pauses can slow down request processing.
- Background jobs or periodic tasks: such as cache updates, backups, or other operations affecting delays.
For diagnostics, it is recommended to:
- Analyze Redis and RDS logs and metrics.
- Check the usage and configuration of connection pools.
- Review GC metrics and application profiling.
- Track whether slow requests coincide with any background tasks.