Skip to content

rafaelescrich/redvector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ RedVector

CI/CD License

High-Performance In-Memory Vector Database Built in Rust

RedVector is an in-memory vector database that combines Redis compatibility with advanced vector search capabilities. Built on a Redis-compatible server (rsedis-style) and the Redisearch platform, it delivers predictable low-latency performance for AI applications, semantic search, RAG pipelines, and recommendation systems.

Built on:

  • Redis-Compatible Server: Full Redis protocol implementation in Rust (150+ commands)
  • Redisearch Platform: Vector search engine with HNSW indexing, GPU acceleration, and multi-vector support
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                                                                              β”‚
β”‚   RedVector = In-Memory Vector DB + Redis Protocol + REST/gRPC APIs         β”‚
β”‚                                                                              β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚   β”‚   Strings   β”‚   β”‚   Vectors   β”‚   β”‚   REST API  β”‚   β”‚  gRPC API   β”‚    β”‚
β”‚   β”‚   Lists     β”‚   β”‚   HNSW      β”‚   β”‚   Port 8888 β”‚   β”‚  Port 50051 β”‚    β”‚
β”‚   β”‚   Sets      β”‚   β”‚   Cosine    β”‚   β”‚   JSON      β”‚   β”‚  Protobuf   β”‚    β”‚
β”‚   β”‚   Hashes    β”‚   β”‚   Euclidean β”‚   β”‚   Qdrant-   β”‚   β”‚  Qdrant-    β”‚    β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   └──compatibleβ”€β”˜   └──compatibleβ”€β”˜    β”‚
β”‚                                                                              β”‚
β”‚   ONE SERVER β€’ 50+ CLIENT LANGUAGES β€’ THREE PROTOCOLS β€’ IN-MEMORY          β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Features

🎯 Core Vector Database Features

  • In-Memory Storage: All data and vectors stored in RAM for ultra-low latency
  • HNSW Index: Hierarchical Navigable Small World graph for fast approximate nearest neighbor search
  • Multiple Distance Metrics:
    • Cosine Similarity
    • Euclidean Distance
    • Inner Product
  • High-Dimensional Vectors: Support for vectors of any dimension
  • Real-Time Updates: Add, update, and delete vectors with instant index updates
  • Batch Operations: Efficient bulk insert and update operations

πŸ”΄ Redis Protocol Compatibility

  • 150+ Redis Commands: Full compatibility with Redis protocol (port 6379)
  • Data Structures:
    • Strings: GET, SET, MGET, MSET, INCR, DECR, APPEND, GETSET, STRLEN
    • Lists: LPUSH, RPUSH, LPOP, RPOP, LRANGE, LINDEX, LLEN, LTRIM
    • Sets: SADD, SREM, SMEMBERS, SINTER, SUNION, SDIFF, SCARD, SISMEMBER
    • Hashes: HSET, HGET, HMSET, HGETALL, HDEL, HKEYS, HVALS, HLEN
    • Sorted Sets: ZADD, ZRANGE, ZRANK, ZSCORE, ZREM, ZCARD, ZCOUNT
  • Pub/Sub: SUBSCRIBE, PUBLISH, PSUBSCRIBE, UNSUBSCRIBE
  • Transactions: MULTI, EXEC, DISCARD, WATCH for atomic operations
  • Persistence: RDB snapshots and AOF (Append-Only File) for data durability

πŸ” Vector Search Features (RediSearch Compatible)

Built on Redisearch Platform Core with HNSW indexing:

  • FT.CREATE: Create vector indexes with configurable HNSW parameters (m, ef_construction)
  • FT.ADD: Add documents with vector embeddings to the index
  • FT.SEARCH: K-nearest neighbor (KNN) similarity search with configurable ef_search
  • FT.INFO: Get detailed index information and statistics
  • FT.DROP: Delete indexes and collections
  • FT.DEL: Delete individual documents from indexes
  • HNSW Backend: Hierarchical Navigable Small World graph for fast approximate search
  • Automatic Backend Selection: Linear scan for small datasets, HNSW for large datasets
  • Multi-Vector Support: RVF2 format for ColPali/ColBERT-style multi-vector retrieval (optional)

🌐 REST API (Qdrant-Compatible)

  • Collection Management:
    • POST /api/collections/:name - Create collection
    • GET /api/collections - List all collections
    • GET /api/collections/:name - Get collection info
    • DELETE /api/collections/:name - Delete collection
  • Vector Operations:
    • POST /api/collections/:name/points - Upsert vectors
    • GET /api/collections/:name/points/:id - Get vector by ID
    • POST /api/collections/:name/points/delete - Delete vectors
    • GET /api/collections/:name/search - Search vectors
  • JSON Format: All requests and responses use JSON

