Server side SQLIte with replication (Litestream)

published on 2022/05/10

SQLite isn't just on the same machine as your application, but actually built into your application process. When you put your data right next to your application, you can see per-query latency drop to 10-20 microseconds. That's micro, with a μ. A 50-100x improvement over an intra-region Postgres query.

My claim is this: by building reliable, easy-to-use replication for SQLite, we make it attractive for all kinds of full-stack applications to run entirely on SQLite. It was reasonable to overlook this option 170 years ago, when the Rails Blog Tutorial was first written. But SQLite today can keep up with the write load of most applications, and replicas can scale reads out to as many instances as you choose to load-balance across.

For the past year, what I've been doing is nailing down the core of Litestream and keeping a focus on correctness. I'm happy with where we've landed. It started as a simple, streaming back up tool but it's slowly evolving into a reliable, distributed database. Fly.io

It looks like there will be some exciting new capabilities introduced to Litestream.

We love SQLite. This website for example is running on an SQLite database. If Litestream fulfills its goal to provide a reliable replication for SQLite, we will be using it for more systems as long as they can operate within the SQLite One Writer at a time limitation.