Appendix : Debugging and Development Tools
← Back to SHAMap and NodeStore: Data Persistence and State Management
Introduction
This appendix provides techniques and tools for investigating SHAMap and NodeStore behavior.
Logging and Diagnostics
Enable Verbose Logging
Edit rippled.cfg:
[rpc_startup]
command = log_level
severity = debug
[logging]
debug
rpcThen restart rippled and check logs:
tail -f /var/log/rippled/rippled.log | grep -i nodestoreKey Log Messages
Metrics Inspection
JSON-RPC Inspection
File System Inspection
Debugging Specific Issues
Issue: Cache Hit Rate Too Low
Symptoms:
Database queries slow
Ledger close times increasing
Hit rate < 80%
Investigation:
Solutions:
Increase
cache_sizeif memory availableReduce
cache_agefor faster eviction of cold dataCheck if system is memory-constrained (use
free)
Issue: Write Performance Degradation
Symptoms:
Ledger closes slow (>10 seconds)
Database write errors in logs
Validator falling behind network
Investigation:
Solutions:
Ensure SSD (not HDD) for database
Check disk I/O isn't saturated
Increase
async_threadsif I/O boundSwitch to faster backend (NuDB vs RocksDB)
Enable compression if disk is bottleneck
Issue: Synchronization Slow
Symptoms:
New nodes take hours to sync
Falling behind network
High database query count
Investigation:
Solutions:
Increase cache size for better hit rate during sync
Increase
async_threads(more parallel fetches)Use faster SSD
Check network bandwidth (might be bottleneck)
Switch to NuDB for higher throughput
Code Debugging
Building with Debug Symbols
GDB Debugging
Common Breakpoints
Print Useful Data
Performance Profiling
CPU Profiling with Perf
Memory Profiling with Valgrind
Custom Instrumentation
Add to rippled source:
Test-Driven Debugging
Running Unit Tests
Writing Debug Tests
Useful Commands
Check Configuration
Monitor in Real Time
Database Inspection
For RocksDB:
Log Analysis
Performance Regression Testing
Benchmark Before/After
Load Testing
Common Issues and Solutions
High cache miss rate
Cache metrics
Increase cache_size
Slow sync
Fetch latency
Increase async_threads
Disk full
df -h
Enable online_delete
Memory leak
Valgrind
Fix code (likely nodes not freed)
Hang on startup
strace
Check database corruption
Consensus failing
Logs for validation errors
Check NodeStore consistency
See Appendix A for codebase navigation to find files mentioned here.
Last updated

