System Overview¶
Grafeo is designed as a high-performance, embeddable graph database.
Design Goals¶
| Goal | Approach |
|---|---|
| Performance | Vectorized execution, SIMD, columnar storage |
| Embeddability | No external dependencies, single library |
| Safety | Pure Rust, memory-safe by design |
| Flexibility | Plugin architecture, multiple storage backends |
Query Flow¶
sequenceDiagram
participant Client
participant Session
participant Parser
participant Planner
participant Optimizer
participant Executor
participant Storage
Client->>Session: execute(query)
Session->>Parser: parse(query)
Parser-->>Session: AST
Session->>Planner: plan(AST)
Planner-->>Session: Logical Plan
Session->>Optimizer: optimize(plan)
Optimizer-->>Session: Physical Plan
Session->>Executor: execute(plan)
Executor->>Storage: scan/lookup
Storage-->>Executor: data
Executor-->>Session: results
Session-->>Client: QueryResult Key Components¶
Query Processing¶
- Parser - GQL/Cypher to AST
- Binder - Semantic analysis and type checking
- Planner - AST to logical plan
- Optimizer - Cost-based optimization
- Executor - Push-based execution
Storage¶
- LPG Store - Node and edge storage
- Property Store - Columnar property storage
- Indexes - Hash, B-tree, adjacency
- WAL - Durability and recovery
Memory¶
- Buffer Manager - Memory allocation
- Arena Allocator - Epoch-based allocation
- Spill Manager - Disk spilling for large operations
Threading Model¶
- Main Thread - Coordinates query execution
- Worker Threads - Parallel query processing (morsel-driven)
- Background Thread - Checkpointing, compaction