Skip to the document
Madhuopen lab

HanuDB, tuned while I slept · part 5 of 6

adopted14 September 2026cost: local CPU; a free-tier VM for the real runs

Product: what an application needs from it

Followers, leases, idempotency, TLS, counts

The question

Of 22 attempts in this theme, which ones survived two benchmark runs, the correctness suite and the gates?

adopted

22 of 22 changes kept.

Attempts22
Kept22
Discarded or crashed0
Best kept score40,093.5

Every run in this theme

Every run in this theme
#scorewrites/sreads/sverdictwhat changed
003126,579.424,62228,693keepFEATURE: bearer-token auth on /v1 (HANUDB_TOKEN, constant-time compare; /health open; warning when unset). Score unchanged (-0.7%, noise, calibration 673)
003227,050.827,52326,587keepFEATURE: find accepts min_txn/wait_ms and waits until the index has committed that txn (read-your-writes for search; 504 on timeout); indexed_txn in status. Score…
003932,48028,07737,574keepFEATURE: --bucket-b twin: segments and snapshots PUT to both buckets in parallel, bucket-durable only when both have them; recovery lists the union, reads A with B…
004132,744.328,63637,443keepFEATURE: physical snapshots (TWS2: hard-linked index+kv, tar+zstd streamed to a file, multipart upload, streaming extract): rebuild of 493k docs 10.1 s -> 2.5 s when a…
004335,315.926,88446,392keepFEATURE: bucket retention (--retain-snapshots 3): after each snapshot, older snapshots and segments at or below the oldest kept snapshot are deleted from both buckets.…
0044keepFEATURE: hanudb verify (hash chain, twin equality, snapshot headers; exit 1 on problems) + HANUDB_GCS_TOKEN for laptops. Real buckets: 21 segments + 1 snapshot OK. Not…
0045keepFEATURE: hanudb resync mirrors every one-sided object to the other bucket (both directions; never overwrites a differing pair). Not benchmarked (no server-path change)
0049keepFEATURE: clients/ts/hanudb.ts (fetch, no deps, typechecks strict) and clients/swift/HanuDB.swift (Foundation, typechecks); both auto-pass the last write txn as min_txn…
0056keepFEATURE: hanudb dump (rebuild into a scratch dir, print every doc as NDJSON with _col; DuckDB read_json_auto), logs to stderr (were on stdout), snapshot fetch re-mirrors…
005729,123.530,30127,992keepFEATURE: POST /v1/_admin/compact force-merges the index to one segment and major-compacts fjall (6 -> 1 segments in 103 ms on 600 docs). Off the hot path; the regression…
005936,847.829,23546,443keepFEATURE: aggs on _find (tantivy aggregation request format: terms, avg/min/max/sum/stats, histogram, nested; field names rewritten to k.{col}.*); fixed a panic on limit…
006036,551.628,41747,015keepFEATURE: Idempotency-Key header on insert/replace: a retry replays the original txn and ids (stored as a doc in the reserved _idem collection inside the same…
006133,11429,04737,751keepFEATURE: idempotency keys expire (--idem-ttl-secs 48h, sweep every 10 min as replicated deletes). Off the hot path
007815,499.312,09419,864keepFEATURE: restore --at <RFC3339>: newest snapshot at or before the time + segments up to it, into a fresh dir, bucket never written (uploads refused); clear error when…
007934,256.128,56441,083keepFEATURE: serve --follower: boots from the bucket and tails wal/{seq+1} (create-if-absent objects make the tail a plain poll); writes answer 421; clients route reads with…
008034,256.128,56441,083keepFEATURE: --lease leader election (lease/leader.json, CAS renew every ttl/3, local fallback verify-delete-create), standby promotes in place, lost lease = fence +…
009434,17434,04434,304keepPRODUCT: --kv-compress cold|all|none (HANUDB_KV_COMPRESS; default cold = the previous behaviour). 'all' is set on the free-tier VM, whose pd-standard disk has a few…
009540,093.535,05345,860keepPRODUCT: built-in HTTPS: serve --tls-cert/--tls-key (PEM; HANUDB_TLS_CERT/KEY) via axum-server + rustls (ring provider installed explicitly: reqwest's ring and…
009735,269.534,69535,854keepPRODUCT: POST /v1/_admin/export?col= writes every live document as zstd JSON lines (+_col) to export/{col}/{utc stamp}-{txn}.jsonl.zst in both buckets, on a nice-10…
009835,551.434,82136,297keepPRODUCT: --retain-exports N (default 7): after each export the older objects under export/{col}/ are deleted in both buckets. Smoke: 54 checks. Bench in band
010035,235.334,69135,788keepPRODUCT: --cors-origins ("*" or a list; preflights + allow-headers for Authorization/Content-Type/Idempotency-Key via tower-http; off by default) and --max-body-mb…
010835,138.834,73235,550keepPRODUCT: GET /v1/{col}/_count answers from the committed index (O(segments): the same cost on 14M documents as on 14; lags writes by one commit), ?exact=true keeps the…
hanudbproductautonomous loop