Raft consensus,
embedded in your app.

Fault-tolerant replication as a library. No separate cluster to run.

Think SQLite, but for keeping several servers in agreement. Consensus and replication only. Not a database.

cargo add d-engineView on GitHub

Not on Rust? Run it as a standalone service over gRPC.

One process instead of another cluster

Typical: external coordination service

Your app→ network →etcd / ZooKeeper cluster

Deploy it. Operate it. Monitor it. Upgrade it.

d-engine: embedded

Your app+ d-engine

One process. One binary. Calls are in-process.

When d-engine says “success”, the write survives.

Even if power is cut on the very nodes that hold it. Follow one write through a 3-node cluster.

One write, before and after “success”Your app writes “transfer $100”. The leader and one follower save it to disk. Only then does d-engine reply success. Power is then cut on both nodes that hold the write. They reboot from disk, the write is still there at the same log position, and the third node catches up. A crash before success leaves the outcome unknown.Crash here → outcome unknownCrash here → the write survivesYour appNode 1leaderNode 2Node 3transfer $1001App sendsa write#42 $100#42 $100not yet2Leader + Node 2save it to disk✓ success32 of 3 on disk.Only now: success⚡ power cut4Power cut on bothnodes that have it#42 $100#42 $100#42 $100✓ $100 still at #42, on all 3 nodes5Reboot from disk.Node 3 catches up.One write, before and after “success”Your appNode 1leaderNode 2Node 3Crash here → outcome unknownCrash here → the write surviveswrite $1001#42 $100#42 $100not yet2✓ success3⚡ power cut4#42 $100#42 $100#42 $100✓ $100 still at #42, on all 3 nodes5
  1. Your app sends a write.
  2. The leader and Node 2 save it to disk.
  3. 2 of 3 on disk. Only now: success.
  4. Power is cut on both nodes that have it.
  5. They reboot from disk. Node 3 catches up.

Not promised. A write that timed out or errored may or may not have happened: check before you retry. Losing the disks of 2 of 3 nodes at once can lose the write.

Check it yourself. Jepsen: 5 workloads and a 6-hour soak under kill, partition and pause. For power loss it cuts power to the leader and one follower every 5 seconds, dropping unflushed data: 3 of 3 runs pass. Read the guarantees

Kill one node. The other two keep serving.

A 3-node cluster loses one node. The other two keep accepting reads and writes.

A 3-node d-engine cluster keeps serving after one node is killed

This section shows only what has been tested so far. d-engine is built to keep more promises than are shown here; each one appears here once it is verified. The full list of d-engine guarantees, with the test status of each, is coming soon.

Is it for you?

Use it if

You want leader election, replication, service discovery or configuration consistency inside your own service, without running another cluster.

Build on it if

You need a specific database or state machine that is replicated and fault-tolerant. d-engine provides consensus and replication; you plug in the storage. d-lmdb is a distributed LMDB built this way.

LanguageEmbedded (in-process)Standalone (gRPC)
RustAvailableAvailable
Go, Java, Python, ...Planned (C ABI)Available

Hello World

use d_engine::prelude::*;
use std::time::Duration;

#[tokio::main]
async fn main() {
    let engine = DefaultEmbeddedEngine::start("./data").await.unwrap();
    engine.wait_ready(Duration::from_secs(5)).await.unwrap();

    let client = engine.client();
    client.put(b"hello".to_vec(), b"world".to_vec()).await.unwrap();
    let value = client.get_linearizable(b"hello".to_vec()).await.unwrap();

    println!("{}", String::from_utf8_lossy(&value.unwrap()));
    engine.stop().await.unwrap();
}

Scale to 3 nodes: three-nodes-embedded example.

Running this in production? Talk to us → contact@deventlab.com

Performance, measured against etcd

Embedded mode, 100 requests in flight, 256 B values. AWS us-east-1, 3 × c5.2xlarge, gp3 disk. d-engine against etcd v3.7.2 on the same instance shape. Every acknowledged write is synced to disk first, as in etcd.

Caseetcd (ops/s)d-engine (ops/s)d-engine ÷ etcd
Write, 1 in flight6058361.38×
Write, 100 in flight10,06419,8601.97×
Linearizable read64,071368,0685.74×
Eventual read (etcd: serializable)148,7091,253,6508.43×

d-engine lets you swap the storage engine, and different engines perform differently. These numbers use the raft-engine log store. Embedded calls skip serialization and the network, so the read ratios measure that, not only the engine. Three rounds per case on different instances of the same shape; treat ratios as indicative, about ±20%. Standalone (gRPC) results and other storage engines are in the full report.

Built on d-engine

d-lmdb Experimental

A distributed LMDB built on d-engine. Read the post.