πŸ”Œ gRPC API

  • VectorService: High-performance gRPC interface (port 50051)
  • Methods:
    • CreateCollection - Create new vector collection
    • Upsert - Insert or update vectors
    • Search - Perform similarity search
    • GetCollectionInfo - Retrieve collection metadata
    • DeleteCollection - Remove collection
  • Protobuf: Efficient binary protocol for maximum throughput

⚑ Performance Features

  • Zero GC Pauses: Pure Rust implementation eliminates garbage collection
  • Predictable Latency: Consistent P99 performance under load
  • Concurrent Operations: Multi-threaded architecture for parallel processing
  • Memory Efficiency: Optimized data structures for minimal memory footprint
  • Fast Index Updates: Real-time index modifications without blocking
  • GPU Acceleration: Optional wgpu (Vulkan/Metal/DX12) and CUDA backends for vector operations
  • SIMD Optimizations: CPU-optimized distance metrics for faster similarity calculations
  • LRU Caching: Hot vector cache for frequently accessed embeddings

πŸ’Ύ Persistence & Durability

  • RDB Snapshots: Point-in-time snapshots of the Redis-compatible database
  • AOF (Append-Only File): Durable write-ahead logging for Redis data
  • redb Vector Storage: Persistent storage for vectors and metadata using redb
  • HNSW Snapshots: Periodic snapshots of HNSW index structure
  • Background Persistence: Non-blocking save operations
  • Data Recovery: Automatic recovery on server restart
  • S3 Storage: Optional S3/GCS/MinIO integration for vector storage (feature flag)

πŸ”§ Developer Experience

  • Multi-Protocol Support: Use Redis clients, REST, or gRPC
  • Language Agnostic: Works with any language that has a Redis client
  • Docker Support: Easy deployment with containerization
  • Self-Hosted: Full control over your data and infrastructure
  • Open Source: Apache 2.0 licensed

πŸš€ Quick Start

Using Docker

docker build -t redvector:latest .
docker run -d -p 6379:6379 -p 8888:8888 -p 50051:50051 redvector:latest

Building from Source

# Clone
git clone https://github.com/rafaelescrich/redvector.git
cd redvector

# Build with all features (Redis + Vector Search + REST + gRPC)
cargo build --release --features full

# Run
./target/release/redvector

Output:

πŸš€ RedVector v0.1.0 - In-Memory Vector Database
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
πŸ”΄ Redis Protocol: localhost:6379
πŸ“Š REST API:       http://localhost:8888
πŸ”Œ gRPC API:       http://localhost:50051
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Connect with Any Redis Client

import redis
r = redis.Redis()

# Standard Redis commands work
r.set("hello", "world")
print(r.get("hello"))  # b'world'

# Vector search with FT.* commands
r.execute_command("FT.CREATE", "myindex", "SCHEMA", "embedding", "VECTOR(384)")
r.execute_command("FT.ADD", "myindex", "doc1", "1.0", "FIELDS", "vector", "0.1,0.2,...")
results = r.execute_command("FT.SEARCH", "myindex", "0.1,0.2,...")

Using REST API

# Create a collection
curl -X POST http://localhost:8888/api/collections/my_vectors \
  -H "Content-Type: application/json" \
  -d '{"vector_size": 384, "distance": "Cosine"}'

# Add vectors
curl -X POST http://localhost:8888/api/collections/my_vectors/points \
  -H "Content-Type: application/json" \
  -d '{
    "points": [
      {"id": 1, "vector": [0.1, 0.2, 0.3, ...]}
    ]
  }'

# Search
curl -X POST http://localhost:8888/api/collections/my_vectors/search \
  -H "Content-Type: application/json" \
  -d '{"vector": [0.1, 0.2, 0.3, ...], "limit": 10}'

Using gRPC API

# Using grpcurl
grpcurl -plaintext localhost:50051 redvector.VectorService/CreateCollection \
  -d '{"name": "my_vectors", "vector_size": 384, "distance": "Cosine"}'

πŸ—οΈ Architecture

