Skip to content

"Same durability" comparison: run Doublets 0.8.0 behind its own transaction journal (fsync per write) against SQLite File at 10M, and add a memory-pressure configuration #127

In review

Description

@zhmur

The README says the non-volatile Doublets stores are compared with SQLite of the same durability (SQLite File). They are not paying for the same thing:

  • SQLite File is timed with its rollback journal and the fsyncs at every COMMIT (synchronous=FULL, stock defaults) inside the measured region.
  • Doublets_*_NonVolatile is a FileMapped store with no journal and no msync/fsync anywhere; the harness's transaction() for Doublets is the no-op default, and measure() deletes the workspace right after the run, so the data need never reach disk at all. A crash in the middle of update leaves SQLite consistent and the Doublets index trees torn.

So the current rows compare "durable at commit" with "file-backed, no guarantee". Since doublets 0.8.0 (2026-10-08) the library has its own answer to this — TransactionsDecorator with FileTransitionLog — and the benchmark should use it for the pairing it claims to make.

Request 1: the transactional Doublets row at 10M

Please add a Rust links variant at 10,000,000 links, 32-bit and 64-bit, that runs the united store behind the shipped transaction layer, with the journal exactly as shipped: FileTransitionLog, which calls sync_all after every appended record. No custom journal, no relaxed sync policy, no batching of the syncs — the point is to measure what a user of 0.8.0 gets when they ask the library for durability.

Suggested mapping onto the existing harness:

  • bump doublets to 0.8.0;
  • unit::Store::<T, _>::new(mapped(dir, "links.links"))?.with_transactions(FileTransitionLog::open(file(dir, "links.journal"))?);
  • one Doublets transaction per lifecycle phase: begin_transaction() on the first write inside the phase's transaction() closure, commit() at its end. Beginning lazily on the first write keeps the read-only phases free of the begin/commit snapshots the decorator persists, which is the same deal SQLite gets for a read-only BEGIN/COMMIT, so the read rows stay comparable;
  • same lifecycle, same checks, same data; --repetitions 1 as for the other 10M tables.

Then publish that row next to SQLite File as the same-durability comparison, and either label the plain NonVolatile rows as file-backed without durability guarantees or drop the "same durability" sentence for them.

Heads-up on cost: with the shipped journal every written link is at least one fsync (two per create_link, since it is a create followed by an update), so the write phases at 10M are tens of millions of fsyncs. Depending on the runner's disk that may not fit in the 6-hour job limit; a local run, or the workflow's manual size input, may be needed. Please don't work around it by changing the sync policy — that is the measurement.

Request 2: SQLite's configuration

SqliteLinks::new runs on a stock connection: cache_size is the 2 MiB default and mmap_size is 0, against a 501 MiB file at 10M. The Doublets file-backed store is, by construction, the whole file mapped into memory, so the matching SQLite configuration is

connection.execute_batch("PRAGMA cache_size = -1048576; PRAGMA mmap_size = 1073741824;").unwrap();

before the schema is created (and the equivalent pragmas for the two C# providers). Please add a tuned SQLite File row, or make this the default for the File variants, so the SQLite side is not measured through a 2 MiB cache.

Request 3: a memory-pressure configuration, 1M and 10M

Every published table measures stores that fit in RAM (the largest file is 800 MiB on a 16 GiB runner). A file-backed store behaves very differently once it doesn't fit: each access to a non-resident page is a disk read, and the two engines have opposite shapes for that case — SQLite's B-tree pages hold hundreds of keys per 4 KiB page, while Doublets' index trees spread one 32/64-byte node per page touched, and its united layout interleaves both trees with the data, so the working set of any content lookup is the entire file. Please run the links lifecycle for SQLite_File and Doublets_United_NonVolatile (and the split non-volatile store) under a memory limit, at 1,000,000 and 10,000,000 links, 32-bit, and publish them as separate tables labelled with the limit.

How:

  • Put the benchmark process in a cgroup with a memory limit; cgroup memory accounting charges the page cache, so the mapped store and SQLite's file pages are evicted once the limit is reached. On GitHub-hosted Ubuntu runners: sudo systemd-run --scope -p MemoryMax=24M --same-dir --wait cargo run --release ... --variants SQLite_File,Doublets_United_NonVolatile. Locally, cgroup v2 memory.max or v1 memory.limit_in_bytes works the same way.
  • Limit: about 75% of the Doublets store file and 50% of the SQLite file — 24 MiB at 1M (stores of 32 MiB and 48 MiB) and 240 MiB at 10M (320 MiB and 501 MiB) — so neither fits, with the same ratio at both sizes. The warm-up at 10,000 links fits inside either limit, so it stays a warm-up.
  • --repetitions 1. Record the disk's random 4 KiB read latency in the provenance alongside the CPU, since under pressure it is the quantity being measured.
  • The transactional variant from Request 1 can't take part as is: the decorator keeps every transition and a full-graph snapshot in memory, which exceeds any limit small enough to create pressure. That is worth stating in the README as well.

Time: under the limit each tree hop that misses is a disk read, so the Doublets phases take minutes at 1M and hours at 10M; the 10M table will almost certainly need a manual or local run.

Activity

  1. konard commented on Nov 25, 2026

    @konard
    Member

    We need to use all the latest versions of github.com/link-foundation/link-cli, https://github.com/link-foundation/links-notation, and also doublets in rust/c# and other languages as needed. If they have any bugs to support closest comparison possible report these issues to dependencies and we pause, yet in mean while we should still implement all workarounds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions