Provisioning a mailbox in nine seconds
A walkthrough of the pipeline that turns a chosen username into a live, encrypted mailbox.
The budget
Nine seconds, end to end, from submitted form to a mailbox that can receive mail. Here is where the time goes.
| Stage | Budget |
|---|---|
| Address validation | 120 ms |
| Row insert + RLS check | 40 ms |
| DNS propagation wait | 6 s |
| Provider handshake | 2 s |
| Warm-up probe | 500 ms |
Validation first
We reject impossible addresses before touching the database:
const ADDRESS = /^[a-z0-9]([a-z0-9._-]{1,28})[a-z0-9]$/;
export function isValidLocalPart(value: string) {
return ADDRESS.test(value.toLowerCase());
}The slow part is DNS
Six of the nine seconds are spent waiting for the world to agree that a subdomain exists. We hide that latency by optimistically rendering the mailbox and streaming its status.
Failure is a first-class state
Every provisioning attempt writes a queue row. If the provider handshake fails we retry with backoff and surface the attempt count in the dashboard rather than silently dropping it.
Measuring it
p50 is 8.4 s, p95 is 11.2 s. We track both on the monitoring page and alert when p95 crosses fifteen seconds.
About the author
Devansh Rao
Principal Engineer
Devansh builds the provisioning pipeline that turns a chosen username into a live encrypted mailbox in under ten seconds.
All posts by Devansh RaoComments are coming soon
We're wiring up a moderated discussion thread for each post. Until then, reply by email and we'll add good questions to the article.
Send us a note