kividbio/kividb
A fast, multi-threaded Redis® and Valkey alternative written in Rust: drop-in compatible, with full-text and vector search built in
What is KiviDB?
KiviDB is a high‑performance, multi‑threaded, in‑memory key‑value store written in Rust. It speaks the Redis protocol (RESP2/RESP3), so any existing Redis client can talk to it without changes. In addition to classic GET/SET operations, KiviDB bundles full‑text and vector search (Redis‑Stack‑style FT.* commands) and optional Lua scripting and TLS.
Why it matters for AI/ML
- Vector search – KiviDB implements ANN (approximate nearest‑neighbor) indexes (FLAT and HNSW) that let you store and query high‑dimensional embeddings (e.g., sentence or image vectors) directly in the database. This is a core building block for retrieval‑augmented generation, similarity search, recommendation, and other AI workloads.
- Full‑text + hybrid search – You can combine vector similarity with keyword, tag, or numeric filters in a single query, enabling sophisticated RAG pipelines.
- Speed – Benchmarks on a 32‑core AWS Graviton3 machine show 21 M GETs /s (≈9× faster than Redis 8) while keeping sub‑millisecond latency, which is valuable when serving large‑scale AI inference services.
Key features
| Feature | Details |
|---|---|
| Protocol compatibility | Implements the Redis command set; works with redis-cli, libraries, and existing Redis tooling. |
| Sharded multi‑threaded core | Every CPU core holds a shard of the in‑memory hash table, allowing parallel command execution. |
| Persistence | Snapshot (dump.kdb) and optional Append‑Only File (AOF) for durability. |
| Search | FT.CREATE, FT.SEARCH, FT.HYBRID etc. – BM25 full‑text, tag, numeric, and ANN (FLAT/HNSW) on hash fields. |
| Lua scripting | Optional (--features lua) – supports EVAL, SCRIPT, FUNCTION, FCALL. |
| TLS | Optional (--features tls) – separate TLS listener and mutual TLS support. |
| Deployment | Docker images, Linux .deb/.rpm packages, pre‑built binaries for Linux/macOS, and source builds via Cargo. |
| Configuration | Redis‑style config file or command‑line flags; protected mode enabled by default. |
| License | AGPL‑3.0 (usage does not automatically impose AGPL on your application). |
Getting started (quick example)
# Run the official Docker image
docker run -d -p 6380:6380 kividb/kividb
# Test connectivity
redis-cli -p 6380 PING # → PONG
# Create a vector index (HNSW, 128‑dimensional float32 vectors)
redis-cli -p 6380 FT.CREATE idx ON HASH PREFIX 1 doc: \
SCHEMA vec VECTOR HNSW 10 TYPE FLOAT32 DIM 128 DISTANCE_METRIC COSINE M 16 EF_CONSTRUCTION 128
# Store a vector (binary blob) in a hash
redis-cli -p 6380 HSET doc:1 vec <binary‑blob>
# Query the 10 nearest neighbours
redis-cli -p 6380 FT.SEARCH idx '*=>[KNN 10 @vec $q]' \
PARAMS 2 q <binary‑blob> DIALECT 2
All commands follow the same syntax as Redis Stack, so existing tutorials apply.
When to choose KiviDB
- You need Redis‑compatible client libraries but want better multi‑core scalability.
- Your workload includes large‑scale vector similarity (e.g., embedding stores for LLM‑based RAG) and you prefer an all‑in‑one server rather than a separate vector DB.
- You want Rust‑level safety and performance while still being able to run on any platform that supports Redis.
- You require optional TLS or Lua scripting without pulling in extra modules.
Where it fits in the ecosystem
KiviDB sits alongside other Redis‑compatible servers (Redis 8, Valkey, Dragonfly, KeyDB) but distinguishes itself by:
- Running every core on a sharded key‑space (instead of a single I/O thread).
- Providing built‑in vector search without external modules.
- Offering a Rust implementation, which may appeal to teams favoring Rust for safety and performance.
Resources
- GitHub – https://github.com/kividbio/kividb
- Website – https://kividb.io
- Documentation –
COMMANDS.mdfor supported commands,docs/for logging, persistence, TLS, and update‑check details. - Benchmarks – Video and tables in the README show throughput, latency, and vector‑search performance.
- Community – Open‑source under AGPL‑3.0; contributions accepted via pull requests.
Related
- Project
- Project
- Project
- Project