Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Fly.io 6 min read Release mediumAdept

Litestream v0.5.0 is Here

Litestream v0.5.0 replaces WAL-segment backups with the LTX file format from LiteFS, enabling efficient point-in-time recovery through hierarchical compaction (30-second, 5-minute and hourly levels), so a restore typically needs only a dozen or so files. The 'generations' concept is gone in favor of monotonically increasing transaction IDs, LTX now compresses per page with a trailing index for page-granular access, and CGO is dropped by switching to modernc.org/sqlite. Upgrading is drop-in with a backwards-compatible config, but v0.5.0 cannot restore old v0.3.x WAL segments and allows only one replica destination per database. The release also adds a NATS JetStream replica type, and a VFS for instant read replicas is planned next.

Related posts

  • Litestream Revamped: SQLite Replication

    Fly.io mediumAdept

    Litestream is being reworked around ideas from LiteFS. It replaces the raw-WAL "shadow WAL" with transaction-aware LTX files, sorted page changesets that can be compacted LSM-style, so point-in-time restores no longer replay every intermediate page write. Conditional writes in S3 and Tigris provide a time-based lease that guarantees a single writer per destination without Consul, which removes the need for multiple "generations" and makes failover and replica resync simpler. Planned additions are a VFS-based read-replica layer that fetches and caches pages straight from object storage, and wildcard replication of hundreds or thousands of databases from one process.

  • Litestream VFS

    Fly.io mediumAdept

    Litestream VFS is a SQLite VFS plugin that runs read-only queries directly against Litestream backups in S3 without downloading the whole database, and supports point-in-time queries via a `PRAGMA litestream_time` setting. It relies on Litestream v0.5's LTX format: compaction keeps only the latest version of each page, leveled changesets (daily snapshots, then hourly down to 30-second and per-second L0 files) give a minimal restore path, and per-file page-index trailers (about 1% of each file) let the VFS translate SQLite page reads into S3 Range requests. An LRU cache serves hot pages, and polling the L0 layer keeps the index current, giving a near-realtime replica that starts up fast while Litestream itself still handles writes.

  • Litestream Writable VFS

    Fly.io mediumAdept

    Litestream's SQLite VFS now supports an optional write mode and background hydration, built so the Sprites storage stack can serve reads and writes milliseconds after a cold boot without first downloading its JuiceFS block map from object storage. Write mode assumes a single writer, disables polling for remote LTX files, and buffers writes locally, syncing them to S3 about every second. That gives 'eventual durability' that suits Sprites but probably not most applications. Hydration serves reads from object storage while pulling a compacted full copy of the database into a temporary local file, then switches reads to that file once it is ready. Ordinary workloads should keep running Litestream as a sidecar instead.

  • Xet is on the Hub

    Hugging Face mediumAdept

    Hugging Face migrated its first model and dataset repositories from Git LFS to Xet storage, which uses content-defined chunking (~64 KB chunks aggregated into ~64 MB blocks) so that only changed bytes are uploaded. The migration moved 4.5 TB and ~6% of Hub download traffic in one day and exposed two production issues. First, unaligned range requests from hf_transfer forced CAS to stream whole blocks, a 4:1 read amplification. Adding chunk-length metadata to the block format fixed this and cut GET latency ~35%. Second, unflushed page cache during uploads caused disk throttling and pod load imbalance, which was mitigated with per-pod concurrent upload limits. The core lesson is that incremental migrations of real traffic surface problems test environments can't.

  • Skip the API, Ship Your Database

    Fly.io mediumAdept

    Instead of designing an API for internal services, Fly.io ships them a read-only SQLite replica via LiteFS, letting consumers query and join data with plain SQL. The pattern emerged from running Corrosion, Fly's gossip-based state store, on LiteFS, where a one-way replica avoided chatty gossip and needed only a small static-lease config. It moves query compute onto each client, which removes rate limiting and multi-tenant resource contention. The tradeoffs are that writes still need an API, the schema becomes a looser contract (mitigated with backward-compatible changes and views), and access control requires per-tenant databases.

The quest for software engineering knowledge.

Look:
Layout: