Fly.ioAnnouncement
Litestream: Revamped
Summary
Litestream’s redesign aims to make SQLite suitable for more deployment scenarios while preserving its embedded, application-oblivious model. The original tool continuously streamed WAL pages to S3-compatible object storage, but restores could be slow because they replayed every change since the last snapshot. The new design adopts LiteFS’s transaction-aware LTX format, sorted changesets, and compaction, enabling faster point-in-time restores with fewer duplicate pages; conditional writes provide time-based leases that prevent overlapping instances from confusing a destination. Planned additions include a VFS-based read-replica layer that fetches and caches pages from object storage, plus replication across hundreds or thousands of database files. The remote read path may be less efficient than local SQLite, but caching and prefetching are expected to provide strong performance for suitable use cases.
Context
Litestream was created to let full-stack applications use SQLite without tying their data to a single server. Its original WAL streaming and restore design made frequent-write databases slow to restore and made replicating large numbers of databases from one process infeasible.
Approach / What changed
The redesign applies LiteFS learnings through transaction-aware LTX changesets and compaction, conditional object-store writes for time-based leases, and a planned VFS-based read-replica layer that fetches and caches pages from S3-compatible storage. It also enables replication across database files matching patterns such as /data/*.db.
Takeaways
LTX stores sorted, transaction-associated page ranges, allowing multiple time ranges to be compacted into a changeset containing only the latest version of each page.
Conditional writes from modern object stores can provide Litestream with a time-based lease, avoiding a Consul dependency while preventing overlapping instances from confusing one destination.
The planned VFS read-replica layer trades local SQLite efficiency for remote reads from Tigris or S3, with caching and prefetching intended to improve performance for suitable use cases.
Source and freshness
- Source
- fly.io
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.