# Failures and scaling

> What happens when SES, the database or your webhook fails, and how Mail grows.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://mail.docs.sypnia.com/architecture/failures-and-scaling/

For agents: Mail failures: SES throttle → queued with backoff 24 h; DB down → API 503, SMTP 451 (clients retry); event receiver down → SQS holds 14 days, DLQ + alarm; webhook → 24 h retries then replay; sender stopped → queue drains in order; bad template → published version kept, rollback. Scaling: per-project pace, stateless Lambda, monthly partitions detached at retention, SES quotas raised ahead.

## Failures

| What fails              | What happens                                                                                                      |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------- |
| SES throttles or errors | e-mails stay `queued` and are retried with backoff for 24 hours; nothing is lost                                  |
| The database            | the API answers `503`; the SMTP relay answers `451` (try later), which SMTP clients retry on their own            |
| The event receiver      | events wait in SQS for up to 14 days; after repeated failures they go to the dead-letter queue and an alarm fires |
| Your webhook            | retries for 24 hours, then undelivered and replayable                                                             |
| The sender is stopped   | the queue grows and drains when it starts again, in order per project                                             |
| A bad template version  | sends keep using the published version; roll back with one command                                                |

## Scaling

- The sender scales by project: each project has its own pace, so one project's burst does not delay another's.
- The API and the receivers are stateless and scale with Lambda.
- `emails` and `email_events` are partitioned by month; old partitions are detached when retention ends.
- SES sending quotas are raised with AWS ahead of growth; the console shows each project's share.
