<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Joshua Chi</title>
    <description>The latest articles on DEV Community by Joshua Chi (@joshua_c).</description>
    <link>https://dev.to/joshua_c</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3711060%2Fa24ee2bc-d941-4bf4-863d-e64e33a47761.png</url>
      <title>DEV Community: Joshua Chi</title>
      <link>https://dev.to/joshua_c</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joshua_c"/>
    <language>en</language>
    <item>
      <title>d-engine: A Lightweight Distributed Coordination Engine for Rust</title>
      <dc:creator>Joshua Chi</dc:creator>
      <pubDate>Fri, 16 Jan 2026 03:57:20 +0000</pubDate>
      <link>https://dev.to/joshua_c/d-engine-a-lightweight-distributed-coordination-engine-for-rust-210j</link>
      <guid>https://dev.to/joshua_c/d-engine-a-lightweight-distributed-coordination-engine-for-rust-210j</guid>
      <description>&lt;p&gt;A lightweight Raft implementation designed for embedding into Rust applications — the consensus layer for building reliable distributed systems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Built with a simple vision&lt;/strong&gt;: make distributed coordination accessible - cheap to run, simple to use. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Built on a core philosophy&lt;/strong&gt;: choose simple architectures over complex ones.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I Built This
&lt;/h2&gt;

&lt;p&gt;In my experience, adding distributed coordination to applications was always expensive – existing solutions like etcd are either too slow when embedded (gRPC overhead) or require running separate 3-node clusters.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/deventlab/d-engine" rel="noopener noreferrer"&gt;d-engine&lt;/a&gt; aims to change this: make coordination cheap enough that you don't hesitate to add it when you need it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Single-threaded event loop:&lt;/strong&gt; No race conditions, strict ordering. CPU-bound on single core—scale horizontally.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Role separation (SRP):&lt;/strong&gt; Leader/Follower/Candidate/Learner each handle their own logic. Main loop just routes events.&lt;/p&gt;

&lt;p&gt;Standard design for Raft implementations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two Integration Modes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Embedded mode&lt;/strong&gt; - runs inside your Rust process:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;EmbeddedEngine&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="k"&gt;.await&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="nf"&gt;.wait_ready&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;Duration&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;from_secs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="k"&gt;.await&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;;&lt;/span&gt;

&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="nf"&gt;.client&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="nf"&gt;.put&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;b"key"&lt;/span&gt;&lt;span class="nf"&gt;.to_vec&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="s"&gt;b"value"&lt;/span&gt;&lt;span class="nf"&gt;.to_vec&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;&lt;span class="k"&gt;.await&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// &amp;lt;0.1ms&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Direct memory access via mpsc channels (no serialization)&lt;/li&gt;
&lt;li&gt;&amp;lt;0.1ms latency for local operations&lt;/li&gt;
&lt;li&gt;Single binary deployment&lt;/li&gt;
&lt;li&gt;Benchmark: 203K writes/s, 279K reads/s (M2 Mac)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Standalone mode&lt;/strong&gt; - separate server process with gRPC:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="py"&gt;d-engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="py"&gt;version&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"0.2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="py"&gt;features&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"client"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="py"&gt;default-features&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Language-agnostic (Go, Python, Java, Rust)&lt;/li&gt;
&lt;li&gt;Independent scaling&lt;/li&gt;
&lt;li&gt;Benchmark: 64K writes/s, 12K reads/s&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Choose based on your language and latency requirements.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benchmarks
&lt;/h2&gt;

&lt;p&gt;Embedded mode (3-node cluster, M2 Mac localhost):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;203K writes/s, 279K reads/s (linearizable)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Standalone mode (gRPC):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;64K writes/s, 12K reads/s (linearizable)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1mzw06weicknyej2vcef.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1mzw06weicknyej2vcef.png" alt="d-engine_bench_comparison_v0.2" width="800" height="501"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Lab numbers only—production performance varies by workload and hardware.&lt;br&gt;
Full details in &lt;a href="https://github.com/deventlab/d-engine/tree/main/benches/embedded-bench/reports/v0.2.2" rel="noopener noreferrer"&gt;benches/&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Design: Traits for Extension
&lt;/h2&gt;

&lt;p&gt;d-engine provides working implementations (RocksDB storage, KV operations, gRPC transport). When defaults don't fit, implement the traits:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;pub&lt;/span&gt; &lt;span class="k"&gt;trait&lt;/span&gt; &lt;span class="n"&gt;StorageEngine&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;LogStore&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;LogStore&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;MetaStore&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;MetaStore&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;pub&lt;/span&gt; &lt;span class="k"&gt;trait&lt;/span&gt; &lt;span class="n"&gt;StateMachine&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;apply_chunk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="k"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Vec&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Entry&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Result&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Examples in repo show Sled storage backend, custom HTTP handlers with HAProxy for HA deployments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Consistency Model
&lt;/h2&gt;

