Public long-term memory benchmarks: retrieval against labelled evidence¶
This page has two parts: recall quality on public memory benchmarks (first), and OliviaDB and PostgreSQL: the same workloads in two containers (second; it opens with how to read its tables).
cargo run --release -p oliviadb-models --example memory_bench -- locomo|lme
(datasets in ~/.cache/oliviadb-eval: locomo10.json from snap-research/locomo,
longmemeval_s.json = xiaowu0162/longmemeval-cleaned longmemeval_s_cleaned.json, MIT).
Method¶
- What is measured: whether the context OliviaDB RECALL assembles within a token budget contains the labelled evidence (LoCoMo: evidence dialogue turns; LongMemEval: answer sessions). No answers are generated and no answer accuracy is claimed: that needs a language model to answer and to judge, which OliviaDB does not run.
- Ingestion: every LoCoMo turn (
speaker: text, plus the caption of a shared photo) and every LongMemEval user–assistant round is one episode, with its session time; no entities or facts are declared (plain conversational memory), session durability class. - Query: the question text; for LongMemEval
valid_at= the question date. - Budgets 1000, 2000, 4000 tokens (approximate tokenizer, 4 characters per token), the same for every system. Baselines over the same turns/rounds fill the budget with full texts in rank order: BM25 (OliviaDB's implementation), vector (MiniLM, cosine), hybrid (reciprocal rank fusion of the two, k = 60).
- OliviaDB items count "in any form" (an episode may enter as its first sentence when the budget is tight) and "full text" separately.
- Embedder: sentence-transformers/all-MiniLM-L6-v2 for OliviaDB and the vector baselines. (The tables up to the development rounds were run with MiniLM, the default then; the default is bge-small-en-v1.5 since 2026-12-01, see the end of this file.)
- Excluded by the benchmarks' own definitions: LoCoMo category 5 (adversarial, unanswerable), LongMemEval abstention questions (no evidence).
- All settings were fixed before the first run and not changed after seeing results; nothing was tuned on these sets.
LoCoMo (10 conversations, 5882 turns, 1536 questions of categories 1–4)¶
Evidence recall (share of evidence turns in the context) / all evidence present:
| system | 1000 tokens | 2000 tokens | 4000 tokens |
|---|---|---|---|
| OliviaDB RECALL, any form | 0.701 / 0.637 | 0.798 / 0.732 | 0.866 / 0.804 |
| OliviaDB RECALL, full text | 0.570 / 0.514 | 0.733 / 0.666 | 0.845 / 0.780 |
| BM25 | 0.670 / 0.608 | 0.731 / 0.665 | 0.782 / 0.714 |
| vector | 0.585 / 0.525 | 0.687 / 0.618 | 0.792 / 0.727 |
| hybrid RRF | 0.706 / 0.641 | 0.799 / 0.732 | 0.864 / 0.802 |
OliviaDB RECALL latency p50 0.7 ms, p99 2.1 ms per call (~600 turns per conversation).
LongMemEval-S (470 questions with evidence, 116 715 rounds, ~53 sessions each)¶
recall_any (some answer session in the context) / recall_all (every answer session):
| system | 1000 tokens | 2000 tokens | 4000 tokens |
|---|---|---|---|
| OliviaDB RECALL, any form | 0.955 / 0.887 | 0.962 / 0.904 | 0.962 / 0.906 |
| OliviaDB RECALL, full text | 0.032 / 0.032 | 0.168 / 0.089 | 0.626 / 0.298 |
| BM25 | 0.881 / 0.411 | 0.926 / 0.653 | 0.966 / 0.809 |
| vector | 0.896 / 0.404 | 0.947 / 0.651 | 0.972 / 0.802 |
| hybrid RRF | 0.917 / 0.436 | 0.955 / 0.691 | 0.968 / 0.843 |
OliviaDB RECALL latency p50 0.7 ms, p99 1.3 ms per call (~250 rounds per question). The run took 78 minutes, most of it embedding the rounds.
Reading the numbers¶
- "Any form" flatters OliviaDB on LongMemEval. Rounds there are long (assistant answers),
so within a budget OliviaDB includes most rounds as their first sentence. An answer session
then counts as "in the context" even when its first sentence does not carry the
evidence. That is a pointer the agent can expand (
memory_expand), not evidence in a single-shot context. The comparable metric is "full text", and there OliviaDB is far below the baselines at 1000–2000 tokens. - On LoCoMo, where turns are short, OliviaDB in any form equals hybrid RRF (0.701 vs 0.706 at 1000 tokens, 0.866 vs 0.864 at 4000), and full text trails it at small budgets.
- Conclusion, by the design's own test ("if levels of detail bring no gain over plain hybrid retrieval at the same budget, they are not needed"): as built, with first-sentence summaries, level of detail does not beat plain hybrid retrieval for one-shot context. It gives wide coverage of pointers for agents that navigate. Next steps:
- summaries that carry query-relevant content (extractive by relevance, not position);
- a switch to plain ranked full text when expansion is not available;
- any change judged first on data other than these test sets (e.g. LongMemEval-M or a held-out split), to keep the test sets untouched.
Recall quality: selection protocol (fixed before any development run)¶
Candidates (SummaryMode): first (first sentence; the version measured above),
query (the sentence sharing most terms with the query), full (whole episodes only,
ranked), hybrid (whole episodes while 40 % of the budget would remain, then
query-relevant sentences).
- Development set: the first 30 non-abstention questions of LongMemEval-M
(
longmemeval_m_cleaned.jsonin file order; ids 7161e7e2, c4f10528, 89527b6b, e9327a54, 4c36ccef, 6ae235be, 7e00a6cb, 1903aded, ceb54acb, f523d9fe, 0e5e2d1a, fea54f57, cc539528, dc439ea3, 18dcd5a5, 488d3006, 58470ed2, 8cf51dda, 1d4da289, 8464fc84, 8aef76bc, 71a3fd6b, 2bf43736, 70b3e69b, 8752c811, 3249768e, 1b9b7252, 1568498a, 6222b6eb, e8a79c70), with their ~500-session haystacks. LongMemEval-M asks the same questions as S, so S is also reported without these 30 ids (440 questions): that number has no selection in it. - Criterion: OliviaDB "evidence-bearing" recall_all (an answer session counts when its round
is in full text, or the sentence shown comes from a message labelled
has_answer), averaged over the 1000/2000/4000-token budgets. On a tie (within 0.01) the simpler mode wins: full, first, query, hybrid. - The chosen mode becomes the default and is run once on LoCoMo and LongMemEval-S with this harness. No further changes after that run.
Development results (LongMemEval-M, 30 questions) and the choice¶
OliviaDB evidence-bearing recall_all at 1000 / 2000 / 4000 tokens, and the protocol's average:
| mode | 1000 | 2000 | 4000 | average |
|---|---|---|---|---|
| first | 0.400 | 0.700 | 0.867 | 0.656 |
| query | 0.800 | 0.933 | 0.933 | 0.889 |
| full | 1.000 | 1.000 | 1.000 | 1.000 |
| hybrid | 0.967 | 1.000 | 1.000 | 0.989 |
full (whole episodes only, ranked) is chosen and is now the default. A caveat about the
development set: these 30 questions (the first in file order) are easy. The plain
baselines also reach 1.000 on them, so the set separates the modes, but it says little
about absolute quality.
Final numbers with the chosen mode (one run each, 2026-11-30)¶
LoCoMo, 1536 questions, evidence recall / all evidence (OliviaDB items are whole episodes now, so its three OliviaDB rows coincide):
| system | 1000 tokens | 2000 tokens | 4000 tokens |
|---|---|---|---|
OliviaDB RECALL (full) |
0.646 / 0.587 | 0.768 / 0.704 | 0.856 / 0.793 |
| BM25 | 0.670 / 0.608 | 0.731 / 0.665 | 0.782 / 0.714 |
| vector | 0.585 / 0.525 | 0.687 / 0.618 | 0.792 / 0.727 |
| hybrid RRF | 0.706 / 0.641 | 0.799 / 0.732 | 0.864 / 0.802 |
LongMemEval-S without the 30 development ids (440 questions, no selection involved), recall_any / recall_all:
| system | 1000 tokens | 2000 tokens | 4000 tokens |
|---|---|---|---|
OliviaDB RECALL (full) |
0.870 / 0.366 | 0.911 / 0.609 | 0.927 / 0.750 |
| BM25 | 0.873 / 0.370 | 0.920 / 0.630 | 0.964 / 0.795 |
| vector | 0.889 / 0.364 | 0.943 / 0.627 | 0.970 / 0.789 |
| hybrid RRF | 0.911 / 0.398 | 0.952 / 0.670 | 0.966 / 0.832 |
All 470: OliviaDB 0.879 / 0.406, 0.917 / 0.634, 0.932 / 0.766 (hybrid 0.917 / 0.436, 0.955 / 0.691, 0.968 / 0.843). RECALL p50 0.3–0.6 ms.
Reading: * What improved. Compared with the first measurement, whole-episode ranking removes the context that only looked complete (pointers counted as evidence). OliviaDB's full-text recall_all at 1000 tokens went from 0.032 to 0.406 on LongMemEval-S and from 0.570 to 0.646 evidence recall on LoCoMo. * Where OliviaDB stands. Its ranking is still slightly below the plain hybrid baseline on both sets (−0.03 to −0.08). So OliviaDB's own channel mix and scoring (recency, trust, utility, the structural channel unused here) cost a little on pure conversational retrieval with no entities or facts declared. What the hybrid baseline does is available to OliviaDB as a configuration, so this is a weighting question, not a missing capability. * Next step. Making the default fusion match the hybrid baseline when no structure is present is the next step. It will be judged on development data only, as above.
Recall quality: development set, second round (2026-11-30)¶
Judged on development data only: LoCoMo conversations 0, 1, 2 (383 questions with evidence;
split fixed in docs/e2e-eval.md before any result) and LongMemEval-M development questions.
OLIVIADB_VARIANT=<spec> memory_bench locomo 3 / memory_bench lmdev N; spec = oliviadb plus options
(bge-small, granite-base, harrier, ce6, cegte, topN, replace, old, nodedupe).
- LongMemEval-M development questions cannot separate anything. The first 10 of the 30 (embedding all 63 149 distinct rounds of the 30 haystacks on CPU was not affordable for the comparison of models) give recall_any = recall_all = 1.000 at 1000, 2000 and 4000 tokens for OliviaDB (with and without the new ranking) and for BM25, vector and hybrid. They are the easy questions of the file's head; no change below was selected on them, and none can be shown to regress on them. Differences below are LoCoMo development only.
- Plain-hybrid ranking when no structure is present (
Config::plain_hybrid, default on: no entity in the query, no claim among the candidates, no thread; score = fused BM25 + vector rank only): all-evidence 0.627 / 0.744 / 0.851 at 1000 / 2000 / 4000 tokens, identical to the old score (age decay, trust, confidence) to three decimals. The ranking was never the gap; the remaining gap to the plain baselines in the tables above is theYYYY-MM-DD user:head OliviaDB adds to every item and counts in its budget (about 5 tokens an item; the retrieval baselines ofmemory_benchare not charged for it, the baselines of the end-to-end export are). - Embedder and reranker (all-evidence recall, LoCoMo development, same OliviaDB configuration; MiniLM without reranker = 0.627 / 0.744 / 0.851, mean 0.741):
| configuration | 1000 | 2000 | 4000 | mean |
|---|---|---|---|---|
| bge-small + ce6, top 100 | 0.757 | 0.815 | 0.849 | 0.807 |
| bge-small + ce6, top 80 | 0.755 | 0.815 | 0.851 | 0.807 |
| bge-small + gte-reranker-modernbert, top 40 | 0.757 | 0.796 | 0.851 | 0.801 |
| bge-small + ce6, cross-encoder order alone, top 40 | 0.744 | 0.791 | 0.849 | 0.795 |
| bge-small + ce6, top 40 (fused) | 0.736 | 0.794 | 0.851 | 0.794 |
| Harrier-0.6B | 0.692 | 0.791 | 0.875 | 0.786 |
| granite-base + ce6, top 40 | 0.708 | 0.778 | 0.867 | 0.784 |
| bge-small + ce6, top 20 / gte reranker top 20 / top 10 | 0.684 / 0.689 / 0.676 | 0.783 | 0.851 | 0.773 / 0.774 / 0.770 |
| bge-small (no reranker; near-duplicate removal off gives the same) | 0.676 | 0.783 | 0.851 | 0.770 |
| gte-reranker-modernbert alone (MiniLM) | 0.702 | 0.752 | 0.851 | 0.768 |
| granite-base | 0.674 | 0.760 | 0.867 | 0.767 |
| bge-base | 0.671 | 0.762 | 0.859 | 0.764 |
| ms-marco-MiniLM-L6 alone (MiniLM) | 0.687 | 0.749 | 0.851 | 0.762 |
| granite-small (+ ce6) | 0.645 (0.679) | 0.736 (0.739) | 0.828 | 0.736 (0.749) |
Reading: on short conversational turns the newest and largest embedders did not win. bge-small
(2023, 33M) is the best embedder (+0.05 at 1000 tokens over MiniLM); Granite R2 base ties it at 4000
tokens, Harrier-0.6B (14x slower, verified against transformers) is best only at 4000. A reranker
adds up to +0.08 at 1000 tokens and only when it sees a deep list (40 candidates: +0.06,
80: +0.08, 100: no more); the 149M ModernBERT reranker is not better than the 22.7M MiniLM one
at the same depth once depth is the limit, and costs 4.6x per pair (66 vs 14 ms), so it is not
the default. Candidate for the default: bge-small + ce6, top 80. Per query that is 80 pairs at
about 14 ms = about 1.1 s of CPU when the reranker is on.
Decision (2026-12-01). The default embedder is bge-small-en-v1.5 (MIT). After the partial
test-set run the owner turned the ms-marco-MiniLM-L6 cross-encoder over the best 80 candidates
(Config::rerank_top default 80) on by default, at about 1.1 s of CPU per recall. In the
benchmark examples oliviadb now means this default (bge-small with the reranker), oliviadb+norerank
the default without the reranker, and oliviadb+old the default before (MiniLM, no plain-hybrid
ranking, no reranker). Results recorded before this change call the configuration without the
reranker oliviadb and the one with it oliviadb+ce6 (the same as today's oliviadb).
Test sets, end to end (2026-12-01, docs/e2e-eval.md "Test sets"). LLM-judged accuracy with Claude Haiku as answerer and judge (not GPT-4o), on a seeded random sample of each test split judged before the usage limit stopped the run: LoCoMo conversations 3-9, at 1000 / 2000 tokens, OliviaDB default 0.692 / 0.759, OliviaDB + reranker 0.741 / 0.782, hybrid 0.665 / 0.742, full conversation 0.833; LongMemEval-S held-out at 1000 / 2000 / 4000 tokens, OliviaDB default 0.326 / 0.494 / 0.623, OliviaDB + reranker 0.345 / 0.542 / 0.671, hybrid 0.358 / 0.523 / 0.658. Sample sizes, intervals and paired differences are in that file.
Time in questions: a synthetic development set (2026-12-01)¶
The LongMemEval-S temporal-reasoning gap (docs/e2e-eval.md) has no development questions:
the 30 LongMemEval-S questions outside the held-out 440 are all single-session-assistant, and
LoCoMo's development temporal questions are already answered by OliviaDB's context (evidence in the
context 0.967 / 0.989 / 0.989). Recall changes for time were therefore chosen on a synthetic
development set, written by a generator in this repository
(open/crates/oliviadb-models/examples/temporal_gen, seed 20261201, 12 users, 203 questions).
It is synthetic and only selects candidates; its numbers are not benchmark results. Each user
has 36-47 dated sessions with an assistant (everyday filler rounds) in which they mention dated
events relative to the session date ("yesterday", "last Tuesday", "two weeks ago", "on the 14th",
"two weeks after the move"), several per session, with events of the same kind on nearby dates as
distractors; questions are asked days to weeks after the last session and name events by
paraphrase, not by the words of the mention. Types: order (which first), interval (days
between), ago (which one about N weeks ago), count (how many in a named month), when (the
date), after (the first of a kind after a milestone). Measured: all evidence sessions in the
context (cargo run --release -p oliviadb-models --example temporal_bench), the same budgets and
baselines as above.
The change (Config::temporal, on by default; crate::temporal): episodes are indexed by the
days they were written and the days they speak of; a question's time phrases ("about two weeks
ago", "in March 2023", "last month") give day windows whose episodes join the fusion as a channel;
a comparing question ("which happened first, A or B", "between A and B", "X first after Y") has
each event searched on its own, and "after Y" adds the days following the best match of Y.
| all evidence in the context (1000 / 2000 / 4000 tokens) | all 203 | count | after | interval | order | ago |
|---|---|---|---|---|---|---|
| OliviaDB without the change (reranker on) | 0.729 / 0.833 / 0.916 | 0.415 / 0.683 / 0.854 | 0.514 / 0.657 / 0.829 | 0.696 / 0.870 / 0.913 | 0.880 / 0.880 / 0.920 | 0.895 / 0.921 / 0.974 |
| OliviaDB with it (reranker on) | 0.892 / 0.931 / 0.975 | 0.829 / 0.902 / 0.976 | 0.714 / 0.800 / 0.914 | 0.870 / 0.913 / 0.957 | 0.960 / 0.960 / 1.000 | 0.974 / 1.000 / 1.000 |
| OliviaDB with it, no reranker | 0.877 / 0.956 / 0.980 | 0.732 / 0.976 / 0.976 | 0.743 / 0.914 / 0.943 | 0.826 / 0.826 / 0.957 | 0.960 / 0.960 / 1.000 | 1.000 / 1.000 / 1.000 |
| vector (bge-small) | 0.916 / 0.961 / 0.980 | 0.902 / 0.976 / 1.000 | 0.743 / 0.800 / 0.886 | 0.913 / 1.000 / 1.000 | 1.000 / 1.000 / 1.000 | 0.947 / 1.000 / 1.000 |
| hybrid RRF | 0.749 / 0.823 / 0.941 | 0.439 / 0.585 / 0.951 | 0.571 / 0.743 / 0.771 | 0.696 / 0.739 / 0.957 | 0.880 / 0.880 / 0.960 | 0.947 / 0.974 / 1.000 |
(when questions: 1.000 for every system.) No regression on the LoCoMo development
conversations: the 383 questions give the same numbers with and without the change (0.806 / 0.864
/ 0.894 evidence in the context). Whether it closes the LongMemEval-S gap is measured only in a
judged run, which the owner decides on; the held-out questions were not used. On this set plain
vector search still leads OliviaDB at 1000 tokens (BM25 brings in same-kind distractors); that is a
finding about the set, not yet a change.
OliviaDB and PostgreSQL: the same workloads in two containers¶
How to read this¶
Two databases run the same application workloads side by side, each in its own container with the same limits, and a load generator on the host sends them requests over TLS. Each workload is written the way an application would write it for that database (an SQL statement for PostgreSQL, a call of OliviaDB's HTTP API), so what is compared is the work one application operation costs on each side.
The workloads¶
| workload | id | what PostgreSQL runs | what OliviaDB runs | 1 operation is |
|---|---|---|---|---|
| Read a customer with its accounts, the last 100 transactions of each, and its card | dossier |
one SELECT: accounts and their newest 100 transactions (LATERAL ... LIMIT 100) UNION ALL the cards (LIMIT 100) |
1 HTTP GET: the customer with its subtree, at most 100 of each listing (tree=true&each=100) |
one customer's dossier: 2 accounts, 200 transactions, 1 card |
| The same without the card, as separate requests (the dossier up to 2026-12-02) | dossier-calls |
one SELECT: a join with a LATERAL subquery per account |
4 HTTP GETs: the customer, its accounts, each of its 2 accounts' newest 100 transactions | one customer's dossier without the card |
| Payment: insert a transaction and update the balance, in one transaction | payment |
BEGIN; UPDATE ... SET balance = balance - x; INSERT ...; COMMIT |
1 POST /v1/txn: a relative update ("add") and the insert, atomically |
one committed payment |
| List customers, 50 per page | page |
SELECT ... WHERE id > $1 ORDER BY id LIMIT 50 (keyset paging) |
1 GET: the customer listing, limit=50 after an id |
one page of 50 customers |
| Find a customer by card number (unique index) | lookup |
a SELECT joining through the unique index on the card number | 1 GET /v1/lookup/card_by_pan (a unique index) |
one customer found |
| An account's transactions for one week (time range) | range |
a SELECT through the index on (customer, account, posted date) | GETs of the account's transactions newest first, from after the week's end (after) through its first day (to, the leading key part), pages of 16 followed by next until the listing ends (before to existed: pages of 16 until one was older than the week's start; 100 in the results of 0ab022c and before) |
one week of one account (about 8 transactions) |
| Increment a shared counter under contention | counter |
INSERT ... ON CONFLICT DO UPDATE SET n = n + 1 on one of 16 counters |
1 POST /v1/state/update with an inc operation on one of 16 counters |
one committed increment |
| AI-agent memory: search the stored episodes for two words | recall |
an emulation: a full-text match ranked by ts_rank, 10 rows |
1 POST /v1/memory/recall: a ranked context within 500 tokens |
one search answered |
| AI-agent memory: store an episode with one fact | remember |
an emulation: an episode row (with a generated tsvector) and a fact row, one transaction |
1 POST /v1/memory/remember |
one episode stored |
| Change data capture: read the change stream, one consumer | cdc |
logical decoding (a test_decoding slot), the changed rows counted |
GET /v1/changes, 1000 changes per call |
one change (a row on PostgreSQL, a node on OliviaDB) |
The two AI-agent memory workloads are not the same function on both sides: PostgreSQL's is
what an application would build with full-text search, while OliviaDB's RECALL also ranks by
recency and facts and assembles a context within a token budget. They show the cost, not an
equivalence. The exact statements are in bench/postgres/schema.sql and
open/crates/oliviadb-bench/src/main.rs.
The numbers¶
| metric | unit | better | what it is |
|---|---|---|---|
| ops/s (16 clients) | operations per second | higher | throughput of a closed loop: 16 clients, each sending its next request as soon as the last one is answered, for 20 s |
| p50, p99, p99.9, max | milliseconds | lower | latency of one operation as the client sees it: half, 99 %, 99.9 % of the operations, and all of them, finished within this time |
| max rate, p99 ≤ 10 ms (or 50 ms) | operations per second | higher | the highest fixed request rate (an open loop, latency counted from when each request was due, so falling behind counts) at which 99 % of the operations still finished within 10 ms (50 ms); –: no rate tried held it |
| CPU % | percent of one CPU | lower for the same work | the container's average CPU during the closed loop; 400 % is all of its 4 CPUs |
| mem MiB | mebibytes | lower | the container's highest memory sample, page cache included |
| written MiB | mebibytes | lower for the same work | the container's block writes during the 20 s closed loop |
| host load | load average, 1 minute | lower is a quieter machine | the host's load right before that workload's runs; above about 10 the host was busy with other work and the numbers are less reliable |
| who is faster | ratio of throughputs | – | the higher ops/s divided by the lower, both averaged over the rounds; "about equal" below 5 %, which is within the noise between rounds |
The setup¶
- Machine: one Apple M3 Max laptop (14 cores, macOS), Docker's Linux VM with 14 CPUs and 7.7 GiB. The load generator runs on the host, outside both containers. The host also ran the owner's desktop applications and macOS's background services (file indexing, malware scans); their load before each workload is in the "host load" column.
- Limits: each container 4 CPUs and 2 GiB of memory (
bench/compose.yml). - Durability on, on both: PostgreSQL with
fsync,synchronous_commitandfull_page_writeson; OliviaDB acknowledges a write after its log is synced. - TLS on, on both: each server's own certificate; one connection per client (PostgreSQL's protocol with prepared statements; HTTP/1.1 with keep-alive).
- Data: 10 000 customers, each with 2 accounts of 100 transactions and one card; 20 000 agent-memory episodes. After a whole run PostgreSQL's database is 815 MB (most of it the transaction table, 488 MB, and the episodes, 313 MB with facts) and OliviaDB's store 1.5 GB (the memory workloads' episodes, sessions and keys included); the customers, accounts and transactions the read workloads use are about 0.5 GB on PostgreSQL.
- Cache, warm: PostgreSQL's
shared_buffersis 512 MB, OliviaDB's block cache 512 MB (OLIVIADB_CACHE_MB); in both containers the rest of the 2 GiB is the kernel's page cache. The read workloads' data fit in memory, and every workload runs after the data were loaded and after the workloads before it, so these are warm-cache numbers. Larger-than-memory (cold) runs are a planned measurement, not in these tables. - Run length: 20 s per closed loop; the open-loop search tries up to 8 rates of 20 s
each. Two full rounds: the first with PostgreSQL first in the order
dossier payment page lookup range counter recall remember, the second with OliviaDB first and the workloads in the ordercounter range lookup page payment dossier recall remember(ORDER=alt bench/run.sh), so neither side always runs on a fresher or a fuller store (recallalways runs beforeremember, which adds episodes). - Builds: PostgreSQL 16.6 (the official image, tuned as in
bench/postgres/postgresql.conf); OliviaDB the core image of main at 0ab022c (oliviadb:bench-0ab022c).
Latest results: main 0ab022c, two rounds in a quiet window (2026-12-02)¶
Raw records: bench/published/2026-12-02/window-3-round{1,2}.{env,jsonl,load.jsonl}
(the .load.jsonl files hold the host's load average before each run; the harness now also
records other_cpu_pct, the summed CPU % of all processes outside the benchmark's containers,
and no process names). The tables below come from them: bench/table.py --summary <rounds> and
bench/table.py <rounds> <load files>.
Who is faster¶
Throughput of each round (round 1 / round 2), and the winner on the mean of the two:
| workload | id | what PostgreSQL runs | what OliviaDB runs | PostgreSQL ops/s | OliviaDB ops/s | who is faster (throughput) | PostgreSQL p99 ms | OliviaDB p99 ms |
|---|---|---|---|---|---|---|---|---|
| Read a customer with its accounts and the last 100 transactions of each | dossier |
one SELECT: join with a LATERAL subquery per account | 4 HTTP GETs: the customer, its accounts, each account's newest 100 transactions | 7,634 / 6,728 | 1,280 / 1,338 | PostgreSQL 5.5× faster | 5.35 / 6.71 | 47.49 / 47.30 |
| Payment: insert a transaction and update the balance, in one transaction | payment |
BEGIN; UPDATE balance = balance - x; INSERT; COMMIT | 1 POST /v1/txn: a relative update ("add") and the insert | 6,797 / 6,711 | 7,505 / 9,546 | OliviaDB 1.3× faster | 3.59 / 3.68 | 5.56 / 2.96 |
| List customers, 50 per page | page |
SELECT ... WHERE id > $1 ORDER BY id LIMIT 50 (keyset) | 1 GET: listing limit=50 after an id | 25,067 / 24,914 | 5,461 / 6,627 | PostgreSQL 4.1× faster | 1.41 / 1.35 | 41.15 / 36.57 |
| Find a customer by card number (unique index) | lookup |
SELECT with a join through the unique index on the card number | 1 GET /v1/lookup/card_by_pan (unique index) | 29,161 / 28,304 | 21,031 / 20,569 | PostgreSQL 1.4× faster | 0.97 / 0.99 | 1.43 / 1.45 |
| An account's transactions for one week (time range) | range |
SELECT through the index on (customer, account, posted date) | GET listing pages of 100, newest first from the week's end, until older than its start | 27,872 / 25,481 | 5,094 / 4,174 | PostgreSQL 5.8× faster | 1.08 / 1.16 | 39.94 / 35.31 |
| Increment a shared counter under contention (16 counters) | counter |
INSERT ... ON CONFLICT DO UPDATE SET n = n + 1 | 1 POST /v1/state/update with an "inc" operation | 18,065 / 17,519 | 12,113 / 11,890 | PostgreSQL 1.5× faster | 2.15 / 2.24 | 2.50 / 2.23 |
| AI-agent memory: search the stored episodes for two words | recall |
an emulation: full-text match ranked by ts_rank, 10 rows | 1 POST /v1/memory/recall (ranked context within 500 tokens) | 2,111 / 2,070 | 2,724 / 2,614 | OliviaDB 1.3× faster | 65.63 / 67.96 | 63.23 / 61.86 |
| AI-agent memory: store an episode with one fact | remember |
an emulation: insert an episode row (generated tsvector) and a fact row, one transaction | 1 POST /v1/memory/remember | 6,937 / 6,509 | 6,813 / 6,857 | about equal (within 5 %) | 3.60 / 3.77 | 7.38 / 6.82 |
| Change data capture: read the change stream (1 consumer) (changes/s) | cdc |
logical decoding (test_decoding slot), changes counted | GET /v1/changes, 1000 changes per call | 24,568 / 25,127 | 64,243 / 56,643 | OliviaDB 2.4× faster | – | – |
Every measurement¶
| workload | id | database | round | ops/s (16 clients) | p50 ms | p99 ms | p99.9 ms | max ms | CPU % | mem MiB | written MiB | max rate, p99 ≤ 10 ms | p99 ≤ 50 ms | host load |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Read a customer with its accounts and the last 100 transactions of each | dossier |
PostgreSQL | 1 | 7,634 | 1.83 | 5.35 | 8.71 | 12.5 | 227 | 529 | 95.4 | 4,294 | 6,441 | 9.13 |
| Read a customer with its accounts and the last 100 transactions of each | dossier |
PostgreSQL | 2 | 6,728 | 2.02 | 6.71 | 10.29 | 19.5 | 257 | 696 | 0.0 | 3,784 | 5,677 | 11.60 |
| Read a customer with its accounts and the last 100 transactions of each | dossier |
OliviaDB | 1 | 1,280 | 8.21 | 47.49 | 53.34 | 62.8 | 361 | 582 | 0.0 | 720 | 1,080 | 11.16 |
| Read a customer with its accounts and the last 100 transactions of each | dossier |
OliviaDB | 2 | 1,338 | 8.08 | 47.30 | 55.99 | 102.0 | 364 | 1,102 | 0.0 | 502 | 1,129 | 8.63 |
| Payment: insert a transaction and update the balance, in one transaction | payment |
PostgreSQL | 1 | 6,797 | 2.31 | 3.59 | 6.85 | 21.2 | 132 | 564 | 639.0 | 5,735 | 5,735 | 12.58 |
| Payment: insert a transaction and update the balance, in one transaction | payment |
PostgreSQL | 2 | 6,711 | 2.34 | 3.68 | 7.78 | 21.9 | 136 | 621 | 715.3 | 3,775 | 5,662 | 7.87 |
| Payment: insert a transaction and update the balance, in one transaction | payment |
OliviaDB | 1 | 7,505 | 1.82 | 5.56 | 19.31 | 120.8 | 188 | 687 | 324.2 | 4,222 | 4,222 | 10.59 |
| Payment: insert a transaction and update the balance, in one transaction | payment |
OliviaDB | 2 | 9,546 | 1.63 | 2.96 | 9.03 | 57.6 | 230 | 1,081 | 581.7 | 3,580 | 8,055 | 11.05 |
| List customers, 50 per page | page |
PostgreSQL | 1 | 25,067 | 0.61 | 1.41 | 3.61 | 15.5 | 177 | 608 | 0.0 | 21,151 | 21,151 | 8.08 |
| List customers, 50 per page | page |
PostgreSQL | 2 | 24,914 | 0.61 | 1.35 | 2.71 | 11.2 | 178 | 593 | 9.5 | 21,021 | 21,021 | 11.63 |
| List customers, 50 per page | page |
OliviaDB | 1 | 5,461 | 1.67 | 41.15 | 49.57 | 53.8 | 362 | 879 | 0.0 | 4,608 | 4,608 | 13.35 |
| List customers, 50 per page | page |
OliviaDB | 2 | 6,627 | 1.45 | 36.57 | 40.64 | 45.9 | 363 | 896 | 0.0 | 5,592 | 5,592 | 8.50 |
| Find a customer by card number (unique index) | lookup |
PostgreSQL | 1 | 29,161 | 0.53 | 0.97 | 1.56 | 18.3 | 126 | 612 | 0.0 | 24,605 | 24,605 | 8.06 |
| Find a customer by card number (unique index) | lookup |
PostgreSQL | 2 | 28,304 | 0.55 | 0.99 | 1.65 | 12.3 | 130 | 594 | 0.0 | 10,614 | 10,614 | 10.99 |
| Find a customer by card number (unique index) | lookup |
OliviaDB | 1 | 21,031 | 0.73 | 1.43 | 2.33 | 48.9 | 255 | 883 | 0.0 | 11,830 | 17,745 | 8.48 |
| Find a customer by card number (unique index) | lookup |
OliviaDB | 2 | 20,569 | 0.74 | 1.45 | 2.05 | 57.5 | 232 | 884 | 0.0 | 7,713 | 17,355 | 8.85 |
| An account's transactions for one week (time range) | range |
PostgreSQL | 1 | 27,872 | 0.55 | 1.08 | 1.86 | 14.2 | 149 | 626 | 66.8 | 23,517 | 23,517 | 10.75 |
| An account's transactions for one week (time range) | range |
PostgreSQL | 2 | 25,481 | 0.60 | 1.16 | 2.13 | 18.0 | 150 | 600 | 0.0 | 21,499 | 21,499 | 10.37 |
| An account's transactions for one week (time range) | range |
OliviaDB | 1 | 5,094 | 1.91 | 39.94 | 46.02 | 52.0 | 365 | 885 | 0.0 | 4,298 | 4,298 | 11.48 |
| An account's transactions for one week (time range) | range |
OliviaDB | 2 | 4,174 | 2.45 | 35.31 | 41.41 | 46.1 | 366 | 882 | 0.0 | 3,522 | 3,522 | 11.19 |
| Increment a shared counter under contention (16 counters) | counter |
PostgreSQL | 1 | 18,065 | 0.80 | 2.15 | 3.66 | 18.4 | 155 | 610 | 867.8 | 10,161 | 15,242 | 7.10 |
| Increment a shared counter under contention (16 counters) | counter |
PostgreSQL | 2 | 17,519 | 0.83 | 2.24 | 3.68 | 19.3 | 153 | 582 | 820.2 | 9,854 | 14,782 | 9.95 |
| Increment a shared counter under contention (16 counters) | counter |
OliviaDB | 1 | 12,113 | 1.31 | 2.50 | 6.61 | 55.4 | 170 | 896 | 457.8 | 3,028 | 3,028 | 8.93 |
| Increment a shared counter under contention (16 counters) | counter |
OliviaDB | 2 | 11,890 | 1.34 | 2.23 | 6.10 | 55.8 | 173 | 740 | 343.3 | – | 10,032 | 11.22 |
| AI-agent memory: search the stored episodes for two words | recall |
PostgreSQL | 1 | 2,111 | 3.07 | 65.63 | 69.65 | 74.4 | 359 | 611 | 0.0 | 1,781 | 1,781 | 6.19 |
| AI-agent memory: search the stored episodes for two words | recall |
PostgreSQL | 2 | 2,070 | 3.22 | 67.96 | 73.31 | 78.3 | 360 | 680 | 0.0 | 1,747 | 1,747 | 13.68 |
| AI-agent memory: search the stored episodes for two words | recall |
OliviaDB | 1 | 2,724 | 2.56 | 63.23 | 68.35 | 98.9 | 361 | 1,125 | 66.8 | 2,298 | 2,298 | 6.17 |
| AI-agent memory: search the stored episodes for two words | recall |
OliviaDB | 2 | 2,614 | 2.71 | 61.86 | 67.03 | 71.9 | 363 | 1,162 | 66.8 | 2,206 | 2,206 | 12.54 |
| AI-agent memory: store an episode with one fact | remember |
PostgreSQL | 1 | 6,937 | 2.26 | 3.60 | 8.01 | 40.6 | 141 | 634 | 762.9 | 3,902 | 5,853 | 4.01 |
| AI-agent memory: store an episode with one fact | remember |
PostgreSQL | 2 | 6,509 | 2.41 | 3.77 | 8.91 | 36.3 | 144 | 698 | 762.9 | 3,661 | 5,492 | 9.10 |
| AI-agent memory: store an episode with one fact | remember |
OliviaDB | 1 | 6,813 | 2.17 | 7.38 | 19.06 | 56.3 | 147 | 2,024 | 3,080.4 | – | – | 9.51 |
| AI-agent memory: store an episode with one fact | remember |
OliviaDB | 2 | 6,857 | 2.20 | 6.82 | 13.41 | 57.4 | 147 | 1,916 | 3,147.1 | – | – | 8.81 |
Change data capture: read the change stream (1 consumer), PostgreSQL: 491,640 changes in 20.0 s = 24,568 changes/s (batches of 1000), CPU 89 %, host load 7.08
Change data capture: read the change stream (1 consumer), PostgreSQL: 503,880 changes in 20.1 s = 25,127 changes/s (batches of 1000), CPU 89 %, host load 8.18
Change data capture: read the change stream (1 consumer), OliviaDB: 1,285,000 changes in 20.0 s = 64,243 changes/s (batches of 1000), CPU 62 %, host load 6.19
Change data capture: read the change stream (1 consumer), OliviaDB: 1,133,000 changes in 20.0 s = 56,643 changes/s (batches of 1000), CPU 65 %, host load 10.40
What the numbers say¶
- OliviaDB is faster on writes and on its own workloads: payment 1.3× (7 505 and 9 546 against 6 797 and 6 711 per second, writing half to four fifths of PostgreSQL's bytes), the change stream 2.4×, and agent-memory search 1.3× (OliviaDB's RECALL against PostgreSQL's full-text emulation). Storing an episode is about equal in throughput, with OliviaDB's p99 about twice PostgreSQL's and no open-loop rate held p99 10 ms on OliviaDB.
- PostgreSQL is faster on reads, by a lot: the dossier 5.5×, an account's week of transactions 5.8×, a page of customers 4.1×, and the card lookup 1.4×. On the three big reads OliviaDB is at its 4 CPUs (CPU 361-366 %) while PostgreSQL uses 1.5-2.6 of its CPUs, so OliviaDB's reads cost several times more CPU per operation (the lookup: 2.3-2.6 CPUs against 1.3). Its p99 on the three big reads is 35-47 ms against PostgreSQL's 1-7 ms: requests queue behind the busy CPUs.
- Counters under contention: PostgreSQL 1.5× (about 18 000 against 12 000 per second), equal p99; OliviaDB writes less than half the bytes (343-458 MiB against 820-868 MiB).
- Memory: OliviaDB's container sits near its 2 GiB limit after the memory workloads (page cache of its larger store); PostgreSQL's stays near 600-700 MiB.
- The two rounds keep the same winner on every workload. Most values agree within 10 %; the widest spreads are OliviaDB's payment (7 505 and 9 546 per second) and range (5 094 and 4 174). The host load before the runs varied between 4 and 14.
Why the reads are slower, and what to do about it: the next section.
Why reads are slower (profile of 2026-12-02)¶
The server of the results above (image oliviadb:bench-0ab022c), profiled in its container
under each read workload with 16 clients: perf record -F 499 --call-graph dwarf from a
sidecar container in the server's PID namespace, 12 s per workload, on a store loaded fresh
with the benchmark's data (450 MB, the server at 400 MB resident), as the read workloads saw
it. The host was busy with other work during the profile, so its throughputs are not
results; the shares of CPU time below are what the profile is for.
Where the CPU goes¶
Share of the server's CPU samples. The allocator row counts glibc's malloc, free and
their internal functions wherever they are called from (time spent in them, at least; libc
addresses outside the allocator's code are counted elsewhere). The other rows count whole
call stacks by the layer they run in; the remainder (to 100 %) is in frames the profiler
could not attribute.
Read a customer with its accounts and last 100 transactions (dossier) |
List customers, 50 per page (page) |
An account's transactions for one week (range) |
Find a customer by card number (lookup) |
|
|---|---|---|---|---|
glibc allocator (malloc, free, internals) |
32 % | 27 % | 34 % | 9 % |
| LSM reads: seeks, block decoding, the block cache | 20 % | 35 % | 19 % | 14 % |
rendering stored nodes into a serde_json::Value |
15 % | 9 % | 15 % | 3 % |
writing that Value out as JSON text |
9 % | 8 % | 10 % | 5 % |
| TLS | 7 % | 6 % | 6 % | 26 % |
| handing each request to the blocking thread pool (futex wake-ups) | 5 % | 5 % | 4 % | 19 % |
| HTTP and TCP | 3 % | 3 % | 3 % | 11 % |
| path parsing, access checks | 5 % | 3 % | 5 % | 5 % |
Per operation, from the throughput of the results above (4 CPUs busy): a dossier costs about 3.1 ms of CPU for about 203 nodes (the customer, 2 accounts, 2 × 100 transactions), about 15 µs per node; a page of 50 customers about 0.7 ms, 15 µs per customer; a week of one account about 0.8 ms for the 100 nodes OliviaDB reads (below), 8 µs per node; a card lookup about 0.19 ms (2.3-2.6 CPUs at 20 000-21 000 per second), against PostgreSQL's about 0.05 ms.
The hypotheses, confirmed or refuted¶
- Cache misses: refuted. During a 15 s dossier run the container read 0 bytes from its
disk (cgroup
io.stat), andpreadis below 0.1 % of the profile: every block came from OliviaDB's block cache. The data fit in memory (above), and the cost is CPU per record. - Per-node LSM work: confirmed, with a specific cause. A listing (
keys::children) seeks after every child it returns, to the successor of the child's key, so that it skips the child's subtree. For a type with no children of its own (a transaction) the next key is already the next child: the seek repeats an index search and a block decode in every table for nothing. In the page listing each customer's subtree has to be skipped, but most of those seeks land in the same block, where stepping forward would be cheaper than searching the index again. - Lock contention: refuted for these reads. Lock and futex-wait frames are below 3 % on the three large reads, and the server is at its 4 CPUs: its threads are running, not waiting. The card lookup spends 19 % in waking the thread that runs the request (each request goes from the async worker to the blocking pool and back).
- Building the answer as a
serde_json::Value: confirmed, 23-25 % of a large read: each node becomes a tree of maps and strings, then that tree is written out as text. - The protocol: a fixed cost per request, which matters for small reads. TLS, HTTP and the hand-off are about 55 % of a card lookup but about 15 % of a dossier.
Not in the coordinator's list, and the largest single item: the allocator. glibc's
malloc and free take a quarter to a third of the CPU of a large read, called from every
layer (key and value copies in the listing, the Value tree, strings). Many threads
allocating and freeing small objects is a known weak spot of glibc's allocator. The
in-process measurement that gave about 2.8 µs per node ran on macOS's allocator with one
thread, and none of the HTTP, TLS or hand-off cost. That explains much of the gap between
2.8 µs in process and 8-15 µs per node in the container.
Two things in the comparison itself:
- The range workload reads 12 times what it needs. PostgreSQL returns the 7-8 transactions of the week; OliviaDB's request asks for a page of 100 from the week's end, and renders and sends all of them, most of them older than the week. A smaller page, or an upper bound on a listing, makes the two do the same work.
- The dossier is 4 requests on OliviaDB and one statement on PostgreSQL: 4 TLS records, hand-offs and HTTP exchanges against one.
And one finding outside the read path: after the agent-memory workloads, the server holds 1.4 GB of anonymous memory right after a restart, close to the container's 2 GiB. The read workloads ran before those workloads in both rounds, so this did not affect the results above, but it will matter in a mixed run. It is an open item.
The fix plan, ranked by expected effect on these reads¶
- A faster allocator for the server: mimalloc (MIT) as the global allocator, then fewer allocations per node: the listing copies every key and value into new vectors, and each rendered node allocates its maps and strings. Expected: a large part of the 25-30 %.
- No seek per child where stepping forward is enough: for a child type with no
children,
next(); for one with children, step forward a few entries before seeking (the idea behind RocksDB'smax_sequential_skip_in_iterations), or seek within the current block before going back to the index. Expected: most of the listing's seek cost, which is about a third of the page listing. - Write JSON straight from the stored node into the response, with no
Valuetree in between (the serde writer, or hand-written output as in sonic-rs's approach). Expected: most of the 23-25 %. - The range workload made equal: a page size that fits a week (16), or an upper key bound
for listings (
until), so that OliviaDB reads about what PostgreSQL reads. - Small reads without the hand-off: run short reads on the async worker, or on a pool that does not wake a thread per request. Expected: up to 19 % of a lookup.
- The dossier in one request: the customer's subtree with a per-type limit
(
tree=truewith limits), or several reads in one request. Expected: three requests' fixed cost of four.
Each fix is measured in a quiet window against the image before it, one fix at a time.
Fixes 1, 2 and 4, each measured alone (2026-12-02)¶
Four images of the same code apart from the fixes: the base (oliviadb:bench-0ab022c, the
published results), fix 2 alone (listings step over a child's subtree before they seek past
it, bench-fix2), fix 1 alone (mimalloc on the base, bench-mimalloc), and both
(bench-fix12). Each one started from empty volumes with the usual data; OliviaDB only (its
container ran alone; PostgreSQL's numbers are those of the published rounds); 16 clients,
20 s, then the open-loop search. Round 1 in the order base, fix 2, mimalloc, both; round 2
in the reverse order. All four use the harness with fix 4 (the range workload in pages of
16). Raw records: bench/published/2026-12-02/fixes/. Host load before the runs 5.5-13.5
(1 min); the busiest other processes were macOS's mediaanalysisd, textunderstandingd and
spotlightknowledged, at times about one core.
| workload | measure | base | fix 2: no seek per child | fix 1: mimalloc | fixes 1 + 2 |
|---|---|---|---|---|---|
Read a customer with its accounts and the last 100 transactions of each (dossier) |
ops/s (16 clients), round 1 / 2 | 1,299 / 1,272 | 2,045 / 2,088 | 1,432 / 1,421 | 2,494 / 2,490 |
Read a customer with its accounts and the last 100 transactions of each (dossier) |
p99 ms, round 1 / 2 | 50.35 / 51.14 | 24.92 / 25.66 | 47.05 / 46.82 | 11.37 / 11.46 |
Read a customer with its accounts and the last 100 transactions of each (dossier) |
max rate at p99 ≤ 10 ms, round 1 / 2 | 731 / 716 | 1,151 / 783 | 1,209 / 799 | 935 / 934 |
List customers, 50 per page (page) |
ops/s (16 clients), round 1 / 2 | 5,273 / 5,031 | 4,935 / 4,686 | 5,681 / 5,492 | 4,956 / 5,043 |
List customers, 50 per page (page) |
p99 ms, round 1 / 2 | 44.17 / 44.63 | 46.79 / 46.78 | 42.29 / 42.17 | 45.09 / 43.28 |
List customers, 50 per page (page) |
max rate at p99 ≤ 10 ms, round 1 / 2 | 4,449 / 4,245 | 4,164 / 3,954 | 4,794 / 4,634 | 4,182 / 4,255 |
An account's transactions for one week (range) |
ops/s (16 clients), round 1 / 2 | 12,399 / 12,173 | 15,587 / 15,734 | 13,975 / 13,904 | 14,047 / 16,502 |
An account's transactions for one week (range) |
p99 ms, round 1 / 2 | 14.04 / 13.76 | 2.29 / 2.24 | 5.13 / 5.33 | 2.50 / 2.26 |
An account's transactions for one week (range) |
max rate at p99 ≤ 10 ms, round 1 / 2 | 10,462 / 6,847 | 8,768 / 8,850 | 11,791 / 7,821 | 11,852 / 9,282 |
Find a customer by card number (lookup) |
ops/s (16 clients), round 1 / 2 | 20,024 / 20,109 | 20,105 / 20,226 | 20,513 / 20,489 | 20,694 / 20,525 |
Find a customer by card number (lookup) |
p99 ms, round 1 / 2 | 1.47 / 1.50 | 1.45 / 1.45 | 1.45 / 1.45 | 1.43 / 1.44 |
Find a customer by card number (lookup) |
max rate at p99 ≤ 10 ms, round 1 / 2 | 16,896 / 11,311 | 11,309 / 11,377 | 11,539 / 11,525 | 11,640 / 11,546 |
| workload | fix 2: no seek per child | fix 1: mimalloc | fixes 1 + 2 |
|---|---|---|---|
Read a customer with its accounts and the last 100 transactions of each (dossier) |
1.61× | 1.11× | 1.94× |
List customers, 50 per page (page) |
0.93× | 1.08× | 0.97× |
An account's transactions for one week (range) |
1.27× | 1.13× | 1.24× |
Find a customer by card number (lookup) |
1.00× | 1.02× | 1.03× |
Throughput of each build against the base (mean of the two rounds):
Fix 4 alone (the harness; base image both times): the range workload with pages of 100 made 4 655 and 4 582 operations per second (p99 43 ms), with pages of 16 12 399 and 12 173 (p99 14 ms): 2.7 times, from no longer reading and sending 12 times the week.
What the numbers say¶
- Fix 2, no seek per child, is the large one where children are leaves: the dossier 1.6× (its 200 transactions), the week range 1.27× with p99 from 14 to 2.3 ms. It costs the page listing about 7 %: a customer's subtree is about 200 entries, so the 8 steps before the seek are wasted there. The next version decides by the child type: a type without child types steps (nothing to skip), a type with child types seeks at once as before.
- Fix 1, mimalloc, is worth 2-13 % (dossier 1.11×, page 1.08×, range 1.13×, lookup 1.02×), less than the 27-34 % glibc's allocator held in the profile: part of that time moves to mimalloc, and the rest of the request did not get faster. It stays: it helps every workload and costs nothing measurable.
- Both together: the dossier 1.9× (1 299 and 1 272 → 2 494 and 2 490 per second, p99 from 50 to 11 ms); the week range 3.3× over pages of 100 (fix 4 counted); the page listing and the lookup about unchanged.
- Against PostgreSQL (its published rounds, same settings): the dossier from 5.5× slower
to about 2.9× slower; the week range from 5.8× slower to about 1.7× slower; the page
listing and the lookup unchanged (4.1× and 1.4× slower). Next: the type-based skip (above),
JSON without the
Valuetree (fix 3), then the dossier in one request (fix 6).
Fix 2 v2, fix 3 and fix 6, each measured alone; PostgreSQL afresh (2026-12-02)¶
Images, each on the one before it: bench-fix12 (mimalloc and fix 2's first version, the
"both" above), bench-v2 (fix 2 decided by the child type), bench-fix3 (reads write their
JSON straight out), bench-fix6 (tree=true&each=N: the dossier in one request, tree reads
written straight out). Two rounds in opposite order, from empty volumes each, 16 clients,
20 s, then the open-loop search. The bench-fix6 runs measured PostgreSQL too, with the
dossier statement that returns what OliviaDB's one-request dossier returns (the customer,
at most 100 accounts, each one's newest 100 transactions, its cards: one statement, see
"The workloads"). dossier-calls is the former dossier on both sides (OliviaDB's four
requests, PostgreSQL's former statement, no card). Raw records:
bench/published/2026-12-02/fixes-2/. Host load before the runs 5.3-16.3 (1 min).
Both dossiers hold the same data. oliviadb-bench check-dossier compared 8 customers
after each round's bench-fix6 run: on both sides 2 accounts, 200 transactions with the same
amounts in the same order, 1 card with the same number, for every one
(check-dossier-r{1,2}.txt).
| workload | measure | fixes 1 + 2 v1 (last window) | + fix 2 v2: skip by child type | + fix 3: JSON written straight out | + fix 6: each (tree reads written out) | PostgreSQL (fresh) |
|---|---|---|---|---|---|---|
Read a customer with its accounts, the last 100 transactions of each and its card, one request (dossier) |
ops/s (16 clients), round 1 / 2 | – | – | – | 3,653 / 3,542 | 6,906 / 7,150 |
Read a customer with its accounts, the last 100 transactions of each and its card, one request (dossier) |
p99 ms, round 1 / 2 | – | – | – | 44.16 / 44.23 | 6.20 / 5.70 |
Read a customer with its accounts, the last 100 transactions of each and its card, one request (dossier) |
max rate at p99 ≤ 10 ms, round 1 / 2 | – | – | – | – / – | 5,827 / 4,022 |
The same without the card, as four requests (dossier-calls) |
ops/s (16 clients), round 1 / 2 | 2,510 / 2,457 | 2,072 / 2,479 | 2,726 / 2,654 | 2,715 / 2,411 | 7,826 / 6,462 |
The same without the card, as four requests (dossier-calls) |
p99 ms, round 1 / 2 | 11.25 / 12.04 | 15.67 / 11.03 | 10.46 / 10.72 | 10.36 / 12.04 | 4.92 / 6.32 |
The same without the card, as four requests (dossier-calls) |
max rate at p99 ≤ 10 ms, round 1 / 2 | 1,412 / 921 | 1,165 / 1,395 | 1,533 / 1,493 | 1,527 / 1,356 | 6,603 / 5,453 |
List customers, 50 per page (page) |
ops/s (16 clients), round 1 / 2 | 5,368 / 4,910 | 5,813 / 5,496 | 6,658 / 6,275 | 6,227 / 6,202 | 24,803 / 24,305 |
List customers, 50 per page (page) |
p99 ms, round 1 / 2 | 43.96 / 44.32 | 41.70 / 42.38 | 36.69 / 37.29 | 37.57 / 38.24 | 1.31 / 1.37 |
List customers, 50 per page (page) |
max rate at p99 ≤ 10 ms, round 1 / 2 | 4,529 / 4,143 | 4,905 / 4,637 | 5,617 / 5,294 | 5,254 / 5,233 | 20,928 / 20,507 |
An account's transactions for one week (range) |
ops/s (16 clients), round 1 / 2 | 16,504 / 16,069 | 16,511 / 16,139 | 16,767 / 16,741 | 16,524 / 16,537 | 27,062 / 27,323 |
An account's transactions for one week (range) |
p99 ms, round 1 / 2 | 2.13 / 2.23 | 2.15 / 2.15 | 2.03 / 2.00 | 2.04 / 2.10 | 1.08 / 1.09 |
An account's transactions for one week (range) |
max rate at p99 ≤ 10 ms, round 1 / 2 | 9,283 / 9,039 | 13,932 / 13,617 | 14,147 / 9,417 | 13,942 / 13,953 | 22,833 / 15,369 |
Find a customer by card number (lookup) |
ops/s (16 clients), round 1 / 2 | 20,268 / 20,207 | 20,304 / 20,282 | 20,264 / 20,270 | 19,927 / 20,244 | 28,277 / 28,678 |
Find a customer by card number (lookup) |
p99 ms, round 1 / 2 | 1.45 / 1.48 | 1.45 / 1.45 | 1.46 / 1.46 | 1.48 / 1.47 | 0.97 / 0.97 |
Find a customer by card number (lookup) |
max rate at p99 ≤ 10 ms, round 1 / 2 | 11,400 / 11,367 | 17,132 / 11,409 | 11,399 / 7,601 | 11,209 / 17,081 | 23,859 / 24,197 |
| workload | + fix 2 v2: skip by child type | + fix 3: JSON written straight out | + fix 6: each (tree reads written out) | OliviaDB (all fixes) against PostgreSQL |
|---|---|---|---|---|
Read a customer with its accounts, the last 100 transactions of each and its card, one request (dossier) |
– | – | – | PostgreSQL 2.0× faster |
The same without the card, as four requests (dossier-calls) |
0.92× | 1.18× | 0.95× | PostgreSQL 2.8× faster |
List customers, 50 per page (page) |
1.10× | 1.14× | 0.96× | PostgreSQL 4.0× faster |
An account's transactions for one week (range) |
1.00× | 1.03× | 0.99× | PostgreSQL 1.6× faster |
Find a customer by card number (lookup) |
1.00× | 1.00× | 0.99× | PostgreSQL 1.4× faster |
Each column against the one before it (mean of the two rounds); the last column is OliviaDB with every fix against PostgreSQL measured in the same window.
Fix 6 alone (same build): the dossier in one request made 3 653 and 3 542 per second, the same data in four requests (without the card) 2 715 and 2 411: 1.40 times.
What the numbers say¶
- The dossier, OliviaDB's own case, is now 2.0× slower than PostgreSQL (3 598 against 7 028 per second, means of the rounds), from 5.5× in the published results: 2.8 times faster than the published build. Its p99 stays high (44 ms against 6 ms): the container is at its CPUs and requests queue; no open-loop rate held p99 10 ms.
- Fix 2 v2 removes the page regression (page 1.10× over the first version) and keeps
the gains on leaves; fix 3 is worth 14-18 % on the dossier and the page listing, less
than the 23-25 % the
Valuetree held in the profile. - The week range is 1.6× slower than PostgreSQL, the card lookup 1.4×, the page listing 4.0×: per-request costs (TLS, HTTP, the hand-off) dominate the first two, the cost per node the last two.
- The gap that remains is the cost per node, not the model: the dossier is one contiguous range of keys on OliviaDB, while PostgreSQL probes indexes on three tables. Next is a breakdown of that cost per stage, in process, against RocksDB on the same keys, before further fixes.
The cost per node, stage by stage (2026-12-02)¶
The dossier is one contiguous range of keys on OliviaDB (the customer's subtree in pre-order), while PostgreSQL probes indexes on three tables, yet PostgreSQL answers it with about 0.34 ms of CPU for 201 rows (1.7 µs a row, its protocol included) and OliviaDB with about 1.1 ms for 204 nodes. The gap is a constant cost per node, not the layout. It is also why the one-request dossier's p99 is 44 ms: the server is at its CPUs and requests queue, so the same per-node work fixes the tail too.
In process, by stage¶
cargo test --release -p oliviadb-server --lib probe -- --ignored --nocapture
(src/native/probe.rs): the benchmark's schema and data shape (2 000 customers, each with
2 accounts of 100 transactions and a card: 204 nodes), 200 customers sampled, 20 passes,
each stage measured on its own and including the stages before it; no HTTP, no TLS.
| stage | ns per node, as loaded (9 tables and a memtable) | ns per node, compacted (8 tables) |
|---|---|---|
| 1. the iterator: seek to the customer, step through its subtree (the merge over every source) | 110 | 70 |
| 2. copying each key and value out (what a listing returns) | 15 | 16 |
3. parsing the key into its path (steps_of) |
365 | 366 |
4. decoding the value by its layout (open_value: a Vec of named Json fields) |
649 | 642 |
5. writing the JSON (render_into: path text, key object, fields with the profile's checks), net of the decode it repeats |
834 | 817 |
6. the rest of the request (handle_reply: access checks, the tree walk, children() vectors, per-node buffers) |
417 | 374 |
| the whole read | 2 390 | 2 285 |
The same data in RocksDB¶
The probe's store dumped (414 013 entries, 84 MB) and loaded into RocksDB 0.23 (rust-rocksdb, block cache 512 MB, compacted), the same 200 customers' ranges scanned 20 times on the same machine: 99 ns per entry for the iterator, 123 ns with key and value copied out. OliviaDB's own iterator is at 70 and 86 ns: the storage layer is not where the time goes. Stages 3 to 6, above the storage, are 2.2 µs of the 2.3 µs.
The answer's size and TLS¶
A dossier as OliviaDB answers it is 65 915 bytes of JSON (323 bytes per node: every node carries its full path, its type, its key object and its layout's 71-character hash beside its fields). PostgreSQL's 201 rows for the same data are 28 522-29 263 bytes of DataRow messages in the text format (computed from the protocol's DataRow layout: a type byte, a length, a column count, a length and the bytes of each column), 2.3 times fewer. TLS was 6-7 % of the server's CPU in the profile above; it grows with the bytes, so the size of the answer matters, though less than the work per node.
Budget and plan¶
Budget: at most 1 µs per node in process, 1.5 µs all-in in the server (the dossier at about 0.3 ms of CPU, PostgreSQL's level). Where it has to come from, ranked by size:
- Writing the JSON straight from the stored bytes (stages 4 and 5, 1.46 µs): decode each
field from the stored record into the answer, with no
Vec<(String, Json)>, noBTreeMapof fields and no per-fieldString; a type's field order, names and the profile's per-field decisions (masks, fields shown) computed once per request and type, not per node; the fast path when a type has no masks and no field filter. - The path once per parent, not parsed per node (stage 3, 0.37 µs): children of one parent share its path; parse only the last segment, and write the path text from the parent's text plus that segment.
- No copies and buffers in the tree walk (stage 6, 0.37-0.42 µs): borrow keys and values
from the block (
Arc<Block>through the iterator) instead ofchildren()vectors of copies; write each node once into the answer, withchildrenafter the node's own fields, so no node is buffered and copied (JSON object members have no order, so this changes no value, only the text); one pass over the subtree for a tree read, instead of a listing per type per node. - A single-source fast path when the whole range lies in one table (no merge), and no blocking-pool hand-off for reads that finish in microseconds (19 % of a card lookup).
- A compact answer, optional (
format=compactor a binary type): per type its field names and layout once, then rows of values; about the size of PostgreSQL's rows. To be specified in oliviadb-spec first.
Each step is measured alone, in process with this probe and in the containers in a quiet window, before the next.
Plan steps 1 to 4, each measured alone in process (2026-12-02)¶
The probe of "The cost per node, stage by stage" (src/native/probe.rs), now also counting
heap allocations per node and stage (a counting allocator in the test build), run on the
tree before the plan (470c52b) and after each step, every tree built in its own worktree,
two rounds in alternating order on an otherwise idle machine (single-threaded; no HTTP,
no TLS, no containers). The whole read is handle_reply of
GET Customer/{c}?tree=true&each=100: 204 nodes, 65 915 bytes of JSON each, the same
bytes after every step.
| tree | whole read, ns per node, as loaded (9 tables and a memtable), round 1 / 2 | compacted (8 tables), round 1 / 2 | allocations per node |
|---|---|---|---|
before the plan (470c52b) |
2 381 / 2 341 | 2 302 / 2 266 | 73.9 |
step 1: fields written from the stored bytes by a plan per type and layout (26b21de) |
1 655 / 1 602 | 1 551 / 1 526 | 46.5 |
step 2: the path once per parent (9300bbd) |
1 308 / 1 287 | 1 234 / 1 203 | 33.6 |
step 3: one pass over the subtree, borrowed keys and values (a73549d) |
915 / 904 | 872 / 863 | 18.4 |
step 4: upper bounds, the merge over the sources that hold the range (0d663a4) |
884 / 885 | 868 / 869 | 18.4 |
Steps 1 to 3 together: 2.6 times less CPU per node in process, from 2.3 µs to 0.87 µs, under the budget of 1 µs. Step 4 shows only where the range is spread over several sources (as loaded: 3 %); its second part, one-node reads and full-key lookups of a unique index run on the receiving task instead of the blocking pool, is not in this probe (no HTTP): it is for the containers to measure.
Where step 1's time went (coordinator's question: 650 ns to decode three fields). The
allocations per stage answer it. open_value made 26.8 allocations per node: 15.9 of
them, and about 380 ns, were a second parse of the whole key (steps_of, for the type of
the last level and the subject's root, which the caller already had), and the other 11
were the decode itself: the Vec of fields, a String per field name, one to three per
value (a string trimmed into a new String; a decimal through to_string and two
format!s), and a copy of the 71-character layout id. The general writer then decoded
again, built a map, asked the profile per field and wrote: 39.7 allocations and 1.4 µs per
node for the two stages. The planned writer does the same work in 0.7 µs with 11.9
allocations, the rest of which were the key object and the path (step 2) and the buffers of
the tree walk (step 3).
What the steps change, and how each is checked:
native/fast.rs: per request, node type, writer layout and grant, the fields shown in output order with their places in the data, masks and names as JSON text, and the defaults of fields added since the writer's layout, written once; each node's fields written from its bytes (Codec::write_json). Types with row rules and layouts with variant cases keep the general writer. Test: the two writers on the same stored nodes, byte for byte (every logical type, every character serde_json escapes, masks, PII, field grants, rows, variants, a later schema version's defaults).pathkey::comp_at,Agg::child_step,Agg::child_path: a child's own level decoded and its path text written from the parent's. Test: equal tosteps_ofandpath_textfor every stored node.Native::tree_into: one iterator over the subtree, each leaf written once into the answer, skipped listings and subtrees with one seek; the answer byte for byte the nested writer's, member order included (so no change ofoliviadb-spec: neither the spec nor the SDKs promise a member order, and RFC 8259 section 4 makes objects unordered, but the order is kept). Test: both writers on every root, profile,eachand node budget.DbIter::set_upper_bound,TxnIter::set_upper_bound,native::small_read. Tests: the bounded iteration is the unbounded one cut at the bound (40 random histories); which requests skip the pool.
Next: these four in the containers in a quiet window (dossier, page, range, lookup against PostgreSQL), then step 5 (a compact answer, specified in oliviadb-spec first).
Plan steps 1 to 4 in the containers, each alone; PostgreSQL afresh (2026-12-02)¶
The images of the four steps (oliviadb:bench-s1 to -s4, built from 26b21de, 9300bbd,
a73549d and 0d663a4) against the image before them (oliviadb:bench-fix6, the server code
of main 470c52b), in a quiet window: 16 clients, 20 s, then the open-loop search; 4 CPUs
and 2 GiB per container; each run from empty volumes with the usual data. Round 1 in the
order before, 1, 2, 3, 4; round 2 reversed. PostgreSQL ran with the "before" image in each
round. Raw records: bench/published/2026-12-02/plan-1-4/ (.env names each image; .load.jsonl
has the host's load average and other_cpu_pct). That field leaves out the containers, the
Docker VM, the harness and its load generator, and it is measured before each run, when no
generator runs. What remains here (up to about two cores at times) is macOS system services,
on-device model services among them, which the window could not stop. Two rounds in opposite
order spread that noise over the steps.
| workload | measure | before | step 1 | step 2 | step 3 | step 4 | PostgreSQL |
|---|---|---|---|---|---|---|---|
dossier (a customer with its accounts, the last 100 transactions of each and its card, one request) |
ops/s, round 1 / 2 | 3,610 / 3,512 | 3,628 / 3,674 | 3,783 / 3,765 | 3,841 / 3,741 | 3,203 / 3,796 | 7,454 / 7,140 |
| server CPU per op, µs (round 1 / 2) | 624 / 636 | 465 / 470 | 407 / 409 | 325 / 330 | 399 / 317 | 258 / 349 | |
page (50 customers) |
ops/s | 6,358 / 6,395 | 7,043 / 6,609 | 6,637 / 6,720 | 6,962 / 7,086 | 6,627 / 6,614 | 24,959 / 24,506 |
| server CPU per op, µs | 569 / 565 | 513 / 549 | 545 / 541 | 526 / 513 | 550 / 551 | 72 / 72 | |
range (an account's week of transactions) |
ops/s | 16,930 / 16,457 | 17,019 / 17,096 | 16,943 / 16,984 | 17,151 / 16,812 | 17,019 / 17,148 | 27,767 / 26,913 |
| server CPU per op, µs | 145 / 148 | 129 / 129 | 125 / 124 | 124 / 126 | 124 / 124 | 53 / 57 | |
lookup (a customer by card number) |
ops/s | 20,521 / 20,260 | 20,299 / 20,310 | 20,225 / 20,543 | 20,482 / 18,747 | 27,676 / 27,690 | 29,000 / 28,685 |
| server CPU per op, µs | 117 / 118 | 117 / 117 | 118 / 116 | 116 / 112 | 48 / 48 | 44 / 43 |
Server CPU per op is the container's average CPU (cpu_pct_avg) divided by the throughput.
p99 and the open-loop rates are in the raw records. A check after the runs
(check-dossier, both databases loaded alongside step 4) found the dossiers equal for 8
customers (check-dossier-s4.txt).
What the numbers say¶
- The dossier's server CPU halved (624-636 µs to 317-330 µs per dossier, PostgreSQL 258-349 µs; step 4's first round, 399 µs, ran beside the most host noise),
as the probe predicted, but its throughput did not move (3.5-3.8k/s). The server is no
longer what limits it. It runs at 120-128 % of its 4 CPUs while PostgreSQL's dossier runs at
190-250 %. Each answer is 65,915 bytes of JSON, against PostgreSQL's 28.5-29.3 KB of rows,
and the load generator parses it over TLS through the Docker VM's network. That is the cost
the binary row format of plan step 5 (
spec/native-protocol.md) removes: about 17.5 KB per dossier, with no JSON on either side. lookupis level with PostgreSQL after step 4: the one-node read runs on the receiving task instead of the blocking pool, which takes server CPU per lookup from 117 µs to 48 µs (PostgreSQL 44 µs) and throughput from 20.3k/s to 27.7k/s (PostgreSQL 28.7-29.0k/s).pageis CPU-bound (about 3.6 of 4 CPUs) at about 11 µs per listed customer, and the steps did not change it: listing roots seeks past each customer's subtree, and each seek repositions every source of the merge. This is the next read item. A forward seek can keep the sources that are already at or past the target, since those are already correct for a forward seek. A target inside the current block can be found without the table's index.rangegained 15 % of server CPU (145 to 124 µs) but not throughput, for the same reason as the dossier: the server runs at 2.1 of 4 CPUs.
OliviaDB over its native protocol, PostgreSQL over its own (2026-12-02)¶
The same reads and payment as above, on one server image (oliviadb:bench-native, core
native-bench), measured three ways: PostgreSQL through its wire protocol, OliviaDB through
HTTP and JSON, and OliviaDB through its native protocol (spec/native-protocol.md). Fair
terms:
- Transport security: TLS on all three. The PostgreSQL client uses
sslmode=require, and the HTTP and native clients use the same rustls client settings (TLS 1.3). - Decoding: the native client turns every key part and every shown field of every node
into text (strings without padding, decimals, timestamps, integers), and the HTTP client
parses the whole JSON answer. Correction (2026-12-03): this section said that was the
work the PostgreSQL client does for its rows. It was not: the PostgreSQL client of these
runs called
query()and kept each row's undecoded DataRow, reading no column. So the native client did more work per row than the PostgreSQL client in this section and in the three that follow (page-fast, block search, listing index). Their numbers stay as measured under that client. From the run after them the PostgreSQL client reads every column of every row as text with the same per-row allocations ("Equal client work", below). - One connection per client, 16 clients, 20 s each, then the open-loop search. 4 CPUs and 2 GiB per container.
- Not run natively: agent memory and state (
counter,recall,remember) are HTTP APIs, so they have no native run.
Raw records: bench/published/2026-12-02/native/. Round 1 ran in the order PostgreSQL,
HTTP, native; round 2 reversed it. From 20:25 in round 2 the host was disturbed by something
outside the benchmark: the 1-min load reached 50 to 76 and other_cpu_pct reached 202, as the
.load.jsonl records show. Round 2's dossier, page and change-stream runs, and PostgreSQL's
range, are therefore left out below. A rerun in the next window stopped at once on the same
symptom (load 27).
| workload | measure | PostgreSQL | OliviaDB, HTTP/JSON | OliviaDB, native |
|---|---|---|---|---|
dossier |
ops/s (round 1) | 7,210 | 3,735 | 11,158 |
| p99 ms | 5.41 | 44.05 | 3.74 | |
| server CPU per op, µs | 270 | 313 | 181 | |
| max rate, p99 ≤ 10 ms | 4,056 | – | 6,276 | |
| bytes per answer | 28,522-29,263 (DataRow text) | 65,759-65,959 | 17,046 | |
page |
ops/s (round 1) | 24,303 | 6,513 | 6,488 |
| p99 ms | 1.36 | 35.91 | 40.83 | |
| server CPU per op, µs | 73 | 557 | 559 | |
range |
ops/s, round 1 / 2 | 27,310 / – | 17,024 / 17,038 | 19,634 / 19,591 |
| p99 ms | 1.06 / – | 1.90 / 1.83 | 1.50 / 1.50 | |
| server CPU per op, µs | 53 / – | 126 / 127 | 114 / 115 | |
lookup |
ops/s, round 1 / 2 | 28,822 / 28,691 | 27,651 / 27,613 | 28,534 / 28,484 |
| p99 ms | 0.96 / 0.95 | 1.04 / 1.03 | 0.99 / 0.98 | |
| max rate, p99 ≤ 10 ms | 24,319 / 24,208 | 15,554 / 15,532 | 24,076 / 24,034 | |
payment |
ops/s, round 1 / 2 | 6,858 / 6,838 | 8,357 / 9,564 | 9,220 / 9,639 |
| p99 ms | 3.56 / 3.59 | 4.45 / 2.91 | 3.04 / 2.85 | |
cdc |
records/s (round 1) | 24,458 | 74,483 | 101,831 |
The dossiers are equal over both front ends: for 8 customers on freshly loaded data, the
native answer has PostgreSQL's accounts, transactions (amounts in order) and cards
(check-dossier.txt).
What the numbers say¶
- The dossier, the aggregate read in one request, is now OliviaDB's. Over the native protocol it runs at 1.55 times PostgreSQL's throughput, with a p99 of 3.7 ms against 5.4 ms, and two thirds of PostgreSQL's server CPU per answer. It is 3 times its own HTTP/JSON rate. The answer is 17 KB of stored bytes, against 66 KB of JSON and 29 KB of PostgreSQL rows, and the server writes it with one copy per node.
- lookup is level with PostgreSQL. Over the native protocol it holds PostgreSQL's maximum rate under p99 10 ms, which HTTP did not (15.5k).
- payment and the change stream are ahead of PostgreSQL in both front ends.
- page is 3.7 times behind, and the protocol does not change it. The server is at its CPUs with a seek per listed customer (about 11 µs each), which is the next item: a forward seek that leaves alone the sources already past the target.
- range is 1.4 times behind. Native improves on HTTP by 15 %.
Reads without the blocking pool, and ranges with an end (2026-12-03)¶
The native bench again, on core page-fast (image oliviadb:bench-fast): small listings
(a limit of at most 64) are read on the task that received them, under a budget of nodes
read, instead of being handed to the blocking pool; the block cache and table iterators no
longer write shared memory on every lookup; and the range workload reads its week as a key
range (after the week's end, to its first day, pages followed by next; the listing
bound to is new, docs/network-api.md). Same terms as the section above (TLS on all
three, the native client decodes every field to text and the PostgreSQL client decodes none,
see the correction there; 16 clients with one connection each,
20 s per run, 4 CPUs and 2 GiB per container). Round 1 ran PostgreSQL, HTTP, native; round 2
reversed the order of targets and workloads. The host's 1-min load was 5 to 13 before the
runs and the CPU of processes outside the benchmark 40 to 135 % (.load.jsonl).
Raw records: bench/published/2026-12-03/fast/.
| workload | measure | PostgreSQL | OliviaDB, HTTP/JSON | OliviaDB, native |
|---|---|---|---|---|
dossier |
ops/s, round 1 / 2 | 7,238 / 7,239 | 3,780 / 3,654 | 11,335 / 11,159 |
| p99 ms | 5.50 / 5.47 | 44.02 / 10.68 | 3.86 / 3.87 | |
| server CPU per op, µs | 333 / 309 | 302 / 313 | 173 / 181 | |
page |
ops/s, round 1 / 2 | 24,980 / 24,747 | 16,296 / 15,865 | 20,526 / 19,750 |
| p99 ms | 1.32 / 1.38 | 2.60 / 2.62 | 1.82 / 1.95 | |
| server CPU per op, µs | 70 / 72 | 136 / 162 | 113 / 136 | |
range |
ops/s, round 1 / 2 | 27,900 / 27,738 | 24,945 / 25,136 | 27,772 / 27,710 |
| p99 ms | 1.03 / 1.05 | 1.32 / 1.31 | 1.04 / 1.05 | |
| server CPU per op, µs | 51 / 53 | 49 / 48 | 39 / 38 | |
lookup |
ops/s, round 1 / 2 | 29,093 / 29,104 | 27,884 / 28,003 | 28,921 / 28,892 |
| p99 ms | 0.95 / 0.95 | 1.05 / 1.04 | 0.98 / 0.98 | |
| max rate, p99 ≤ 10 ms | 16,365 / 16,371 | 23,527 / 15,752 | 24,402 / 24,378 | |
payment |
ops/s, round 1 / 2 | 6,903 / 6,849 | 8,523 / 9,654 | 9,035 / 9,838 |
| p99 ms | 3.61 / 3.68 | 4.36 / 3.27 | 3.51 / 2.97 | |
cdc |
records/s, round 1 / 2 | 24,658 / 25,003 | 73,046 / 83,487 | 98,959 / 119,949 |
On freshly loaded data the dossiers are equal over both front ends for 8 customers
(check-dossier.txt), and the range weeks are equal to PostgreSQL's for 40 account weeks,
311 transactions, over HTTP and native (oliviadb-bench check-range, check-range.txt).
- Range now matches PostgreSQL (0.995 and 0.999 of its throughput, p99 1.01 and 1.00 of its p99) with three quarters of its CPU per operation. Before: 0.72 of its throughput, 114 µs of CPU per operation. Most of that was the hand-off to the blocking pool (about 60 of 90 µs on a local server), the rest reading 16 transactions where the week holds about 8.
- Page tripled (6,488 to 20,526 per second, CPU per operation 559 to 113 µs) but is still behind: 0.80 to 0.82 of PostgreSQL's throughput, p99 1.38 to 1.41 times its p99. What remains is a seek past each customer's subtree, over every level of tables, 50 per page; PostgreSQL reads 50 consecutive rows of its customer table.
- Lookup is level: 0.99 of PostgreSQL's throughput, p99 1.03 times. All three targets stop at 28,000 to 29,000 lookups and ranges per second, which points at the client side (16 clients, TLS) rather than at either server.
Page after the block-search work (2026-12-03)¶
Core block-search (main 4de166b, image oliviadb:bench-block): restart entries and index
partitions decoded once when a block enters the cache, a restart point every 8 entries, and
row-form listings that decode each child's type only. Page only, PostgreSQL, HTTP and native,
two rounds in opposite order (host 1-min load 6 to 12; records in
bench/published/2026-12-03/block/, range weeks checked equal to PostgreSQL's again):
page |
ops/s, round 1 / 2 | p99 ms | server CPU per op, µs |
|---|---|---|---|
| PostgreSQL | 24,862 / 24,977 | 1.34 / 1.31 | 74 / 70 |
| OliviaDB, native | 20,827 / 20,850 | 1.83 / 1.81 | 100 / 100 |
| OliviaDB, HTTP/JSON | 16,223 / 16,199 | 2.57 / 2.63 | 145 / 144 |
| OliviaDB, native, before (above) | 20,526 / 19,750 | 1.82 / 1.95 | 113 / 136 |
CPU per page fell by 12 to 26 %, throughput barely moved: 0.84 of PostgreSQL's, p99 1.37
times its p99. What remains is one seek per listed customer: each customer's subtree is about
as long as a table block, so the next customer is always in another block (counted in
process: 50 table seeks and 50 block fetches per page of 50, no other level searched).
Changing the order of the stored keys was considered and set aside (docs/considered.md);
a covering index a schema declares on the listed type is the next step.
A listing index on the listed type (2026-12-03)¶
Core listing-index (built from 49f4465, the same change before its rebase onto main as 52d522a; image oliviadb:bench-li): the bench schema declares
listing index include (name, branch) on Customer (spec/schema.md 4.8), so a page of
customers is one range of index entries instead of one seek per customer. Page, dossier and
payment, PostgreSQL, HTTP and native, two rounds in opposite order; page again with the same
image and bench/bench-noindex.olv (the schema without the index) for comparison (host
1-min load 3.5 to 13; records in bench/published/2026-12-03/li/; dossiers equal for 8
customers and range weeks equal for 40 account weeks, HTTP and native):
| ops/s, round 1 / 2 | PostgreSQL | OliviaDB, native | OliviaDB, HTTP/JSON |
|---|---|---|---|
page |
24,924 / 24,872 | 22,047 / 22,193 | 17,344 / 17,295 |
page, schema without the index |
21,073 / 20,983 | 16,578 / 16,391 | |
dossier |
7,361 / 6,707 | 11,262 / 11,025 | 3,695 / 3,040 |
payment |
6,991 / 6,956 | 9,751 / 10,073 | 8,412 / 9,355 |
| p99 ms, server CPU per op µs | PostgreSQL | OliviaDB, native |
|---|---|---|
page |
1.33 / 1.33, 74 / 71 | 1.64 / 1.55, 51 / 43 |
page, without the index |
1.78 / 1.81, 94 / 98 | |
dossier |
5.54 / 6.11 | 4.01 / 4.15 |
payment |
3.71 / 3.56 | 3.29 / 2.90 |
The index halves the server's CPU per page (94-98 µs to 43-51, below PostgreSQL's 71-74), but throughput rises by 5 % only: 0.89 of PostgreSQL's, p99 1.16 to 1.23 times its p99. Native page is now bounded by something other than the server's read path; that is being measured (bytes, frames and client CPU per page on both sides). Dossier and payment, which write and read the same aggregates, did not lose anything to the index's upkeep.
Write amplification and space, measured in process on the same data (10,000 customers,
two loads each, GET /v1/admin/stats and the store's size after the load settled):
| without the index | with the index | |
|---|---|---|
| bytes logged by the load | 478.2 MB | 479.4 MB (+0.26 %) |
| bytes compacted by the load | 1,259-1,268 MB | 1,257 MB |
| store after the load | 429,056-429,060 KiB | 430,116-430,120 KiB (+1,060 KiB, +0.25 %) |
| bytes logged per payment | 359 | 359 |
An index entry is written with its customer and again only when an included field changes;
payments change neither name nor branch, so their writes are the same. A schema that
does not declare the index (bench/bench-noindex.olv) reads pages as before.
Equal client work (2026-12-03)¶
From this point every client turns everything it receives into text. The PostgreSQL client
reads every column of every row with Row::get into a String, character columns without
trailing pad blanks and numbers in decimal (decimals and timestamps arrive as text, cast by
the statements on the server). Each row becomes one node of field names and values, the
same structure and the same per-row allocations as the native client's nodes
(oliviadb-bench pgtext.rs, native.rs). Before this, the PostgreSQL client kept the
undecoded rows (see the correction under "OliviaDB over its native protocol"). Every record
also carries the client's CPU per operation and its socket traffic (client_cpu_us_per_op,
wire_per_op; "Measures").
Earlier runs and the method in detail¶
Harness: bench/ (compose.yml, run.sh, the schemas) and the load generator
open/crates/oliviadb-bench. One command runs every number below:
bench/run.sh # builds both containers from empty volumes, loads, measures (about an hour)
Results of 2026-12-02 are below; their raw records are in bench/published/2026-12-02/
(after.*: this build against PostgreSQL; before.*: OliviaDB at 398d332, before the
profiling fixes; ab.jsonl: the short rerun that compares the two). Tables are made from
them with bench/table.py <file>.jsonl.
Setup¶
- Two containers side by side, the same limits: 4 CPUs and 2 GiB each (
cpus,mem_limitinbench/compose.yml), data on named Docker volumes, published on 127.0.0.1 only. Eachrun.shrecords the host, Docker's VM, both versions and the host's load average before the runs (bench/results/<date>.env). - PostgreSQL 16.6 (the official image),
bench/postgres/postgresql.conf: shared_buffers 512 MB, effective_cache_size 1.5 GB, wal_buffers 16 MB, max_wal_size 4 GB, checkpoints every 15 min,fsync,synchronous_commitandfull_page_writeson,wal_level = logical(the change stream). Schemabench/postgres/schema.sql: normalized tables with foreign keys and the indexes the queries need; queries prepared once per connection, no ORM. - OliviaDB: the core image (
docker/Dockerfile) servingbench/bench.olvnatively (OLIVIADB_SCHEMA), one API key whose principal names the schema'sbenchprofile. Writes are acknowledged after the log sync (group commit), as PostgreSQL's withsynchronous_commit = on. - Both over TLS (each server's self-signed certificate; the load generator does not verify it), one connection per worker on either side (PostgreSQL protocol; HTTP/1.1 with keep-alive), the load generator on the host outside both containers.
- Data: 10 000 customers, each with 2 accounts of 100 transactions over 90 days and one
card; 20 000 agent-memory episodes about 5 000 subjects (
--customers --accounts --txns --episodes).
Workloads (each side's own idiom)¶
| workload | PostgreSQL | OliviaDB |
|---|---|---|
dossier: a customer, its accounts, the newest 100 transactions of each |
one statement (join with a LATERAL subquery per account) |
GET the customer, list its accounts, list each account's transactions (limit=100, newest first by the key) |
payment: a transaction inserted and the balance changed, atomically |
BEGIN; UPDATE ... balance = balance - x; INSERT ...; COMMIT |
POST /v1/txn: an update with "add": {"balance": "-1.25"} and the insert (since 5255025; the results of 2026-12-02 above "Payments with a relative update" used the former form, now payment-cas: read the account, then POST /v1/txn with unchanged since <version>, the new balance and the insert, read again on 412) |
page: 50 customers after a random one |
keyset WHERE id > $1 ORDER BY id LIMIT 50 |
listing limit=50&after=<id> |
lookup: card number to customer |
join through the unique index on pan |
GET /v1/lookup/card_by_pan (unique synchronous index) |
range: an account's transactions of one week |
index range on (customer, account, posted) | listing from after the week's end, newest first, until older than its start |
counter: increments of 16 shared counters |
INSERT ... ON CONFLICT DO UPDATE SET n = n + 1 |
POST /v1/state/update with an inc operation |
remember: an episode with one fact |
an emulation: episode row (generated tsvector) and fact row in one transaction |
POST /v1/memory/remember |
recall: two words |
an emulation: full-text match ranked by ts_rank, 10 rows |
POST /v1/memory/recall, budget 500 tokens |
cdc: drain the change stream, one consumer |
logical decoding (test_decoding slot), rows of tables counted |
GET /v1/changes?path=Customer&from=start, 1000 per call |
remember and recall on PostgreSQL are what an application would build with it, not the
same function: RECALL also ranks by recency and facts, assembles a context within a token
budget and applies policies. They are there to show the cost, not to claim equivalence.
The SQL projection of OliviaDB (PostgreSQL wire) serves DL/I databases, not native
aggregates, so it is not part of this comparison.
Measures¶
- Throughput at fixed concurrency: a closed loop of 16 workers for 20 s (
run). - Highest sustainable rate: an open loop at a fixed rate (
run --rate, latency counted from each request's intended start, so falling behind is charged), from a quarter of the closed loop's throughput up by half each step (at most 8 steps of 20 s); reported per p99 target (10 ms, 50 ms) is the highest rate whose p99 held it with at least 95 % of the rate achieved and no errors (sweep). - Latency p50, p99, p99.9 (and the maximum); CPU (average of
docker statssamples, 100 % = one CPU), memory (the highest sample), bytes written (the container's block I/O during the run). - Client side, per operation: the client's CPU (
client_cpu_us_per_op, the bench process's own CPU time over the run), and what moved over its sockets (wire_per_op: bytes received and sent, TLS records included, and the socket reads and writes that moved data, counted by one wrapper under TLS on every connection of PostgreSQL, HTTP and native alike; native frames received as well). The wrapper only counts; each client does the work it did.
Results (2026-12-02)¶
Host: Apple M3 Max (14 cores), macOS, Docker 29.8.2 (its Linux VM: 14 CPUs, 7.7 GiB), each
container limited to 4 CPUs and 2 GiB. The host was not idle: its load average before the
runs was 20.7 / 25.8 / 36.1 (1, 5, 15 min) for the PostgreSQL-and-OliviaDB run and 6.5 / 9.2
/ 12.3 for the "before" run, from the owner's applications (a Docker VM with an emulator
using about one core, file indexing, a browser, device simulators); nothing else of ours
ran. Read single-digit differences as noise. OliviaDB is the build of commit 3d8d43e (image
oliviadb:bench), PostgreSQL 16.6. Data: 10 000 customers, 20 000 episodes, as above;
remember runs last because it adds episodes.
| workload | target | ops/s (16 clients) | p50 ms | p99 ms | p99.9 ms | CPU % | mem MiB | written MiB | max rate, p99 ≤ 10 ms | p99 ≤ 50 ms |
|---|---|---|---|---|---|---|---|---|---|---|
Read a customer with its accounts and the last 100 transactions of each (dossier) |
PostgreSQL | 6,869 | 1.97 | 6.18 | 8.77 | 219 | 607 | 0.0 | 3,864 | 5,796 |
Read a customer with its accounts and the last 100 transactions of each (dossier) |
OliviaDB | 1,224 | 9.95 | 40.53 | 50.44 | 367 | 606 | 0.0 | 459 | 1,033 |
Payment: insert a transaction and update the balance, in one transaction (payment) |
PostgreSQL | 6,326 | 2.46 | 4.24 | 11.14 | 141 | 635 | 562.7 | 3,558 | 5,338 |
Payment: insert a transaction and update the balance, in one transaction (payment) |
OliviaDB | 3,949 | 3.22 | 13.63 | 22.22 | 157 | 655 | 248.0 | 1,481 | 1,481 |
List customers, 50 per page (page) |
PostgreSQL | 23,475 | 0.64 | 1.68 | 4.13 | 185 | 675 | 0.0 | 19,807 | 19,807 |
List customers, 50 per page (page) |
OliviaDB | 1,652 | 5.75 | 55.01 | 60.74 | 369 | 707 | 0.0 | 2,090 | 2,090 |
Find a customer by card number (unique index) (lookup) |
PostgreSQL | 27,941 | 0.55 | 1.07 | 2.10 | 137 | 680 | 0.0 | 15,717 | 23,575 |
Find a customer by card number (unique index) (lookup) |
OliviaDB | 19,086 | 0.80 | 1.61 | 3.25 | 293 | 714 | 0.0 | 16,104 | 16,104 |
An account's transactions for one week (time range) (range) |
PostgreSQL | 26,492 | 0.58 | 1.26 | 2.54 | 155 | 692 | 19.1 | 14,902 | 14,902 |
An account's transactions for one week (time range) (range) |
OliviaDB | 3,211 | 3.00 | 44.51 | 52.49 | 373 | 714 | 0.0 | 2,709 | 2,709 |
Increment a shared counter under contention (16 counters) (counter) |
PostgreSQL | 16,514 | 0.87 | 2.47 | 4.67 | 156 | 678 | 782.0 | 13,934 | 13,934 |
Increment a shared counter under contention (16 counters) (counter) |
OliviaDB | 9,342 | 1.58 | 4.34 | 10.04 | 226 | 728 | 295.6 | – | – |
AI-agent memory: search the stored episodes for two words (recall) |
PostgreSQL | 2,252 | 3.10 | 63.77 | 69.89 | 361 | 683 | 9.5 | 1,900 | 1,900 |
AI-agent memory: search the stored episodes for two words (recall) |
OliviaDB | 472 | 13.95 | 87.30 | 92.87 | 360 | 828 | 0.0 | – | 399 |
AI-agent memory: store an episode with one fact (remember) |
PostgreSQL | 6,342 | 2.44 | 4.43 | 14.47 | 148 | 699 | 762.9 | 3,567 | 5,351 |
AI-agent memory: store an episode with one fact (remember) |
OliviaDB | 2,811 | 5.00 | 11.48 | 353.43 | 118 | 1,229 | 1,001.4 | – | – |
cdc PostgreSQL: 479,400 changes in 20.1 s = 23,875 changes/s (1 consumer, batches of 1000), CPU 88 %
cdc OliviaDB: 1,068,000 changes in 20.0 s = 53,366 changes/s (1 consumer, batches of 1000), CPU 64 %
CPU is the container's average (400 % = its 4 CPUs), memory the highest sample, "written" the container's block writes during the 20 s run. "–" in the rate columns: no open-loop rate held that p99 (see below).
What the numbers say¶
- PostgreSQL wins most of this suite, by a lot on reads: a page of customers (14x), a week of an account's transactions (8x) and the dossier (5.6x; OliviaDB makes 4 requests for it, PostgreSQL one statement). OliviaDB's reads are CPU-bound at the container's 4 CPUs (360-370 %): about half of a read is rendering the JSON answer (paths, key segments, timestamps), the rest the tree's seeks; these are the next things to make cheaper.
- Point lookup through a unique index: OliviaDB at 68 % of PostgreSQL's throughput, p99 1.6 ms against 1.1 ms; both hold 16 000 lookups per second with p99 under 10 ms.
- Writes: payments 62 % and counters 57 % of PostgreSQL's throughput, writing half as many bytes or less (248 MiB against 563, 296 against 782); REMEMBER 44 % of the emulation's throughput. A payment is two requests on OliviaDB (read the balance, then a conditional write): an update had no relative form yet (it has since: see "Payments with a relative update").
- Write stalls: OliviaDB's tail latency under writes is bad. In the open loop a counter
at 2 335/s had p99 817 ms, and REMEMBER's p99.9 in the closed loop is 353 ms, while the
median stays at 1.6 and 5 ms. The cause is in the engine: a commit that fills the memtable
flushes it and runs the compactions that follow in the committing thread, under the
tree's lock (
Db::commit_at,Db::maybe_compact), so every writer waits for them. Moving flushes and compactions to a background thread is the fix (done since, see "Write stalls" below). Until then whether a write rate holds p99 10 ms depends on whether a compaction falls into the 20 s (the counter held 2 331/s in the "before" run, not 2 335/s in this one). - RECALL against a full-text query on PostgreSQL (an emulation, see above): 21 % of its throughput. RECALL scores every vector of the tenant on each call (brute force, bound by memory bandwidth) besides its BM25 and the other channels; a vector index is the fix.
- Change stream: OliviaDB drained 53 400 changes per second with one consumer, 2.2x
PostgreSQL's logical decoding (23 900 per second through
test_decoding).
Before and after the profiling fixes¶
Profiling (perf in the container, sample on a native server) found four costs, fixed in
d2da45a (one mutex in front of every block read: now 16 shards, hits under a shared lock),
10e453c (one 512 MiB block cache for every tree instead of 64 MiB each), d57c344 (BM25
removal swept the whole vocabulary on every REMEMBER; id-keyed maps; an 8-lane dot product)
and bfa7aac (every API call built the whole tool catalogue's JSON to check one name).
| workload | target | ops/s (16 clients) | p50 ms | p99 ms | p99.9 ms | CPU % | mem MiB | written MiB | max rate, p99 ≤ 10 ms | p99 ≤ 50 ms |
|---|---|---|---|---|---|---|---|---|---|---|
Read a customer with its accounts and the last 100 transactions of each (dossier) |
OliviaDB at 398d332 | 1,190 | 10.00 | 47.99 | 54.98 | 372 | 505 | 0.0 | – | 1,004 |
Payment: insert a transaction and update the balance, in one transaction (payment) |
OliviaDB at 398d332 | 5,838 | 2.60 | 4.84 | 11.04 | 235 | 715 | 305.2 | 1,459 | 1,459 |
List customers, 50 per page (page) |
OliviaDB at 398d332 | 1,659 | 5.80 | 55.67 | 61.95 | 371 | 713 | 0.0 | 1,399 | 2,099 |
Find a customer by card number (unique index) (lookup) |
OliviaDB at 398d332 | 19,016 | 0.80 | 1.63 | 2.68 | 293 | 722 | 0.0 | 7,131 | 16,045 |
An account's transactions for one week (time range) (range) |
OliviaDB at 398d332 | 3,170 | 3.00 | 47.96 | 64.21 | 366 | 722 | 0.0 | 2,674 | 2,674 |
Increment a shared counter under contention (16 counters) (counter) |
OliviaDB at 398d332 | 9,324 | 1.56 | 4.35 | 10.06 | 217 | 829 | 429.2 | 2,331 | 3,496 |
AI-agent memory: search the stored episodes for two words (recall) |
OliviaDB at 398d332 | 479 | 13.81 | 88.75 | 93.57 | 362 | 880 | 0.0 | – | 404 |
AI-agent memory: store an episode with one fact (remember) |
OliviaDB at 398d332 | 3,133 | 4.44 | 11.67 | 312.34 | 133 | 1,246 | 1,230.2 | – | – |
cdc OliviaDB: 1,069,000 changes in 20.0 s = 53,409 changes/s (1 consumer, batches of 1000), CPU 63 %
On this suite the closed-loop numbers barely moved. Payments read 5 838/s before and 3 949/s
after in the full runs, but the "after" run had the busier host (load 20-25 against 6-12);
rerun side by side on the same data (ab.jsonl) they are equal within noise: 5 757 before,
5 533/s after (so payments are nearer 90 % of PostgreSQL's 6 326/s than the 62 % above). The page of customers gained 75 % once the store
had grown (1 116 against 1 934/s in ab.jsonl, after the full runs had added payments and
episodes). Lookup's open-loop rate at p99 10 ms went from 7 131 to 16 104/s, measured under
the two runs' different host loads. The REMEMBER
fix matters as the vocabulary grows (on a loaded development machine, with some 50 000
episodes, REMEMBER went from about 400 to 3 500 per second); the suite's 20 000 episodes are
not enough to show it.
Open items found by this benchmark¶
- ~~Flushes and compactions in the committing thread: write stalls of hundreds of milliseconds.~~ Background flushes and compactions (below, "Write stalls"). Left: a memtable switch still creates the next log (a file and a directory sync) and an install still syncs the manifest under the tree's lock, 10-20 ms each in the Docker VM.
- JSON rendering and per-node seeks make native reads CPU-bound. Path and time text are now written without the formatting machinery (below, "Native read rendering"); building the answer as a JSON value tree and opening each stored value remain.
- RECALL's vector channel is a brute-force scan. Exact still, but about 15 times faster (below, "Vector search"); an approximate index for millions of vectors is open.
- ~~No relative update (
balance = balance - x) in native transactions: a payment is a read and a conditional write.~~"add"in an update (below, "Payments with a relative update"). - The SQL projection does not serve native aggregates.
- The open loop at a quarter of the closed loop's throughput sometimes falls behind by seconds (median latency in seconds at low CPU), for counters most often, with the engine of either build (below). Not explained yet; a commit waiting at the engine's limits is ruled out for the runs traced.
Write stalls: flushes and compactions in the background (2026-12-02)¶
The engine (Options::background, on by default; open/crates/oliviadb-core/src/db.rs)
now turns a full memtable into an immutable one that readers still see while a background
thread writes it as a table; compactions run on a second thread. The committing thread
only switches to a new memtable and log. Finished work is installed in the manifest by the
next commit. A writer waits only at two documented limits: two memtables waiting for their
flush (max_immutable_memtables), or twelve tables on level 0 (l0_stop_trigger).
Crashes during a background flush, after its table is written but before it is installed,
and during a compaction are tested (open/crates/oliviadb-core/tests/background.rs).
The engine alone (cargo bench -p oliviadb-core --bench commit_latency): one tree,
1 000 000 payment-like commits (two keys, about 200 bytes) without a per-commit sync, on the
host's file system (APFS; the host's load average 21 to 34). Two runs each:
| mode | commits/s | p50 ms | p99.9 ms | p99.99 ms | max ms | commits over 10 ms | over 100 ms |
|---|---|---|---|---|---|---|---|
| in the committing thread (before) | 168 307 / 165 333 | 0.003 | 0.013 / 0.015 | 0.042 / 0.044 | 408.5 / 410.1 | 30 / 30 | 6 / 7 |
| background (after) | 232 139 / 231 403 | 0.003 | 0.017 / 0.019 | 4.653 / 4.414 | 17.2 / 19.0 | 6 / 3 | 0 / 0 |
Every flush (30) cost a commit over 10 ms before; after, what is left over 10 ms are the syncs a memtable switch and an install still make under the lock (open item 1). The p99.99 rose from 0.04 to 4-5 ms: those same syncs, and the background threads competing with the writer for the CPU.
In the containers (bench/run.sh with WORKLOADS="payment-cas counter remember"
TARGETS=olivia, the image before, 3d8d43e, and after, d20cc03, run alternately twice; raw
records bench/published/2026-12-02/stalls-{1,2}-{before,after}.*). The host was busy and
its load changed between runs (load average before each run in the table):
| workload | round | build | host load (1, 5, 15 min) | ops/s (16 clients) | p50 ms | p99 ms | p99.9 ms | max ms | max rate, p99 ≤ 10 ms | p99 ≤ 50 ms |
|---|---|---|---|---|---|---|---|---|---|---|
Payment, read-then-conditional-write form (payment-cas) |
1 | before | 31.8 19.9 23.6 | 5,191 | 2.72 | 10.34 | 38.47 | 458 | 1,298 | 1,298 |
Payment, read-then-conditional-write form (payment-cas) |
1 | after | 9.3 15.0 23.7 | 5,959 | 2.58 | 5.56 | 14.01 | 53 | – | – |
Payment, read-then-conditional-write form (payment-cas) |
2 | before | 11.7 19.3 22.2 | 5,803 | 2.63 | 4.49 | 13.06 | 426 | – | 1,451 |
Payment, read-then-conditional-write form (payment-cas) |
2 | after | 28.1 22.9 23.9 | 5,699 | 2.71 | 4.97 | 15.07 | 54 | 1,425 | 1,425 |
Increment a shared counter under contention (16 counters) (counter) |
1 | before | 31.8 19.9 23.6 | 8,105 | 1.75 | 6.95 | 14.97 | 332 | – | – |
Increment a shared counter under contention (16 counters) (counter) |
1 | after | 9.3 15.0 23.7 | 10,317 | 1.50 | 3.40 | 10.02 | 45 | 2,579 | 2,579 |
Increment a shared counter under contention (16 counters) (counter) |
2 | before | 11.7 19.3 22.2 | 7,882 | 1.71 | 8.18 | 21.88 | 339 | – | – |
Increment a shared counter under contention (16 counters) (counter) |
2 | after | 28.1 22.9 23.9 | 5,664 | 1.74 | 26.07 | 49.37 | 94 | – | – |
AI-agent memory: store an episode with one fact (remember) |
1 | before | 31.8 19.9 23.6 | 776 | 15.30 | 65.32 | 434.33 | 441 | – | – |
AI-agent memory: store an episode with one fact (remember) |
1 | after | 9.3 15.0 23.7 | 3,255 | 2.75 | 36.30 | 61.84 | 186 | – | – |
AI-agent memory: store an episode with one fact (remember) |
2 | before | 11.7 19.3 22.2 | 3,104 | 4.64 | 9.62 | 290.30 | 417 | – | – |
AI-agent memory: store an episode with one fact (remember) |
2 | after | 28.1 22.9 23.9 | 5,800 | 2.36 | 10.81 | 50.74 | 161 | – | 1,450 |
What holds across both rounds: the longest wait of the closed loop fell from 330-460 ms to 45-190 ms, and REMEMBER's p99.9 from 290-434 ms to 51-62 ms. Throughput and p99 moved with the host's load more than with the build (the counter's worst p99, 26 ms, is the "after" run at the higher load). The open-loop rates are not a reliable comparison on this host: several steps fell behind by seconds with either build (open item 6), and which steps did changed from run to run. With a tracing build (not published) no commit waited 20 ms or more at the engine's limits during these workloads.
Payments with a relative update (2026-12-02)¶
An update takes "add" now (docs/network-api.md): {"op": "update", "path": ..., "add":
{"balance": "-1.25"}} adds to the current value inside the transaction, as PostgreSQL's
balance = balance - x. The workload payment is one request (the update and the new
transaction's insert); payment-cas is the former two-request form (read, then a write
conditional on the version read). One run of bench/run.sh with WORKLOADS="payment
payment-cas counter remember", build 5255025, the host's load average 13.6 / 30.7 / 30.2
before it; raw records bench/published/2026-12-02/relative.* (on PostgreSQL the two
payment workloads are the same transaction):
| workload | target | ops/s (16 clients) | p50 ms | p99 ms | p99.9 ms | CPU % | mem MiB | written MiB | max rate, p99 ≤ 10 ms | p99 ≤ 50 ms |
|---|---|---|---|---|---|---|---|---|---|---|
Payment: insert a transaction and update the balance, in one transaction (payment) |
PostgreSQL | 6,162 | 2.51 | 4.84 | 9.65 | 146 | 599 | 562.7 | – | – |
Payment: insert a transaction and update the balance, in one transaction (payment) |
OliviaDB | 6,854 | 2.12 | 5.10 | 11.33 | 202 | 934 | 305.2 | – | – |
Payment, read-then-conditional-write form (payment-cas) |
PostgreSQL | 5,494 | 2.57 | 9.07 | 13.96 | 131 | 622 | 429.2 | 4,636 | 4,636 |
Payment, read-then-conditional-write form (payment-cas) |
OliviaDB | 6,167 | 2.53 | 4.40 | 12.80 | 236 | 948 | 267.0 | – | 1,542 |
Increment a shared counter under contention (16 counters) (counter) |
PostgreSQL | 15,920 | 0.90 | 2.57 | 5.39 | 155 | 643 | 734.3 | 3,980 | 3,980 |
Increment a shared counter under contention (16 counters) (counter) |
OliviaDB | 10,254 | 1.48 | 3.75 | 14.68 | 167 | 1,068 | 495.9 | – | – |
AI-agent memory: store an episode with one fact (remember) |
PostgreSQL | 5,097 | 2.88 | 7.02 | 23.53 | 170 | 666 | 581.7 | 1,911 | 1,911 |
AI-agent memory: store an episode with one fact (remember) |
OliviaDB | 864 | 15.54 | 59.48 | 81.43 | 36 | 1,276 | 228.9 | – | – |
- Payments: in one request OliviaDB posted 6 854 payments per second against PostgreSQL's 6 162 in the same run (111 %), with p99 5.1 against 4.8 ms, writing about half the bytes (305 against 563 MiB). The two-request form did 6 167 per second.
- The open-loop columns show this host's noise on both sides: PostgreSQL's
paymentfailed p99 50 ms at its first step (1 541/s, p99 300 ms) while the same transaction aspayment-casheld 4 636/s; OliviaDB'spaymentfailed at 1 713/s (p99 142 ms). - REMEMBER varies between runs far more than the others (776 to 5 800 per second over the runs of this page, CPU 36 % in this one: it waited, not computed). Not explained yet (open item 6 may be the same cause).
Vector search: contiguous vectors, an 8-bit scan, exact results (2026-12-02)¶
RECALL's vector channel (and agent state's vector search) scored every vector of the
tenant in floats, the vectors being separate allocations in a hash map. Now
(open/crates/oliviadb-memory/src/text.rs, VecIndex) the vectors lie back to back, with an
8-bit copy and a scale per vector. A search quantizes the query too, scans the 8-bit copies
with integer dot products, then scores in floats, in the order of the approximate scores,
until no remaining vector can reach the k-th exact score. The bound
|q·x − q̃·x̃| ≤ |q|·s·√d/2 + t·√d/2·|x̃| (s, t the scales of vector and query) makes the
result the exact one: the same ids, scores and order as scoring every vector, which a unit
test checks with filters, ties, removals, replacements, near-duplicates closer than the
quantization error and vectors of another length, and the benchmark checks for every query.
cargo bench -p oliviadb-memory --bench vector_search (90 000 random unit vectors of 384
dimensions, top 100, 50 queries; the host loaded by other builds):
| layout | per query |
|---|---|
| map of vectors, floats (before) | 21.5 ms |
| contiguous, floats (exact scan) | 3.0 ms |
| contiguous, 8-bit scan and exact rescoring (now) | 1.4 ms |
The earlier container measurement (RECALL about 60 per second at about 90 000 episodes and claims, 16 clients) was bound by that scan; the container runs below ("In the containers: vector search and native reads") measure this build. What is left open: the scan is still linear in the number of vectors; for millions an approximate index (with its recall measured against this exact search) is the next step.
Native read rendering (2026-12-02)¶
cargo bench -p oliviadb-server --bench native_read reads in process, without HTTP or
TLS (native::handle), and serializes each answer as the server sends it: a page of 100
customers, and one customer's subtree of 111 nodes (10 accounts of 10 transactions, whose
keys hold a timestamp). A profile of the subtree read (macOS sample) showed about 40 % of
the time in allocation and copying; per node, the path text (with each key's timestamp
written by format!) was the largest single part of rendering, then opening the stored
value (decryption, decoding by layout), then the JSON value tree and its serialization.
Path text is now written into one string (push_seg, pct_encode_into), and dates and
timestamps digit by digit (codec::push_date, timestamp_text), each tested to give
exactly the earlier text (every byte value for the percent-encoding; years before 0 and
after 9999, the ends of a day for the times). Before and after, interleaved, three runs
each (2 000 customers; the host loaded by other builds):
| read | before | after |
|---|---|---|
| page of 100 records | 292 / 257 / 259 µs | 251 / 267 / 243 µs |
| subtree of 111 nodes | 422 / 376 / 381 µs | 310 / 355 / 309 µs |
About a sixth off a subtree read, little off a page. What is left is structural: the
answer is built as a serde_json::Value tree (a map per node, keys as owned strings) and
then serialized; writing the JSON directly from the decoded fields, and opening only the
values a profile shows, are the next steps. The container runs below show no gain from it
at the client.
In the containers: vector search and native reads (2026-12-02)¶
bench/run.sh with TARGETS=olivia WORKLOADS="recall dossier page", the image before
(build 5255025, the last one without the two changes above) and after (build 1128eb1,
with both), run alternately twice in a window when nothing else of ours ran; the host
still carried the owner's applications and an emulator using about one core. Each run
started from empty volumes with the usual data (10 000 customers, 20 000 episodes). Raw
records: bench/published/2026-12-02/window-{1,2}-{before,after}.* (their checkout line
names the harness's checkout, not the image's build). Host load average before each run in
the table:
| workload | round | build | host load (1, 5, 15 min) | ops/s (16 clients) | p50 ms | p99 ms | p99.9 ms | CPU % | max rate, p99 ≤ 10 ms | p99 ≤ 50 ms |
|---|---|---|---|---|---|---|---|---|---|---|
AI-agent memory: search the stored episodes for two words (recall) |
1 | before | 10.46 24.89 33.09 | 662 | 10.07 | 83.31 | 88.58 | 366 | – | 558 |
AI-agent memory: search the stored episodes for two words (recall) |
1 | after | 11.47 14.30 23.90 | 2,870 | 2.72 | 55.76 | 65.10 | 367 | 2,422 | 2,422 |
AI-agent memory: search the stored episodes for two words (recall) |
2 | before | 10.41 12.14 18.79 | 656 | 10.17 | 82.17 | 96.81 | 365 | – | 553 |
AI-agent memory: search the stored episodes for two words (recall) |
2 | after | 14.38 18.37 19.84 | 2,851 | 2.74 | 57.59 | 64.95 | 359 | 1,604 | 2,405 |
Read a customer with its accounts and the last 100 transactions of each (dossier) |
1 | before | 10.46 24.89 33.09 | 1,279 | 8.68 | 47.78 | 56.13 | 365 | – | 1,079 |
Read a customer with its accounts and the last 100 transactions of each (dossier) |
1 | after | 11.47 14.30 23.90 | 1,295 | 8.69 | 46.32 | 54.03 | 363 | – | 1,092 |
Read a customer with its accounts and the last 100 transactions of each (dossier) |
2 | before | 10.41 12.14 18.79 | 1,288 | 9.03 | 44.58 | 50.24 | 362 | – | 1,086 |
Read a customer with its accounts and the last 100 transactions of each (dossier) |
2 | after | 14.38 18.37 19.84 | 1,346 | 8.64 | 43.59 | 49.56 | 363 | – | 757 |
List customers, 50 per page (page) |
1 | before | 10.46 24.89 33.09 | 5,231 | 1.83 | 39.38 | 48.30 | 365 | 4,414 | 4,414 |
List customers, 50 per page (page) |
1 | after | 11.47 14.30 23.90 | 5,041 | 1.86 | 39.89 | 47.56 | 365 | 4,254 | 4,254 |
List customers, 50 per page (page) |
2 | before | 10.41 12.14 18.79 | 5,254 | 1.84 | 37.55 | 48.33 | 362 | 2,956 | 2,956 |
List customers, 50 per page (page) |
2 | after | 14.38 18.37 19.84 | 5,404 | 1.83 | 36.03 | 44.49 | 364 | 4,560 | 4,560 |
- RECALL: 656-662 per second before, 2 851-2 870 after, in both rounds (about 4.3 times), p50 from 10.1 to 2.7 ms, p99 from 82-83 to 56-58 ms. The container is at its 4 CPUs in both builds, so the 8-bit scan freed CPU that now goes to more requests. Before, no open-loop rate held p99 10 ms; after, 1 604 and 2 422 per second did.
- Native reads (
dossier: one customer's subtree;page: a page of customers): no change beyond the noise between rounds (dossier 1 279-1 346, page 5 041-5 404 per second, both builds at 4 CPUs). The sixth taken off a subtree's rendering in process (above) is not where the time goes behind HTTP and TLS with 16 clients. Profiling the server in the container under this load is the next step; until then the JSON tree and value decoding work above is not justified by these numbers. - The open-loop columns again moved with the run more than with the build (dossier's
p99 ≤ 50 msrate 757 in one "after" run, 1 079-1 092 in the others; page's 2 956 in one "before" run).