# Budget guardrails for Upstash Redis

## Set the cap

On pay-as-you-go databases, set a monthly budget cap in the console
when you create the database. You get email alerts at 70% and 90%.
Past 100%, the database rate limits instead of billing more. Cost
cannot exceed the cap.

## What rate limiting past the cap looks like

Requests start failing or slowing. That is the designed behavior:
the alternative is an unbounded invoice. Make sure your app treats
Redis failures as degradable (serve stale cache, skip the
non-critical write) rather than crashing.

## Size the cap

1. Estimate commands per request for your hottest paths.
2. Multiply by expected requests. Add headroom for retries,
   analytics, and deny-list overhead.
3. Set the cap above the estimate but below the number that would
   ruin your week.

Remember the free 500K commands do not stack on paid tiers: once
you upgrade, everything is metered from zero.

## Alerts are not enough alone

The 70% and 90% emails tell you a spike is happening. The cap is
what stops it from billing. Set both, and make sure the alert
email goes to someone who can act, not a dead list.

## Verify

Check the console: the cap is set, the alert thresholds show 70%
and 90%, and a load test against a staging database with a tiny
cap actually rate limits instead of billing past it.