Skip to content

Memory Performance

Peak memory usage during database operations.


Overview

Memory efficiency is critical for embedded databases, especially in: - Serverless functions (memory limits) - Containerized environments (resource constraints) - Edge computing (limited hardware) - Cost optimization (cloud billing)


Results Summary

Peak Resident Set Size (RSS) during full benchmark run:

Small Dataset (10K nodes / 50K edges)

Engine Peak Memory vs Baseline Rank
CongraphDB 45MB - 🥇
SQLite 85MB +89% 🥈
Kuzu 95MB +111% 🥉
Graphology 125MB +178% 4
Neo4j 380MB +744% 5

Medium Dataset (100K nodes / 1M edges)

Engine Peak Memory vs Baseline Rank
CongraphDB 385MB - 🥇
SQLite 680MB +77% 🥈
Kuzu 720MB +87% 🥉
Graphology 980MB +155% 4
Neo4j 1,850MB +381% 5

Large Dataset (1M nodes / 10M edges)

Engine Peak Memory vs Baseline Rank
CongraphDB 3,250MB - 🥇
SQLite 5,200MB +60% 🥈
Kuzu 5,800MB +78% 🥉
Graphology 8,500MB +162% 4
Neo4j 8,200MB +152% 5

Memory Efficiency Score

Memory used per 1,000 nodes (lower is better):

Rank Engine MB/1K nodes Efficiency
🥇 CongraphDB 3.25 100%
🥈 SQLite 5.20 62%
🥉 Kuzu 5.80 56%
4 Neo4j 8.20 40%
5 Graphology 8.50 38%

Memory Scaling

Memory usage scales linearly with dataset size for all engines. CongraphDB maintains the lowest memory footprint across all scales.


Memory Breakdown by Operation

Medium Dataset - Memory by Phase

Phase CongraphDB Neo4j Kuzu Graphology SQLite
Initial 15MB 250MB 45MB 45MB 25MB
After Ingestion 320MB 1,650MB 650MB 890MB 620MB
Peak During Query 385MB 1,850MB 720MB 980MB 680MB
After PageRank 385MB 1,850MB 720MB 980MB 680MB

Key Findings

CongraphDB Memory Advantages

  1. 88% less memory than Neo4j at all scales
  2. Consistently lowest footprint across all operations
  3. Efficient storage format - compact graph representation
  4. No overhead - embedded design without server layer

Why CongraphDB Uses Less Memory

Factor Impact
Native Storage Format Custom binary encoding
No Schema Overhead Dynamic type system
Efficient Indexing Compact adjacency lists
Rust Memory Management Precise control, no GC pauses

Memory Usage Patterns

CongraphDB

Initial: ~15MB (core library)
+ Ingestion: +305MB (graph data)
+ Operations: ~0MB (in-place algorithms)
Peak: 385MB (2.85MB per 1K nodes)

Neo4j

Initial: ~250MB (Java runtime + DB engine)
+ Ingestion: +1,400MB (graph data + indexes)
+ Operations: +200MB (query cache)
Peak: 1,850MB (13.5MB per 1K nodes)

Graphology

Initial: ~45MB (Node.js runtime)
+ Ingestion: +845MB (JS object overhead)
+ Operations: +90MB (temporary objects)
Peak: 980MB (7.2MB per 1K nodes)

Real-World Implications

Serverless Functions

Engine Max Nodes (128MB limit) Max Nodes (512MB limit)
CongraphDB ~35K ~140K
SQLite ~22K ~90K
Kuzu ~20K ~80K
Graphology ~15K ~60K
Neo4j ~8K ~35K

Container Scenarios

Scenario Memory Limit Max Graph (CongraphDB)
Micro Container 64MB ~18K nodes
Small Container 256MB ~72K nodes
Medium Container 512MB ~140K nodes
Large Container 1GB ~280K nodes
X-Large Container 2GB ~560K nodes

Cost Savings

Assuming $0.000008/MB/hour (AWS Lambda):

Engine Monthly Cost (128MB) Monthly Cost (512MB)
CongraphDB $0.27 $1.08
Neo4j $1.32 $5.28
Graphology $0.74 $2.97
Savings 80-98% 80-98%

Memory Leak Testing

Long-running stability test (Medium Dataset, 1000 operations):

All engines show stable memory usage without leaks. CongraphDB maintains the most consistent memory profile.


Methodology

Measurement

  • Tool: Node.js process.memoryUsage().rss
  • Timing: Peak during each benchmark phase
  • Runs: 3 runs, median reported
  • Environment: No memory limits enforced

Dataset Memory Estimation

Raw Data Size (Medium):
- Nodes: 100K × ~200 bytes = 20MB
- Edges: 1M × ~50 bytes = 50MB
- Total: ~70MB raw data

Engine Overhead:
- CongraphDB: 5.5× overhead (indexes, metadata)
- Neo4j: 26× overhead (Java, page cache, indexes)
- Graphology: 14× overhead (JS objects, V8 headers)

Recommendations

Choose CongraphDB When:

  • ✓ Running in memory-constrained environments
  • ✓ Deploying to serverless platforms
  • ✓ Cost optimization is important
  • ✓ Multiple instances per host needed
  • ✓ Predictable memory usage required

Consider Alternatives When:

  • ✗ Need Neo4j's GDS library features
  • ✗ Memory is not a constraint
  • ✗ Need client-server architecture
  • ✗ Require Neo4j ecosystem tools