Storage Providers
SmartRAG storage provider configuration - Qdrant, Redis and InMemory storage options
Storage Provider Configuration
SmartRAG supports various storage providers:
Qdrant (Vector Database)
Qdrant is a high-performance vector database designed for production use with millions of vectors:
{
"Storage": {
"Qdrant": {
"Host": "localhost",
"UseHttps": false,
"ApiKey": "",
"CollectionName": "smartrag_documents",
"VectorSize": 768,
"DistanceMetric": "Cosine"
}
}
}
builder.Services.AddSmartRag(configuration, options =>
{
options.StorageProvider = StorageProvider.Qdrant;
});
Advantages:
- 🚀 High-performance vector search
- 📈 Scalable (millions of vectors)
- 🔍 Advanced filtering and metadata support
- 🏢 Ideal for production
Disadvantages:
- 🐳 Requires Docker or cloud service
- 💾 Additional resource usage
- 🔧 Setup complexity
Redis (High-Performance Cache)
Redis provides fast in-memory storage with vector similarity search capabilities using RediSearch:
{
"Storage": {
"Redis": {
"ConnectionString": "localhost:6379",
"Password": "",
"Username": "",
"Database": 0,
"KeyPrefix": "smartrag:local:",
"ConnectionTimeout": 30,
"EnableSsl": false,
"RetryCount": 3,
"RetryDelay": 1000,
"EnableVectorSearch": true,
"VectorIndexAlgorithm": "HNSW",
"DistanceMetric": "COSINE",
"VectorDimension": 768,
"VectorIndexName": "smartrag_vector_idx"
}
}
}
builder.Services.AddSmartRag(configuration, options =>
{
options.StorageProvider = StorageProvider.Redis;
});
Advantages:
- ⚡ Very fast access
- 🔄 Automatic expire support
- 📊 Rich data types
- 🔍 Vector similarity search with RediSearch
- 🏢 Suitable for production
Disadvantages:
- 💾 RAM-based (limited capacity)
- 🔧 Redis with RediSearch module required for vector search
- 💰 Additional cost
RediSearch Module Required
Vector search requires RediSearch module. Use redis/redis-stack-server:latest Docker image or install RediSearch module on your Redis server. Without RediSearch, only text search will work (no vector similarity search).
Docker example:
docker run -d -p 6379:6379 redis/redis-stack-server:latest
InMemory (RAM Storage)
InMemory storage is ideal for testing and development, storing all data in RAM:
{
"Storage": {
"InMemory": {
"MaxDocuments": 1000
}
}
}
builder.Services.AddSmartRag(configuration, options =>
{
options.StorageProvider = StorageProvider.InMemory;
});
Use Cases:
- 🧪 Testing and development
- 🚀 Prototyping
- 📊 Temporary data
- 🔬 Proof of concept
Important
InMemory storage loses all data when application restarts. Not suitable for production!
Storage Provider Comparison
Compare storage providers to choose the best option for your use case:
| Provider | Performance | Scalability | Setup | Cost | Production Ready |
|---|---|---|---|---|---|
| Qdrant | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐ | Excellent |
| Redis | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐ | Good |
| InMemory | ⭐⭐⭐⭐⭐ | ⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | Test only |
Recommended Use Cases
Development and Testing
// For fast development and testing
options.StorageProvider = StorageProvider.InMemory;
Medium-Scale Applications
// Fast and scalable with RediSearch
options.StorageProvider = StorageProvider.Redis;
Large-Scale Production Applications
// Maximum performance and scalability for millions of vectors
options.StorageProvider = StorageProvider.Qdrant;