arroy

Annoy-inspired approximate nearest neighbors in Rust, backed by LMDB for low memory usage.

Library
Cargo
v0.8.0
309stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
53/100Fair
Development Activity48
Maintenance32
Community56
Maturity48
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture88
Code Quality85
Innovation82
Learning Curve60

Arroy is a Rust approximate nearest neighbors (ANN) library with an interface close to Spotify’s Annoy, built on top of the LMDB memory-mapped key-value store. Using random projections and a forest of trees, it searches for vectors near a target while keeping memory usage low and allowing many processes to share the same on-disk index.

Built and used inside Meilisearch, arroy is designed for high-dimensional vector search over millions of items where memory footprint is a prime concern. Because indexes live in LMDB, any thread or process can query them immediately, even while another writer modifies the data atomically.

What You Get

  • Approximate nearest-neighbor search over Euclidean, Manhattan, cosine, and dot-product distances
  • LMDB-backed storage that lets multiple processes share one memory-mapped index
  • Multithreaded tree building with rayon plus filtered and incrementally-updatable indexes

Common Use Cases

  • Serving similar-document or similar-item search over millions of embeddings
  • Adding vector search to an application without holding all vectors in RAM
  • Sharing a prebuilt ANN index across multiple query processes

Under The Hood

Architecture Arroy builds a forest of random-projection trees: at each intermediate node a random hyperplane splits the space, recursively partitioning vectors. Trees and item vectors are serialized (via bytemuck/byteorder) into LMDB (through the heed wrapper), so writes go through LMDB transactions and reads are zero-copy memory-mapped lookups. Roaring bitmaps track item sets and enable query-time filtering. Tech Stack Rust (edition 2021) built on heed (LMDB), bytemuck, byteorder, memmap2, ordered-float, rand, rayon, roaring, and thiserror. Dev tooling includes insta snapshots, arbitrary/proptest, and clap-based example binaries. Code Quality Well-structured with proptest regressions, insta snapshot tests, and a benchmark repository, reflecting production use inside Meilisearch. Dimension and distance checks are enforced for a safer API than the original Annoy. API Design The reader/writer split makes build-versus-query lifecycles explicit, indexes are identified by a u16, and the interface deliberately mirrors Annoy for familiarity while being generic over the RNG.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search