Skip to content
Tech News
← Back to articles

TurboKV: Insanely fast Rust key-value store

read original more articles
Why This Matters

TurboKV is a high-performance, embedded key-value store written in Rust, designed for speed and reliability with features like atomic batches, range scans, configurable durability, and compression. Its efficient use of hardware AES and support for async operations make it a compelling choice for developers seeking fast, embedded database solutions. This advancement can significantly impact the development of scalable, reliable applications in the tech industry and for end-users.

Key Takeaways

A fast, embedded key-value store in Rust

TurboKV is an async embedded key-value database with atomic batches, ordered range scans, configurable durability, compression, and background compaction.

Installation

cargo add turbokv cargo add tokio --features full

Or add the dependencies directly:

[ dependencies ] turbokv = " 0.6 " tokio = { version = " 1 " , features = [ " full " ] }

TurboKV's persisted Bloom-filter format uses hardware AES. Build x86/x86_64 targets with RUSTFLAGS="-C target-feature=+aes,+sse2" , and ARM/AArch64 targets with RUSTFLAGS="-C target-feature=+aes,+neon" . You may instead use -C target-cpu=native when the binary will run only on the same CPU model or a feature superset.

Quick start

use turbokv :: { Db , DbOptions , WriteBatch } ; # [ tokio :: main ] async fn main ( ) -> Result < ( ) , Box < dyn std :: error :: Error > > { let db = Db :: open_with_options ( "./my-database" , DbOptions :: durable ( ) ) . await ? ; db . insert ( b"user:1" , b"Ada" ) . await ? ; assert_eq ! ( db . get ( b"user:1" ) . await ? , Some ( b"Ada" . to_vec ( ) ) ) ; let mut batch = WriteBatch :: new ( ) ; batch . put ( b"user:2" , b"Grace" ) ; batch . put ( b"user:3" , b"Linus" ) ; batch . delete ( b"user:1" ) ; db . write_batch ( & batch ) . await ? ; for ( key , value ) in db . scan_prefix ( b"user:" ) . await ? { println ! ( "{} = {}" , String :: from_utf8_lossy ( & key ) , String :: from_utf8_lossy ( & value ) ) ; } db . close ( ) . await ? ; Ok ( ( ) ) }

Runnable examples:

... continue reading