Startup

Cached web app

ALB → three EC2 servers using ElastiCache (cache-aside) in front of RDS PostgreSQL. At 60 s Redis is flushed.

Cached web app running in the ServerSloth simulator

What this architecture teaches

Cache-aside is the most common caching pattern: the application checks Redis first, and only on a miss reads PostgreSQL and writes the value back.

The database only sees reads the cache misses plus every write: λ_DB = λ_read × (1 − H) + λ_write. Writes also invalidate keys, which is why the hit ratio settles below its theoretical maximum.

At 60 seconds the template flushes Redis. Every read becomes a miss at once, the database receives several times its normal load, and connections run out — a cache stampede. Recovery takes as long as the cache needs to warm up again.

What to look for

Components

Scripted events

Failure modes you will see