The Problem
Applications that need sub‑millisecond graph traversals—LLM‑augmented retrieval, fraud detection, or real‑time recommendation—often hit a wall with traditional property‑graph stores that rely on pointer‑heavy adjacency lists. Memory overhead and CPU‑bound join logic become bottlenecks as the graph scales.
What This Does
FalkorDB stores the adjacency matrix as a sparse matrix built on the GraphBLAS library (see deps/GraphBLAS/). Queries are expressed as linear‑algebra operations, giving the engine a deterministic memory footprint and strong cache locality. The core Rust binding (deps/FalkorDB-core-rs/src/lib.rs) exposes the database engine to the surrounding C/C++ layers, while the C front‑end (src/) implements the OpenCypher parser and network server.
README.mdadvertises a multi‑tenant, OpenCypher‑compatible endpoint.build/docker/Dockerfileassembles a container that bundles the compiled binaries with a Redis‑compatible configuration (build/docker/falkordb.conf).- Demo code in
demo/(e.g.,demo/imdb/imdb_demo.py) shows Python clients using the REST/Redis protocol.
How It Is Wired
Entry point – the process starts in deps/FalkorDB-core-rs/src/lib.rs, which builds the GraphBLAS engine via Cargo. The Cargo.toml in the same directory pulls the native graphblas-sys crate that links to the C sources under deps/GraphBLAS/.
- Initialization –
lib.rs::initialize()callsgraphblas::init()(C function indeps/GraphBLAS/CUDA/init/GB_cuda_init.cwhen compiled with CUDA, otherwise the CPU path). This allocates the sparse matrix structures.
- Server bootstrap –
src/server.c(not listed explicitly but part of the 384 code files insrc/) creates a TCP listener, readsbuild/docker/falkordb.conf, and registers the OpenCypher query parser (src/parser.c).
- Query handling – each incoming Cypher statement is parsed into an abstract syntax tree, then translated into a sequence of GraphBLAS kernels (
deps/GraphBLAS/CUDA/apply/,.../mxm/,.../reduce/). The generated kernels are compiled JIT‑style (seedeps/GraphBLAS/CUDA/apply/template/GB_jit_kernel_cuda_apply_*).
- Result emission – after kernel execution, the sparse result matrix is converted back to a row‑oriented response in
src/response.cand sent over the Redis protocol.
The widest blast‑radius functions are the GraphBLAS kernel dispatchers (GB_cuda_AxB_* and GB_cuda_apply_*) because they run native code with direct memory access. Their callers (lib.rs and the C server) are the only two places that invoke them, keeping the call surface small.
No full call‑graph mapping exists for the Python demo layer; it simply opens a socket to the server binary (demo/client/client.py) and issues Cypher strings.
How To Use It
# Clone the repo
git clone https://github.com/moses-y/FalkorDB
cd FalkorDB
# Build the core engine (requires Rust, CMake, and a C compiler)
cargo build --release # builds deps/FalkorDB-core-rs
cmake -S . -B build && cmake --build build --target all # builds GraphBLAS & C server
# Optional: build the Docker image (uses the Dockerfile that expects the binaries)
docker build -t falkordb/falkordb -f build/docker/Dockerfile .
# Run the container (uses the bundled config)
docker run -p 6379:6379 falkordb/falkordb
Configuration lives in build/docker/falkordb.conf; adjust port, maxmemory, or TLS settings there before starting the container.
To exercise the Python client:
pip install -r demo/imdb/requirements.txt
python demo/imdb/imdb_demo.py
Real‑World Use
A retrieval‑augmented generation pipeline can query the running server with:
import redis
r = redis.StrictRedis(host='localhost', port=6379)
cypher = "MATCH (a:Article)-[:MENTIONS]->(e:Entity) WHERE e.name='Paris' RETURN a.title"
print(r.execute_command("GRAPH.QUERY", "mygraph", cypher))
The sparse‑matrix backend returns the matching article IDs in microseconds, enabling the LLM to fetch context on‑the‑fly.
Code Health & Issues
- Critical – Secrets in workflow
.github/workflows/release-image.yml(DOCKER_USERNAME, DOCKER_PASSWORD, etc.). - High – GitHub Actions referenced by tag only; pin to commit SHA.
- Medium – Missing least‑privilege
GITHUB_TOKENpermissions in.github/workflows/build.yml. - Medium – Base images in Dockerfiles are not pinned by digest.
- Medium – Generated build artifacts committed under
build/. - Medium –
checkoutstep retains credentials; setpersist-credentials: false. - Medium – No non‑root
USERdefined in Docker images. - Low – No job timeouts in CI workflows.
- Low – Repository lacks
.editorconfig,.gitattributes, and formatter config.
All findings are from the static pipeline; no additional structural red flags were detected.
The Bottom Line
FalkorDB delivers a high‑performance, sparse‑matrix graph engine with a clear Rust → C → network stack. The codebase is sizable and includes a full CI/CD pipeline, but secret handling and Docker hygiene need remediation before production use. It is best suited for teams comfortable compiling native code and who require sub‑millisecond graph queries for LLM‑centric workloads.