Crate distx

Crate distx 

Source
Expand description

§DistX

A fast, in-memory vector database with Qdrant API compatibility.

DistX provides high-performance vector similarity search using HNSW indexing, with SIMD optimizations for maximum throughput.

§Performance

DistX beats both Qdrant and Redis:

  • Insert: 4.5x faster than Qdrant, 10x faster than Redis
  • Search: 6.3x faster than Qdrant, 5x faster than Redis
  • Latency: 0.13ms p50 (6.6x lower than Qdrant)

§Quick Start

§As a Server

cargo install distx
distx --http-port 6333 --grpc-port 6334

§As a Library

use distx::prelude::*;

// Create a collection
let config = CollectionConfig {
    name: "my_collection".to_string(),
    vector_dim: 128,
    distance: Distance::Cosine,
    use_hnsw: true,
    enable_bm25: false,
};
let collection = Collection::new(config);

// Insert a vector
let vector = Vector::new(vec![0.1, 0.2, 0.3, /* ... */]);
let point = Point::new(PointId::String("point1".to_string()), vector, None);
collection.upsert(point).unwrap();

// Search
let query = Vector::new(vec![0.1, 0.2, 0.3, /* ... */]);
let results = collection.search(&query, 10, None);

§Crate Structure

DistX is composed of several crates:

  • distx-core - Core data structures (Vector, Point, Collection, HNSW, BM25)
  • distx-storage - Persistence layer (WAL, snapshots, LMDB)
  • distx-api - REST and gRPC APIs

§Features

  • HNSW Indexing: Fast approximate nearest neighbor search
  • SIMD Optimizations: AVX2, SSE, and NEON support
  • BM25 Text Search: Full-text search with ranking
  • Payload Filtering: Filter by JSON metadata
  • Dual API: Qdrant-compatible REST and gRPC
  • Persistence: Redis-style WAL and snapshots

Modules§

prelude
Prelude module for convenient imports
simd
SIMD-optimized vector operations

Structs§

BM25Index
Collection
A collection of vectors with metadata
CollectionConfig
Configuration for a collection
GrpcApi
HnswIndex
High-performance HNSW index for approximate nearest neighbor search Optimized with:
PayloadFilter
Point
A point in the vector space with optional payload
RestApi
StorageManager
Manages collections and persistence
Vector
A vector of floating point numbers

Enums§

Distance
Error
FilterCondition
PointId

Traits§

Filter

Type Aliases§

Result