How Sauna runs 2 million Turso databases for its AI assistant
Brief
Sauna runs 2 million+ Turso databases — one per AI session, inbox and calendar, about 90,000 created daily — after migrating off Cloudflare Durable Objects and Litestream.
Architecture
- Every session, agent, inbox and calendar gets its own Turso database holding full chat history or a synced local copy.
- Two in-house elements complete the stack: a two-tier memory system and a versioned, searchable file system for agent drafts.
- Per-database isolation means sharing an inbox shares exactly one database, with no row-level filtering needed for privacy.
Why they moved off Cloudflare and Litestream
- Durable Objects worked for one-database-per-session but the team left over hosting-side problems; Litestream was slow, expensive, and one-way only.
- Turso removed its active-database limit on paid plans in May 2026, removing the pricing barrier.
- Turso Sync keeps data as local files, with atomic rollback/replay on pull, giving local speed plus remote replication.
User-facing benefits
- Idle databases are cheap, so every conversation is retained and searchable indefinitely.
- Data is separate from compute, so Sauna switched hosting providers without data migration; users saw no downtime.
- Background agents can read data without spinning up compute, keeping the always-on assistant affordable.
What's next
- Sauna may move its in-house file system to Turso and experiment with MVCC.
- Turso v0.8's group commit enables up to 500x lower tail latency and 7x higher write throughput than SQLite under concurrent writes.
Generated by AI from the original article. Check the source for full details.