Performance
Optimize Mnemosyne for your workload.
Benchmarks
All benchmarks run on a single core, SQLite with sqlite-vec:
| Metric | 1K Entries | 10K Entries | 100K Entries |
|---|---|---|---|
| Write | 12ms | 15ms | 18ms |
| Vector search | 15ms | 35ms | 85ms |
| Hybrid search | 45ms | 65ms | 150ms |
| FTS5 search | 5ms | 8ms | 20ms |
| Consolidation | 2s | 5s | 25s |
Optimization Strategies
1. Batch Writes
# Bad: Individual writes (separate transactions)
for item in items:
mem.remember(item)
# Good: Batch via remember_batch
mem.beam.remember_batch([
{"content": item, "source": "batch", "importance": 0.5}
for item in items
])
2. Enable WAL Mode
SQLite WAL mode improves concurrent read/write performance. Enable it manually on your database file:
sqlite3 ~/.hermes/mnemosyne/data/mnemosyne.db "PRAGMA journal_mode=WAL;"
3. Embedding Caching
Mnemosyne automatically caches embedding queries via LRU cache (512 entries). Repeated queries in agent loops are near-instant. No configuration needed.
4. Working Memory Limits
Keep Working Memory lean. The default maximum is 10,000 entries, controlled via environment variable:
export MNEMOSYNE_WM_MAX_ITEMS=5000 # Lower limit for faster queries
export MNEMOSYNE_WM_TTL_HOURS=12 # Shorter TTL for more aggressive eviction
5. Regular Consolidation
Run consolidation periodically to promote working memories to episodic and maintain query performance:
# Standalone CLI
mnemosyne sleep
# Or programmatically
mem.sleep()
Memory Usage
| Component | Per Entry | 10K Entries |
|---|---|---|
| Working Memory | 48 bytes | ~480KB |
| Episodic Memory | ~2KB | ~20MB |
| Vector Index | ~6KB | ~60MB |
| FTS5 Index | ~2KB | ~20MB |
SSD Recommended
SQLite performance is heavily I/O bound. Use SSD storage for production deployments. HDD is acceptable for development but will show 5-10x slower query times.
Related Pages
Monitoring
Set up monitoring for Mnemosyne: health endpoints, Prometheus metrics, memory usage stats, query lat...
Ranking & Relevance
Learn how Mnemosyne scores and ranks retrieved memories using recency weighting, relevance scoring, ...
Configuration
Configure Mnemosyne with environment variables, config files, and runtime options. Covers database p...
Mnemosyne