Introduction
Building a database from scratch is often called "reinventing the wheel." But sometimes, the wheels available don't fit the car you're building.
I’ve been working on FerresDB (https://www.ferres.io/) for the past few months. It started as a challenge to solve sub-millisecond search latency in AI-driven workflows, and today, I’m excited to share that it’s officially open-source.
The Tech Stack
When performance is the main requirement, there aren't many choices. I went with Rust.
Coming from a background in other high-level languages, moving to Rust for this project allowed me to:
- Leverage Zero-cost abstractions.
- Implement custom SIMD kernels for lightning-fast vector distance calculations.
- Ensure thread safety without a Garbage Collector (GC) slowing down ingestion.
What makes FerresDB different?
Most vector stores are either too heavy for simple projects or too slow for real-time applications. FerresDB was designed with three pillars in mind:
- Speed: Sub-millisecond latency using a custom HNSW (Hierarchical Navigable Small World) implementation.
- Persistence: A built-in Write-Ahead Log (WAL) to ensure your data is safe even after a crash.
- Simplicity: A straightforward API that doesn't require complex infrastructure to set up.
Lessons Learned
Building this wasn't easy. I spent weeks debugging memory alignment for SIMD and fine-tuning the HNSW graph parameters to find the sweet spot between recall and speed.
One of the biggest takeaways? Memory layout matters more than the algorithm itself. If your data doesn't fit in the CPU cache, even the best $O(\log n)$ algorithm will feel sluggish due to cache misses.
Open Source & Contribution
I’m opening the code because I believe the best way to stress-test infrastructure is to let the community break it. Whether you are a Rustacean looking to contribute to a low-level project or an AI engineer looking for a fast, local vector store, I’d love your feedback.
Check it out on GitHub: https://github.com/ferres-db/ferres-db
If you find this project interesting, feel free to leave a ⭐ on GitHub. It helps a lot!
Top comments (0)