&lt;p&gt;Three read policies (configurable per-operation or server-wide):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;LinearizableRead&lt;/strong&gt;: Strongest guarantee, verify quorum (~2ms)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LeaseRead&lt;/strong&gt;: Leader lease-based, fast path (~0.3ms, requires NTP)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EventualConsistency&lt;/strong&gt;: Local read, may be stale (~0.1ms)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Trade-offs documented. Defaults are sane.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start Simple, Scale When Needed
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Start with 1 node (auto-elected leader)&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;EmbeddedEngine&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="k"&gt;.await&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Scale to 3 nodes later: update config, zero code changes&lt;/span&gt;
&lt;span class="c1"&gt;// See examples/single-node-expansion&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No Kubernetes, no complex setup. Just Rust + config file.&lt;/p&gt;

&lt;h2&gt;
  
  
  What It Is
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Raft consensus implementation&lt;/li&gt;
&lt;li&gt;Pluggable storage (RocksDB, Sled, custom)&lt;/li&gt;
&lt;li&gt;Flexible consistency (linearizable/lease/eventual)&lt;/li&gt;
&lt;li&gt;Production-ready core, API stabilizing toward v1.0&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Current State &amp;amp; Direction
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Version 0.2&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Core Raft engine is solid (1000+ tests, d-engine 0.1.x version Jepsen validated).&lt;br&gt;
APIs are stabilizing toward v1.0. Pre-1.0 means breaking changes are possible&lt;br&gt;
if they improve design.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No production users yet&lt;/strong&gt; – looking for early adopters to validate real-world use cases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Future Direction:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cloud-native storage backends (Cloudflare, AWS, GCP)&lt;/li&gt;
&lt;li&gt;Exploring: etcd-compatible API layer&lt;/li&gt;
&lt;li&gt;Timeline depends on community feedback&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="nn"&gt;[dependencies]&lt;/span&gt;
&lt;span class="py"&gt;d-engine&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"0.2"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/deventlab/d-engine" rel="noopener noreferrer"&gt;https://github.com/deventlab/d-engine&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Docs: &lt;a href="https://docs.rs/d-engine" rel="noopener noreferrer"&gt;https://docs.rs/d-engine&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Examples: &lt;a href="https://github.com/deventlab/d-engine/tree/main/examples" rel="noopener noreferrer"&gt;https://github.com/deventlab/d-engine/tree/main/examples&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're building distributed systems in Rust and need consensus, the code is there. Examples show embedded mode, standalone mode, custom storage, HA deployments with HAProxy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Looking for Early Adopters
&lt;/h2&gt;

&lt;p&gt;I'm looking for Rust developers building distributed systems who have &lt;strong&gt;real problems to solve&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Coordination bottlenecks in your architecture (slow consensus, expensive etcd clusters)&lt;/li&gt;
&lt;li&gt;Specific use cases where strong consistency matters (leader election, distributed locks, metadata stores)&lt;/li&gt;
&lt;li&gt;Production deployments where you need cheap, simple, and reliable coordination&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Particularly interested in:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Teams with real coordination problems (not just kicking the tires)&lt;/li&gt;
&lt;li&gt;Cloud-native scenarios (Cloudflare Workers, AWS Lambda, serverless)&lt;/li&gt;
&lt;li&gt;Cost-sensitive use cases where etcd feels like overkill&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What I'm offering:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Free architecture review for your use case&lt;/li&gt;
&lt;li&gt;Direct access to roadmap planning&lt;/li&gt;
&lt;li&gt;Quick response to GitHub issues/questions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have a specific problem: &lt;a href="https://github.com/deventlab/d-engine/issues" rel="noopener noreferrer"&gt;Open an issue&lt;/a&gt; with your use case, or &lt;a href="mailto:deventlab@gmail.com"&gt;reach out directly&lt;/a&gt;.&lt;br&gt;
Show me what's broken, what's expensive, what's too complex. Let's see if d-engine can solve it cheaply.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;License&lt;/strong&gt;: MIT or Apache-2.0 | &lt;strong&gt;Platforms&lt;/strong&gt;: Linux, macOS | &lt;strong&gt;MSRV&lt;/strong&gt;: Rust 1.88&lt;/p&gt;

</description>
      <category>raft</category>
      <category>rust</category>
      <category>distributedsystems</category>
      <category>consensus</category>
    </item>
  </channel>
</rss>
