Hosting

Scaling

Sharding across a fleet with no router and no coordinator.

llms.txt

MenteDB shards itself across a fleet and coordinates it on its own: no router to run, no hash ring to maintain, no external coordination service. Each user's memory is an embedded database with exactly one writer, guarded by an exclusive OS-level lock, and that lock is what the engine passes between nodes to move ownership safely. Three pieces make it work.

Membership (gossip)

Each node gossips with a few peers to converge on the live set, with no external store and no coordinator process. A node that stops heartbeating drops out; a new one is picked up from a seed address or a headless service DNS name. The Cassandra/Dynamo model, not a consensus leader.

Placement (rendezvous)

Every node maps a user to its owner by rendezvous (highest-random-weight) hashing, computed identically everywhere, so a request reaches the same owner from any node. Adding or removing a node re-homes only about 1/N of users, not the full reshuffle a hash % N ring forces.

Handoff (the lock)

Ownership isthe single-writer lock. When a user re-homes, the old owner releases the lock and the new owner takes it, so a user's database is only ever written by one node, and handoff moves the lock rather than copying data.

A request that lands on a node that does not own the user is forwarded to the one that does, so any node can front the fleet. Zero-copy handoff assumes the fleet shares storage (each user's database on a shared volume); on purely local disks placement still routes correctly, but a rebalanced user's data does not follow it automatically yet.

Turn it on

Sharding is off by default: a single node behaves exactly as before. Enable it per node with environment variables and run the normal server, no extra process or config file. Point each node at a seed or two (a static list, or a headless service DNS name resolved to one) and the fleet self-organizes from there. Routing keys on the JWT agent id, so run with --jwt-secret.

Terminal
MENTEDB_SHARDING=1 \
MENTEDB_NODE_ID=node-1 \
MENTEDB_NODE_ADDR=http://node-1:6677 \
MENTEDB_SEEDS=http://node-0:6677,http://node-2:6677 \
mentedb-server --jwt-secret "$SECRET"

How far it scales

On one node, reads and idle connections are effectively free; the ceiling is fsync-bound writes (order tens per second aggregate). Because every user is owned by exactly one node and a user's writes never cross nodes, aggregate write throughput grows roughly linearly with the fleet: N nodes give about N times the single-node write ceiling, with no shared bottleneck to contend on. Growing or shrinking the fleet is cheap because rendezvous placement moves only about 1/N of users, and each move is a lock handoff rather than a data copy.