RedVector is built on two core components:

  1. Redis-Compatible Server (rsedis-style): Handles all Redis protocol commands, data structures, and persistence
  2. Redisearch Platform Core: Provides vector search capabilities with HNSW indexing, GPU acceleration, and advanced features
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    RedVector In-Memory Architecture                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                              β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                   β”‚
β”‚   β”‚ Redis Proto  β”‚   β”‚   REST API   β”‚   β”‚   gRPC API   β”‚                   β”‚
β”‚   β”‚  Port 6379   β”‚   β”‚  Port 8888   β”‚   β”‚  Port 50051  β”‚                   β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜                   β”‚
β”‚          β”‚                  β”‚                  β”‚                            β”‚
β”‚          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                            β”‚
β”‚                             β–Ό                                               β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚   β”‚              Redisearch Platform Core                                β”‚   β”‚
β”‚   β”‚   β€’ HNSW Vector Index (CPU)  β€’ GPU Acceleration (wgpu/CUDA)         β”‚   β”‚
β”‚   β”‚   β€’ RVF2 Multi-Vector Storage  β€’ Quantization (SQ8, PQ)              β”‚   β”‚
β”‚   β”‚   β€’ Cosine/Euclidean/Inner Product  β€’ Persistent Index (redb)        β”‚   β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                             β”‚                                               β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚   β”‚         Redis-Compatible Key-Value Store (In-Memory)                 β”‚   β”‚
β”‚   β”‚    Strings β€’ Lists β€’ Sets β€’ Hashes β€’ Sorted Sets β€’ Pub/Sub          β”‚   β”‚
β”‚   β”‚    β€’ 150+ Redis Commands  β€’ Transactions  β€’ Persistence (RDB/AOF)    β”‚   β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                             β”‚                                               β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚   β”‚                       Persistence Layer                              β”‚   β”‚
β”‚   β”‚              β€’ RDB Snapshots  β€’ AOF Append-Only File                 β”‚   β”‚
β”‚   β”‚              β€’ redb Vector Storage  β€’ HNSW Snapshots                  β”‚   β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ†š Comparison with Other Vector Databases

Feature RedVector Qdrant Milvus Pinecone pgvector
Type In-Memory Disk-based Hybrid Cloud PostgreSQL Extension
Language πŸ¦€ Rust πŸ¦€ Rust Go ? C
Redis Protocol βœ… ❌ ❌ ❌ ❌
REST API βœ… βœ… βœ… βœ… ❌
gRPC API βœ… βœ… βœ… ❌ ❌
No GC Pauses βœ… βœ… ❌ ? βœ…
Built-in Cache βœ… ❌ ❌ ❌ ❌
Pub/Sub βœ… ❌ ❌ ❌ ❌
Transactions βœ… ❌ ❌ ❌ βœ…
Self-Hosted βœ… βœ… βœ… ❌ βœ…
Open Source βœ… βœ… βœ… ❌ βœ…
In-Memory βœ… ❌ Partial ❌ ❌

πŸ—ΊοΈ Roadmap

v0.1.0 - Current βœ…

  • Redis-compatible server (rsedis-style) with 150+ commands
  • Redisearch Platform Core integration
  • In-memory vector storage with HNSW indexing
  • RediSearch FT.* commands (FT.CREATE, FT.ADD, FT.SEARCH, FT.INFO, FT.DROP, FT.DEL)
  • Integrated REST API (Qdrant-compatible)
  • Integrated gRPC API
  • Persistence (RDB, AOF, redb for vectors)

v0.2.0 - GPU Acceleration

  • wgpu backend (Vulkan/Metal/DX12) via Redisearch Platform Core
  • CUDA backend for NVIDIA GPUs
  • Apple Silicon Metal optimization
  • GPU-accelerated distance metrics
  • Flat and IVF indexes on GPU

v1.0.0 - Production Ready

  • IVF-SQ8 index (4x compression) via Redisearch Platform Core
  • IVF-PQ index (32x compression) for maximum memory efficiency
  • Memory-mapped vector storage with RVF2 format
  • Full-text search integration (Redisearch rust-port)
  • Production hardening and comprehensive benchmarks

v2.0.0 - Enterprise (Closed Source)

  • Distributed clustering
  • Multi-node replication
  • Cloud management console

πŸ“š Documentation

Document Description
GPU Acceleration Plan GPU implementation roadmap
Architecture Advantages Why RedVector's design is unique
Docker Guide Container deployment

🀝 Contributing

Contributions are welcome! See our Architecture Decision Records for design context.

# Run tests
cargo test --all-features

# Build with all features
cargo build --release --features full

# Run
./target/release/redvector

πŸ™ Acknowledgments

RedVector is inspired by and built upon the excellent work of the open-source community:

  • rsedis: Redis re-implemented in Rust by Sebastian Waisbrot. The rsedis project provided significant inspiration for the Redis-compatible server implementation.

  • RediSearch: A query and indexing engine for Redis, providing secondary indexing, full-text search, and vector similarity search. RediSearch's design and feature set inspired the vector search capabilities in RedVector.

We are grateful to the maintainers and contributors of these projects for their valuable work in the open-source ecosystem.


πŸ“„ License

Copyright (c) 2025, Rafael Escrich

Licensed under the Apache License, Version 2.0. See LICENSE for details.


Built with πŸ¦€ Rust β€’ Powered by Redis-Compatible Server + Redisearch Platform β€’ In-Memory Vector Database

Documentation β€’ Issues β€’ Discussions

About

RedVector is an Redis-compatible in-memory vector database implemented in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published