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
rpc

Then restart rippled and check logs:

tail -f /var/log/rippled/rippled.log | grep -i nodestore

Key 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:

  1. Increase cache_size if memory available

  2. Reduce cache_age for faster eviction of cold data

  3. Check 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:

  1. Ensure SSD (not HDD) for database

  2. Check disk I/O isn't saturated

  3. Increase async_threads if I/O bound

  4. Switch to faster backend (NuDB vs RocksDB)

  5. 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:

  1. Increase cache size for better hit rate during sync

  2. Increase async_threads (more parallel fetches)

  3. Use faster SSD

  4. Check network bandwidth (might be bottleneck)

  5. Switch to NuDB for higher throughput

Code Debugging

Building with Debug Symbols

GDB Debugging

Common Breakpoints

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

Issue
Investigation
Solution

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