r/Database • u/kaoD • 12h ago
Turso Cloud cold starts?
Does anyone have experience with Turso Cloud in production?
I am evaluating Turso Cloud as a a D1 replacement that's not tied to CloudFlare and I'm facing an unexpected situation that is making it unusable for me and I'm wondering if it's the product's fault or mine.
In particular: I'm facing cold start issues, which are supposed to be one of Turso's strengths ("it's just a file, nothing scales to zero"). The first query after the app has been idle for a few seconds is very slow. Every query right after it is fast.
There are two separate costs:
- Reconnecting. Node's
fetchdrops idle connections after 4 s, and Turso closes them after 5 s anyway. A new TCP+TLS connection costs about 110–140 ms from GCP in NL to their AWS in IE. Annoying, but expected (this is already making me question my sanity TBH). - Something inside Turso. This is the weirdest part. Turso's own
query_duration_ms, returned in the/v2/pipelineresponse, which leaves out the network, shows it:
| Idle before the query | Query after the pause (Turso's own time) | Same query right after |
|---|---|---|
| 1 s (baseline: not cold yet) | 0.6 ms | 0.1 ms |
| 3 s (same connection, kept open) | 118 ms | 0.1 ms |
| 10 s | 235 ms | 0.1 ms |
| 30 s | 472 ms | 0.1 ms |
| 60 s | 111 ms | 0.1 ms |
That's a primary-key lookup that reads 0–2 rows on a freshly created test database!!
In my "production" DB it's even worse, the first query of a page load spends about 1 s inside Turso before anything else runs. That's very noticeable to users on EVERY page load that takes >4s from the latest access.
My guess is the diskless architecture, where the local disk is only a cache in front of S3, evicting idle databases very aggressively. But I can't find that documented anywhere and, well... it really is a deal breaker.
Is anyone running Turso Cloud in production with traffic that goes quiet for a few seconds at a time? Do you see this, and did you find a fix other than keeping the database warm?
All their marketing pages would point to the contrary ("even a cache miss that results in a disk read takes a few microseconds").
I don't want to maintain a local replica because my app is fully serverless with ephemeral state and, well, at that point I might as well just use SQLite locally.
Someone on Reddit faced a similar issue 3 years ago but that was before they announced this change which is supposed to remove cold starts and it was supposed to be >1hr to sleep, not seconds.