Test Date: December 12, 2025
Test Duration: 73 minutes (4,409 seconds)
Import File: wot_reference.jsonl (2.7 GB, 2,158,366 events)
| Parameter | Value |
|---|---|
| Database Backend | Neo4j 5-community (Docker) |
| Target Memory | 1,500 MB (relay process) |
| Emergency Threshold | 1,167 (target + 1/6) |
| Recovery Threshold | 833 (target - 1/6) |
| Max Write Delay | 1,000 ms (normal), 5,000 ms (emergency) |
| Neo4j Memory Limits | Heap: 512MB-1GB, Page Cache: 512MB |
| Component | Metric | Value |
|---|---|---|
| Relay Process | Peak RSS (VmHWM) | 148 MB |
| Relay Process | Final RSS | 35 MB |
| Neo4j Container | Memory Usage | 1.614 GB |
| Neo4j Container | Memory % | 10.83% of 14.91GB |
| Rate Limiting | Events Triggered | 0 |
Unlike Badger (embedded database), Neo4j runs as a separate process in a Docker container. This means:
This is architecturally correct - the relay doesn't need memory-based rate limiting for Neo4j because it's not holding the data in process.
| Event Type | Count | Rate |
|---|---|---|
| Contact Lists (kind 3) | 174,836 | 40 events/sec |
| Mute Lists (kind 10000) | 4,027 | 0.9 events/sec |
| Total Social Events | 178,863 | 41 events/sec |
| Metric | Value |
|---|---|
| CPU Usage | 40-45% |
| Memory | Stable at 1.6GB |
| Disk Writes | 12.7 GB |
| Network In | 1.8 GB |
| Network Out | 583 MB |
| Process Count | 77-82 |
Time Contact Lists Delta/min Neo4j Memory
------ ------------- --------- ------------
08:28 0 - 1.57 GB
08:47 31,257 ~2,100 1.61 GB
08:52 42,403 ~2,200 1.61 GB
09:02 67,581 ~2,500 1.61 GB
09:12 97,316 ~3,000 1.60 GB
09:22 112,681 ~3,100 1.61 GB
09:27 163,252 ~10,000* 1.61 GB
09:41 174,836 ~2,400 1.61 GB
*Spike may be due to batch processing of cached events
Neo4j's memory usage remained remarkably stable throughout the test:
Sample Memory Delta
-------- -------- -----
08:47 1.605 GB -
09:02 1.611 GB +6 MB
09:12 1.603 GB -8 MB
09:27 1.607 GB +4 MB
09:41 1.614 GB +7 MB
Variance: < 15 MB over 73 minutes - excellent stability.
| Aspect | Badger | Neo4j |
|---|---|---|
| Database Type | Embedded | External (Docker) |
| Memory Consumer | Relay process | Container process |
| Rate Limiter Target | Relay RSS | Relay RSS |
| Rate Limiting Effectiveness | High | Low* |
| Compaction Triggering | Yes | N/A |
| Emergency Mode | Yes | Not triggered |
*The current rate limiter design targets relay process memory, which doesn't reflect Neo4j's actual resource usage.
The current implementation monitors relay process memory, but for Neo4j this should be enhanced to monitor:
The Neo4j monitor already tracks query latency via RecordQueryLatency() and RecordWriteLatency(), using EMA smoothing. Latency > 500ms increases reported load.
The querySem semaphore limits concurrent queries (default 10). When full, the load metric increases.
Consider monitoring Neo4j container metrics via:
The Neo4j import test demonstrated:
Recommendation: The Neo4j rate limiter is correctly implemented but relies on latency and concurrency metrics rather than memory pressure. For production deployments with Neo4j, configure appropriate Neo4j memory limits in the container (heapinitial, heapmax, pagecache) rather than relying on relay-side rate limiting.
- Heap Initial: 512MB - Heap Max: 1GB - Page Cache: 512MB