FlaskRedis

Excessive caching causes high memory usage and cache thrashing

warning
Resource ContentionUpdated Dec 3, 2024(via Exa)
How to detect:

Caching too much data leads to high memory usage, potential out-of-memory conditions, and cache thrashing where useful data is evicted.

Recommended action:

Monitor memory usage with process.resident_memory_bytes and process.virtual_memory_bytes. Implement cache size limits and eviction policies. Use tools like Prometheus and Grafana to track memory trends. Cache only frequently accessed data with appropriate TTLs.