Storine v0.3.0

Storine 0.3.0 · MIT or Apache-2.0

The document database that is fast, exact and small.

Embed it in a Rust program, run it as a server, or start three servers for a replicated cluster with automatic failover. Written in Rust, with no third-party dependencies.

curl -fsSL https://github.com/Twilight-Techy/storine/releases/latest/download/install.sh | sh
import storine
from decimal import Decimal
from storine import add, gt

db = storine.connect("storine://127.0.0.1:7878")
accounts = db.collection("accounts")
accounts.insert("alice", {"balance": Decimal("100.00")})
accounts.insert("bob", {"balance": Decimal("0.00")})

# Both changes or neither, and never below zero.
with db.transaction() as tx:
    tx.update("accounts", "alice",
              add("balance", Decimal("-10.00"), min=0))
    tx.update("accounts", "bob",
              add("balance", Decimal("10.00")))

accounts.create_index("balance")
rich = accounts.find(gt("balance", Decimal("50")))

Everything a document database needs, in a few megabytes

Each tool is a single file with nothing else to install. The engine, the network server, TLS, the SQL gateway and the web console are all built from the Rust standard library.

Fast where it counts

A read takes about 60 nanoseconds in process and 9 microseconds over the network. Against LMDB and RocksDB at equal durability, Storine leads every throughput row.

Every measurement, with the method and the machine →

Random reads, 4 threads (million per second)

Storine4.1–4.2 M
LMDB2.9–3.2 M
RocksDB0.96–1.04 M

Overwrites, 4 threads (million per second)

Storine1.30–1.36 M
RocksDB0.54–0.59 M
LMDB0.13 M

Durable writes with fsync, 4 threads (per second)

Storine3,000
RocksDB860
LMDB470
1,000,000 keys on an AWS c7i.xlarge, three rounds each. Storine trails in some tail-latency cases, listed in the report.

One engine, three ways to run it

The same storage engine and the same data model, from a library call to a cluster that spreads data across regions.

Embedded

Link storage-core into a Rust program and open a store in a folder. No server, no network.

let store = DocumentStore::open("./data",
    EngineConfig::default())?;
store.put("accounts", "alice", fields)?;
Embedding the engine →

Server

One process serves clients in eight languages, the SQL gateway and the web console.

storage-server ./data 127.0.0.1:7878
storine-console storine://127.0.0.1:7878
Running a server →

Cluster

Three servers replicate with Raft and fail over on their own. Add --ranges to partition data and place it by region.

storage-server ./n1 10.0.0.1:7878 --node-id 1 \
  --peers 1=10.0.0.1:7878,2=10.0.0.2:7878,3=10.0.0.3:7878
Clusters →

Speaks your stack

Clients for eight languages share one API, need only their standard library, retry without ever applying a write twice, and follow a cluster's leader on their own. Apps written for PostgreSQL, MySQL or SQL Server can switch by changing a connection string.

The Storine console: a collection of documents with a filter, and one document open for editing

Try it in a minute

Install the four tools, start a server, and open the console. The quick start walks through it in your language.