Fast Redis-compatible in-memory database with advanced search capabilities.
Project details
KiviDB is an efficient, Redis-compatible in-memory database designed with Rust for high performance. It supports full-text and vector search, snapshots, and optional Lua scripting. Ideal for applications demanding high throughput and low latency, KiviDB provides a reliable solution without the constraints of traditional databases.
KiviDB is an efficient, Redis®-compatible in-memory database developed in Rust, designed to handle high-throughput workloads while maintaining consistent low-latency performance. Embracing the Redis RESP protocol, KiviDB features a sharded architecture facilitating rapid key-value operations and supports data persistence through snapshots as well as an optional append-only file.
KiviDB provides a familiar command interface for Redis users. See COMMANDS.md for a detailed list of supported commands.
It includes Redis Stack-style FT.* commands, enabling full-text, tag, numeric, and vector search (both FLAT and HNSW methods).
Lua scripting can be enabled via Cargo features, allowing the use of commands such as EVAL, SCRIPT, and FCALL as outlined in the Scripting commands (Lua).
Optional TLS support ensures secure data transmission, enhancing the integrity and confidentiality of database interactions.
KiviDB is optimized for performance, achieving impressive throughput and low latency, making it suitable for demanding applications.
Benchmarked against leading databases, KiviDB outperforms many of its competitors in both throughput and latency, as illustrated below:
| Metric | KiviDB 1.1.0 | Competitors |
|---|---|---|
| GET, pipeline (16) | 21.2M ops/s | Dragonfly 9.1M, Redis 2.4M |
| SET, pipeline (16) | 19.2M ops/s | Dragonfly 8.5M, Redis 2.0M |
| p99 latency (GET) | 0.36 ms | Dragonfly 0.88 ms, Redis 2.2 ms |
Additionally, KiviDB supports vector search capabilities that allow efficient querying of high-dimensional data, providing competitive queries per second at varying recall levels:
| Queries/s | KiviDB 1.1.0 | Competitors |
|---|---|---|
| ef 64 | 59.3K | 41.3K (Dragonfly), 31.8K (Redis) |
| ef 128 | 50.7K | 40.3K (Dragonfly), 28.9K (Redis) |
To create an index with a vector field in KiviDB, use the following command:
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 vectors as raw FLOAT32 bytes and query using the KNN search approach:
redis-cli -p 6380 FT.SEARCH idx '*=>[KNN 10 @vec $q]' PARAMS 2 q <blob> DIALECT 2
KiviDB offers multiple build variants to cater to different operational needs, including core functionalities, Lua scripting, or TLS support. Detailed building instructions and configurations are available in the repository.
For more in-depth information, including command usage and configuration, visit the repository on GitHub: KiviDB GitHub Repository and the KiviDB Website.
KiviDB is open-source software offered under a permissive license, enabling use in both open and closed-source projects without the constraints of copyleft.
Comments
0Start the conversation
Share the first comment.