Strict expiry vs stale-while-revalidate

Strict expiry drops an entry when its time ends. Stale-while-revalidate keeps serving the old value for a set time while it fetches a new one. When the origin is down for 10 s, strict expiry gives 91.5 percent availability. A 15 s stale window cuts errors to 0.5 percent.

Play the level

Strict expiry, 10 s TTLTap or press Space to add a stale window

No stale window · 4 of 10 reads fail in the outage · oldest answer 10 s, limit 30 s

Serve stale for 15 sTap or press Space to add a stale window

15 s stale window · 0 of 10 reads fail in the outage · oldest answer 25 s, limit 30 s

Case 1

1,000 reads/s over 100 keys. The origin is down from 0:30 to 0:40 and entries expire after 10 s. Availability must stay at 99 percent. No value may be older than 30 s.

Case 1
Measure Goal Strict expiry, 10 s TTL Serve stale for 15 s
Availability at least 99% 91.5% Fail 99.465% Pass
Data age under 30 s 10 s Pass 19.9 s Pass
Monthly cost 8 USD/mo 8 USD/mo
p99 latency 24 ms 24 ms
Error rate 8.5% 0.5%
HTTP/2SQLUsersRedis cache0.25 vCPU · 0.5 GBPostgres0.5 vCPU · 1 GB
HTTP/2SQLUsersRedis cache0.25 vCPU · 0.5 GBPostgres0.5 vCPU · 1 GB
Strict expiry, 10 s TTL: misses a goal
HTTP/2SQLUsersRedis cache0.25 vCPU · 0.5 GBPostgres0.5 vCPU · 1 GB
HTTP/2SQLUsersRedis cache0.25 vCPU · 0.5 GBPostgres0.5 vCPU · 1 GB
Serve stale for 15 s: meets the goals