@grafema/rfdb 0.2.5-beta → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -37
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
*Named after the author's wife Regina (Rega for short). The Hebrew word רגע (rega, "moment") conveniently fits the concept — a flow of discrete moments captured in the graph.*
|
|
6
6
|
|
|
7
|
-
**Warning: This package is in
|
|
7
|
+
**Warning: This package is in beta stage and the API may change between minor versions.**
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
@@ -14,9 +14,8 @@ npm install @grafema/rfdb
|
|
|
14
14
|
|
|
15
15
|
Prebuilt binaries are included for:
|
|
16
16
|
- macOS x64 (Intel)
|
|
17
|
-
- macOS arm64 (Apple Silicon)
|
|
18
|
-
- Linux x64
|
|
19
|
-
- Linux arm64 - coming soon
|
|
17
|
+
- macOS arm64 (Apple Silicon)
|
|
18
|
+
- Linux x64
|
|
20
19
|
|
|
21
20
|
For other platforms, build from source (requires Rust):
|
|
22
21
|
|
|
@@ -31,12 +30,9 @@ cargo build --release
|
|
|
31
30
|
### As a CLI
|
|
32
31
|
|
|
33
32
|
```bash
|
|
34
|
-
# Start the server
|
|
33
|
+
# Start the server
|
|
35
34
|
npx rfdb-server ./my-graph.rfdb --socket /tmp/rfdb.sock
|
|
36
35
|
|
|
37
|
-
# Or if installed globally
|
|
38
|
-
rfdb-server ./my-graph.rfdb --socket /tmp/rfdb.sock
|
|
39
|
-
|
|
40
36
|
# Using default socket path (/tmp/rfdb.sock)
|
|
41
37
|
rfdb-server ./my-graph.rfdb
|
|
42
38
|
```
|
|
@@ -71,7 +67,7 @@ server.kill();
|
|
|
71
67
|
|
|
72
68
|
## With Grafema
|
|
73
69
|
|
|
74
|
-
RFDB
|
|
70
|
+
RFDB is the default storage backend for Grafema. The MCP server and CLI auto-start RFDB when needed.
|
|
75
71
|
|
|
76
72
|
```javascript
|
|
77
73
|
const { Orchestrator, RFDBServerBackend } = require('@grafema/core');
|
|
@@ -84,20 +80,22 @@ const orchestrator = new Orchestrator({
|
|
|
84
80
|
|
|
85
81
|
## Features
|
|
86
82
|
|
|
87
|
-
- **
|
|
88
|
-
- **
|
|
89
|
-
- **
|
|
90
|
-
- **
|
|
91
|
-
- **
|
|
83
|
+
- **Adaptive tuning** — Auto-detects CPU cores, memory, and disk type; tunes write buffers, compaction parallelism, and prefetch strategy
|
|
84
|
+
- **Columnar storage** — Efficient storage for graph nodes and edges
|
|
85
|
+
- **Deterministic IDs** — BLAKE3 hash-based node identification
|
|
86
|
+
- **Zero-copy access** — Memory-mapped files for fast reads
|
|
87
|
+
- **BFS/DFS traversal** — Fast graph traversal algorithms
|
|
88
|
+
- **Parallel compaction** — Multi-threaded background compaction
|
|
92
89
|
|
|
93
90
|
## Protocol
|
|
94
91
|
|
|
95
92
|
RFDB server communicates via Unix socket using MessagePack-encoded messages. The protocol supports:
|
|
96
93
|
|
|
97
|
-
- `add_nodes` / `add_edges`
|
|
98
|
-
- `get_node` / `find_by_attr`
|
|
99
|
-
- `bfs` / `dfs`
|
|
100
|
-
- `flush` / `compact`
|
|
94
|
+
- `add_nodes` / `add_edges` — Batch insert operations
|
|
95
|
+
- `get_node` / `find_by_attr` — Query operations
|
|
96
|
+
- `bfs` / `dfs` — Graph traversal
|
|
97
|
+
- `flush` / `compact` — Persistence operations
|
|
98
|
+
- `compact_with_stats` — Compaction with statistics reporting
|
|
101
99
|
|
|
102
100
|
## Building from source
|
|
103
101
|
|
|
@@ -132,7 +130,7 @@ cargo bench --bench graph_operations -- --save-baseline my-baseline
|
|
|
132
130
|
cargo bench --bench graph_operations -- --baseline my-baseline
|
|
133
131
|
```
|
|
134
132
|
|
|
135
|
-
### Benchmark Coverage
|
|
133
|
+
### Benchmark Coverage (16 groups)
|
|
136
134
|
|
|
137
135
|
| Category | Operations |
|
|
138
136
|
|----------|-----------|
|
|
@@ -143,37 +141,34 @@ cargo bench --bench graph_operations -- --baseline my-baseline
|
|
|
143
141
|
| **Mutation** | delete_node, delete_edge |
|
|
144
142
|
| **Traversal** | bfs, reachability (forward/backward) |
|
|
145
143
|
| **Maintenance** | flush, compact |
|
|
144
|
+
| **Analysis** | reanalysis_cost, compaction |
|
|
145
|
+
|
|
146
|
+
### Additional Tools
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Memory profiling
|
|
150
|
+
cargo run --bin memory_profile
|
|
151
|
+
|
|
152
|
+
# Benchmark report generation
|
|
153
|
+
cargo run --bin bench_report
|
|
154
|
+
```
|
|
146
155
|
|
|
147
156
|
### CI Regression Detection
|
|
148
157
|
|
|
149
158
|
Benchmarks run on PRs with the `benchmark` label (comparing PR vs main branch).
|
|
150
159
|
Regressions >20% will fail the workflow.
|
|
151
160
|
|
|
152
|
-
To trigger on your PR: add the `benchmark` label.
|
|
153
|
-
|
|
154
161
|
### What to Do If Benchmarks Regress
|
|
155
162
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
1. **Check if it's noise** — re-run the workflow. CI runners have variable load; spurious regressions happen.
|
|
159
|
-
2. **Reproduce locally** — save baselines before/after your change and compare with `critcmp`:
|
|
163
|
+
1. **Check if it's noise** — re-run the workflow
|
|
164
|
+
2. **Reproduce locally** — save baselines before/after:
|
|
160
165
|
```bash
|
|
161
166
|
git stash && cargo bench --bench graph_operations -- --save-baseline before
|
|
162
167
|
git stash pop && cargo bench --bench graph_operations -- --save-baseline after
|
|
163
168
|
cargo install critcmp && critcmp before after
|
|
164
169
|
```
|
|
165
|
-
3. **Identify the cause** —
|
|
166
|
-
4. **Fix or justify** —
|
|
167
|
-
|
|
168
|
-
### Comparing Before/After Changes
|
|
169
|
-
|
|
170
|
-
```bash
|
|
171
|
-
# Before making changes
|
|
172
|
-
cargo bench --bench graph_operations -- --save-baseline before
|
|
173
|
-
|
|
174
|
-
# Make changes, then compare
|
|
175
|
-
cargo bench --bench graph_operations -- --baseline before
|
|
176
|
-
```
|
|
170
|
+
3. **Identify the cause** — `add_nodes` regression = storage overhead; `bfs`/`reachability` = traversal changes
|
|
171
|
+
4. **Fix or justify** — document trade-offs in PR description
|
|
177
172
|
|
|
178
173
|
## License
|
|
179
174
|
|