Start with a file. Add machines when you need them.
A shard is a ChloeDB file, a server serves one, and a cluster is servers behind a coordinator. Each step adds a process, never a new query language or a migration.
Five steps, and the app changes one line
Pick a step to see what you run, and what changes in the app.
import chloedb
db = chloedb.open("shop.chloedb")
db.query("SELECT id, title FROM products WHERE MATCH(title, :q) LIMIT 10",
q="racing wheel")chloedb-server --db shop.chloedb --listen 127.0.0.1:7700
db = chloedb.connect("http://127.0.0.1:7700") # was chloedb.open(...)
db.query("SELECT id, title FROM products WHERE MATCH(title, :q) LIMIT 10",
q="racing wheel")chloedb-server --db shop.chloedb --seq-no \ --replicas http://b:7701,http://c:7701 --failover-after-ms 3000
db = chloedb.connect("http://a:7700") # the primary
db.insert({"id": "r9", "usr": "u7", "item": "B0C1", "stars": 5}, table="reviews")chloedb-server --shards http://s0:7701,http://s1:7701 \ --listen 127.0.0.1:7700 --grpc off
db = chloedb.connect("http://127.0.0.1:7700") # the coordinator
db.query("SELECT id, title FROM products WHERE MATCH(title, :q) LIMIT 10",
q="racing wheel") # asks every shard
db.get("B0C1", table="products") # asks only the key's shardkubectl apply -f operator.yaml -f cluster.yaml
kubectl -n strata patch strata demo --type merge \
-p '{"spec": {"shards": 3}}' # slots move while it servesdb = chloedb.connect("http://demo.strata:7700") # the cluster's ServiceA search, a write, a failover and a new shard
Press a button, or let it play. Searches ask every shard and merge; a write goes to the one shard its key hashes to; a stopped primary is replaced by a vote; a new shard takes slots while the cluster serves.
An animation of what the coordinator and the copies do, slowed down to be seen; it is not connected to a cluster. The flags it names are chloedb-server's own.
What stays the same at every step
Over shards, the coordinator's merge gives what one database gives, scores and limits included. Graph queries and INSERT … ON CONFLICT still need one database.
Tables, models, rank profiles and synonyms travel with the data.
A shard is a ChloeDB file. A checkpoint of one opens on a laptop.
chloedb.open and chloedb.connect have the same methods.
The same console for one server and for a cluster.
A deterministic simulator replays failovers and slot moves from a seed.
The cluster on your laptop is the one in production
On kind it has the same pods, operator and resource as on EKS or DigitalOcean. Only the image, the storage and the sizes change.
git clone https://github.com/chloetech-ai/chloedb && cd chloedb deploy=chloedb-server/deploy $deploy/kind-test.sh up # a kind cluster in Docker $deploy/kind-test.sh image # build the server image, load it $deploy/kind-test.sh operator # operator + 2 shards, until Ready kubectl -n strata port-forward svc/demo 7700 # API and UI $deploy/kind-test.sh scale 3 3 # a third shard; slots move live
kind: StrataCluster spec: - image: chloedb-server:dev + image: ghcr.io/chloetech-ai/chloedb-server:latest shards: 2 replicas: 3 storage: - size: 1Gi + size: 200Gi + storageClassName: gp3 # do-block-storage on DigitalOcean resources: - requests: {cpu: 500m, memory: 1Gi} + requests: {cpu: "4", memory: 16Gi}
Move a file to a cluster
Export the file's tables and import them through the coordinator, which places every row on its shard. Then point the app at the coordinator.
chloedb-server export --db shop.chloedb shop.sqlite curl -s -X POST 'localhost:7700/v1/import?format=sqlite' \ -H 'content-type: application/vnd.sqlite3' --data-binary @shop.sqlite
Measured at both ends
The same engine inside an app and as a cluster, each against what people use there today.
Faster than SQLite, DuckDB or LanceDB with every system on one thread (four BEIR collections); 4.8× to 33× with ChloeDB on up to eight threads.
In your app · reads beside a stream8,781 reads/sWhile 10,000 rows a second stream in: 9 to 16 times DuckDB's and SQLite's.