Redis makes Spring Boot APIs faster until load, expiry or lock timing changes. These articles cover cache behaviour under real traffic, expiry-driven latency spikes, memory growth from caches without limits, and distributed locks that expire while the job is still running.
All articles on this page are also collected in a Medium list you can save and follow.
Start here
- Our Redis Lock Expired. The Report Job Kept Running. — what happens when a lock’s TTL is shorter than the job it protects
- Redis Caching Made Our Spring Boot API Slower — when a cache adds latency instead of removing it
- Redis Cache Expiration Caused Hidden Latency Spikes — latency spikes when many keys expire together
Distributed locks
- Our Redis Lock Expired. The Report Job Kept Running. — lease expiry, owner-checked renewal and fencing tokens
Caching under load
- Redis Caching Made Our Spring Boot API Slower — cache overhead that made responses slower
- Redis Cache Looked Faster Until Load Changed — a cache that only helped under light load
- Redis Made the API Faster, Then Exposed a Different Bottleneck — the bottleneck that appeared after caching
- Redis Cache Expiration Caused Hidden Latency Spikes — expiry-driven latency spikes
- Spring Boot Didn’t Leak Memory. Our Redis Cache Had No Exit Strategy. — unbounded caches and eviction strategy
Setup and fundamentals
- Spring Boot Caching — @Cacheable, @CachePut and @CacheEvict basics
- Redis on Docker Lost Data After Restarting — Redis and RedisInsight in Docker
- Redis Rate Limiting in Spring Boot API Gateway Guide — rate limiting in a Spring Boot API gateway with Redis
Also on bytzecho.com
Versions of these articles on this site, with extended code and notes.
- Our Redis Lock Expired. The Spring Boot Job Kept Running. — lease expiry and the safeguards to test.
- Redis Cache Expiration Causes Hidden Latency Spikes — why expiration timing can turn into user-visible latency.
- Spring Boot Redis Benchmark: When Caching Made Latency Worse — the failure mode where caching adds instability instead of removing it.
- Redis Made This Spring Boot API 30x Faster in a Load Test — a case where caching changed the API performance profile dramatically.
- Spring Boot Caching with Redis: Full Integration Guide — Spring Boot and Redis integration path.
- Spring Boot Caching — core caching concepts tied to performance behavior.
- Redis Rate Limiting in Spring Boot API Gateway Guide — Redis as a shared coordination layer for gateway limits.
- Redis on Docker and Redis Insight — a local setup for inspecting keys and behavior.
Frequently asked questions
What happens when a Redis lock expires while the job is still running?
Redis removes the key when its TTL ends, so a second instance can acquire the lock and run the same job concurrently. Renew the lease only while the original owner holds it, make the job’s writes idempotent, or use fencing tokens when stale writes would corrupt data. See Our Redis Lock Expired. The Report Job Kept Running.
Why can Redis caching make a Spring Boot API slower?
Every cache lookup adds a network round trip and serialization. When hit rates are low or cached values are large, that overhead can exceed the cost of the original query. Measure hit rate and latency before and after adding the cache.
Why do cache expirations cause latency spikes?
When many keys share the same TTL they expire together, and every request falls through to the database at once. Adding random jitter to TTLs and letting one request rebuild a missing entry spreads that load out.
New articles are published on Medium first. Subscribe to the newsletter to get production lessons by email.