Keys and nothing else. No values, no scans, no queries, no leader — one constraint, and everything downstream of it gets simpler.
Every job this store is good at is the same job: a flood arrives, and only the ones you have not seen before should get through. That is a dam built out of keys.
{key, value, version…}
Two writes disagree about the value, so something has to choose: vector clocks and siblings, a merge function, or a silent loss.
{key, lamport, node, alive?, wall, expires_at}
Nothing to disagree about but existence, so the merge is a comparison of two numbers. There is no room for a value, and that is the feature.
The replica set for a key does not move when a node goes down — it keeps its share of the keyspace, and the writes it misses are kept for it. Click a node.
A simulation of the behaviour the cluster tests assert, not a live cluster. Counters are illustrative.
{lamport, node}. A total order.503, never a false. This is exactly where cache-based deduplication lies to you.:ets.lookup in the caller's own process — no mailbox, no copy.ls, cat, stat instead of admin endpoints.Kurwa.add("order:1029") #=> :ok Kurwa.member?("order:1029") #=> true Kurwa.delete("order:1029") #=> :ok Kurwa.count() #=> {:ok, %{approximate: 1, ...}} Kurwa.add("seen:event:88", ttl: :timer.minutes(10))
Plus named sets and algebra over them, resolved at read time and copying
nothing: member_any?(["blacklist", "greylist"], key). The sets
themselves can be listed, because a set name is just a key in a reserved
set — so it replicates and repairs itself like everything else.
A release that is slower than the one before it is a broken release. The regression is the bug, not the new baseline.
Which is only worth saying if it can be checked, so every figure here comes
from a script in bench/, every version gets a column in
PERFORMANCE.md,
and when two versions are compared they are measured on the same day, in turns,
so the machine's mood lands on both. 0.17.0 was held back twice by that rule:
counters for the dashboard cost 7% on reads and 20% on PostgreSQL until they
did not.
GET /k/:key, one nodePOST /batchReads a second across three nodes with a quorum of two, 64 concurrent clients,
each version measured with bench/cluster.exs:
And one key, in-process, on one node - Kurwa.member?, lower is better:
A quorum read needs r answers. Until 0.18.0 the coordinator asked all n replicas and kept the first r; but any r replicas overlap every write's w, because r + w > n, so the extra answers were only traffic. Now it asks r - itself first when it holds a copy, since it answers inline - and the rest only if those are slower than 10 ms. Same answer, a third of the messages:
Measured both ways the same day with KURWA_READ_FANOUT=all against the
default: reads under load 63 900 → 98 600 a second (+54%), one read alone
39.7 → 36.7 µs, writes unchanged - they still go to all n, as they must.
kurwadb's own JavaScript and Go clients compute the ring and send each key to one
of its replicas, which on five nodes takes reads from 44 500 to 55 400 a second.
One node, 64 clients, the protocol's own benchmark tool driving it. They land close together because none of them is what a request costs - the path behind the wire is the same for all of them:
| Protocol | Driven by | Membership checks / sec |
|---|---|---|
| HTTP | ab ×4, keep-alive | 136 500 |
| PostgreSQL, prepared | pgbench | 135 700 – 146 700 |
| MySQL | mysqlslap | 128 400 – 133 200 |
| Redis (RESP) | redis-benchmark | 110 700 – 129 000 |
| MongoDB | Node.js driver | 75 500 – 79 500 |
| SQL Server, over TLS | tedious | 45 700 – 55 400 |
MongoDB and SQL Server read lower for their clients' sake, not the server's: a
Node.js driver is one thread per process, and tedious does TLS in JavaScript.
On the server, one findOne is 5.7 µs and one sp_executesql
lookup about the same.
Not our numbers against someone's published ones - Redis 8.0.3 built here, both
servers run one at a time, and since kurwadb speaks RESP the same
redis-benchmark drives both: four threads, 64 connections, runs on 6 and
9 October 2026. bench/versus.sh reproduces it.
| 1M keys, 13 bytes each | RAM per key | SISMEMBER/sec | pipelined ×16 |
|---|---|---|---|
| Redis 8.0.3 | 30.2 B | 129–160k | 1.31–1.83M |
| kurwadb in-memory, RESP | 128.1 B | 111–129k | 0.61–0.91M |
| kurwadb in-memory, HTTP + JSON | 128.1 B | 124–137k | — |
| kurwadb on-disk, hit from disk | 3.0 B | 93k | — |
| kurwadb on-disk, miss | 3.0 B | 119k | — |
| kurwadb, 3-node quorum (0.18.0) | — | 99k | — |
Redis is 4× more memory-efficient than the in-memory engine - part of that is the Lamport stamp, origin, tombstone flag and expiry we store and it does not, the rest is BEAM overhead. The on-disk engine is 10× better than Redis, because what it keeps in RAM is a Bloom filter rather than the keys. On throughput Redis is the faster single server: 10–20% one request at a time, 1.5–2× pipelined, with the same client and protocol on both sides, so it is the cost of a request inside kurwadb, not the wire. A three-node kurwadb, every read confirmed by two machines, now answers at three quarters of single-node Redis.
So the case for it is not speed on one node. It is a set that outgrows RAM and is still answered exactly, writes acknowledged by two machines instead of one, and no primary to fail over from - the long version.
Apple M4, 10 cores; all three nodes share that one CPU, n=3 r=2 w=2.
128 bytes for a 13-byte key, 152 for a 36-byte one — jaki gruby, and
measured rather than guessed.
stat is the membership check, create is the add,
remove is the delete. Not a metaphor — the same data model.
9p -a localhost:564 ls / ctl stats ring keys b64 sets 9p -a localhost:564 read ring member [email protected] up member [email protected] up member [email protected] down echo compact | 9p -a localhost:564 write ctl
No SDK, no vendor CLI. The key directories deliberately refuse to be listed: there are no scans here, and an empty listing would be a lie.
kurwadb speaks the PostgreSQL wire protocol. A set is a table with one column,
key, and the queries are the ones a set can answer without a scan.
INSERT INTO seen VALUES ('order:1'), ('order:2'); INSERT 0 2 SELECT key FROM seen WHERE key IN ('order:1', 'order:3'); key --------- order:1 (1 row) DELETE FROM seen WHERE key = 'order:1'; DELETE 1 SELECT * FROM seen; ERROR: SELECT from seen without WHERE key = ... would be a scan, and there are none
Prepared statements and binary results, so psycopg and node-postgres work as they
are; \dt lists sets and \d describes one. There are no
transactions — BEGIN is accepted because drivers send it unasked,
and ROLLBACK says nothing was rolled back. Around 140,000 prepared
statements a second under pgbench, on one node.
CREATE SCHEMA analytics, and analytics.events is the set
named analytics.events. The catalogs are modelled well enough for a GUI:
DBeaver's navigator lists schemas, tables and the key column, and its
table designer is told at CREATE TABLE that the one column is called
key, rather than finding out on the first insert.
The same tables answer over the MySQL protocol, to mysql,
mariadb and the MySQL connectors — INSERT IGNORE,
prepared statements, SHOW TABLES, columns named the way MySQL names
them — around 130,000 queries a second.
And SQL Server: sqlcmd, ODBC and tedious connect over TLS, as they do by
default, T-SQL's IF NOT EXISTS (…) INSERT is an insert with one
winner, and stored procedures run from .sql files deployed with the
node. SQL Server Management Studio connects too, and its Object Explorer shows
kurwadb beside the system databases with every set as a table. SSMS
does not ask a server what it is in a few queries: it runs dozens of generated
batches across sys.* views and reads every column by type. So its answers
were recorded once against a real SQL Server, with their exact types, and kurwadb
replays them with its own databases, schemas and sets in the rows - all 60 of a
recorded session match.
And MongoDB: a collection is a set, a document is {_id: key}, a second
insert of an _id is E11000 with one winner, and every node
answers as a mongos, so a driver given several nodes fails over between
them on its own.
It speaks RESP too. Redis sets are named sets, Redis keys are the default set, and the idempotency check works as it does against Redis:
SET order:1 x EX 3600 NX OK SET order:1 x EX 3600 NX (nil) SADD seen:orders a b (integer) 2 GET order:1 ERR kurwadb stores keys without values
There are no values, so GET refuses rather than invent one.
SET NX has one winner among concurrent callers, as on Redis — not
from a single thread but from a majority of replicas, and WATCH
aborts an EXEC when a watched key changed.
Every node serves a dashboard at /dashboard: each node's frontends,
coordinator, replica layer and shards, with requests drawn travelling between
them - from a client into a frontend, down to a shard, across to the other
replicas - and every open connection named by the application it said it was.
The counters behind it are one atomic add per layer per request, and the release
that added them was held until it was no slower than the one before.
The demo runs on simulated data in your browser: three nodes, a dozen clients, and a node that fails every couple of minutes so you can watch its clients move.
Any PostgreSQL, Redis or MongoDB driver works, but a generic driver talks to one address. kurwadb's own clients - JavaScript, no dependencies, and Go, standard library only - learn every node from one, rebuild the ring bit for bit, send each key to one of its replicas, and move off a node that fails.
const db = await connect({ nodes: ["10.0.0.1:6379"], password }) await db.addNew("payment:7f3a") // true for exactly one caller, cluster-wide await db.has("payment:7f3a") // true, from a node that holds a copy
git clone https://github.com/holooloo/kurwadb cd kurwadb && mix deps.get scripts/cluster.sh # 4040, 4041, 4042 curl -X PUT localhost:4040/k/order:1029 curl -i localhost:4041/k/order:1029 # 200 — read from a different node