rippled icon indicating copy to clipboard operation
rippled copied to clipboard

Add configurable NuDB block size feature

Open treeol opened this issue 5 months ago • 1 comments

High Level Overview of Change

This PR implements configurable NuDB block size support in rippled, allowing operators to optimize storage performance based on their hardware configuration. The feature adds a new nudb_block_size configuration parameter that enables block sizes from 4K to 32K bytes, with comprehensive validation and backward compatibility.

Solution to Issue: https://github.com/XRPLF/rippled/issues/5361

Context of Change

As XRPL network demand grows and ledger sizes increase, the default 4K NuDB block size becomes a performance bottleneck, especially on high-performance storage systems. Modern SSDs and enterprise storage often perform better with larger block sizes, but rippled previously had no way to configure this parameter.

Performance Impact Demonstrated:

  • Eliminated transaction queue overflows (0 vs 958 overflows) (tested with a 1y old validator vs. new one)
  • Improved system stability with minimal state transitions

FIO Benchmarks:

  • Writes 16K recordsize

RANDOM WRITE: bw=3738MiB/s (3920MB/s), 3738MiB/s-3738MiB/s (3920MB/s-3920MB/s), io=110GiB (118GB), run=30001-30001msec

Seq. WRITE: bw=6371MiB/s (6681MB/s), 6371MiB/s-6371MiB/s (6681MB/s-6681MB/s), io=128GiB (137GB), run=20573-20573msec

  • Writes 4K recordsize

RANDOM WRITE: bw=1038MiB/s (1089MB/s), 1038MiB/s-1038MiB/s (1089MB/s-1089MB/s), io=30.4GiB (32.7GB), run=30002-30002msec

Seq. WRITE: bw=1683MiB/s (1765MB/s), 1683MiB/s-1683MiB/s (1765MB/s-1765MB/s), io=49.3GiB (53.0GB), run=30001-30001msec

Full report: ZFS-16-4-K-Fio-Bench.txt

Type of Change

☑️ New feature (non-breaking change which adds functionality)
☑️ Performance (increase in throughput and/or latency)
☑️ Documentation update

API Impact

☑️ libxrpl change (any change that may affect libxrpl or dependents of libxrpl)

Implementation Details

Code Changes:

  • Added parseBlockSize() function with robust validation (power of 2, 4K-32K range)
  • New configuration parameter: nudb_block_size in [node_db] section
  • Comprehensive error handling with informative log messages
  • Backward compatibility maintained (defaults to 4K if not specified)
  • Updated documentation in rippled-example.cfg with usage guidelines

Configuration Example:

[node_db]
type=NuDB
path=/var/lib/rippled/db/nudb
nudb_block_size=16384  # 16K blocks for high-performance systems

Validation Rules:

  • Must be power of 2 between 4096 and 32768 bytes
  • Invalid values fall back to 4096 with warning logs
  • Startup logging confirms active block size

Performance Recommendations:

  • 4096: Default, balanced performance
  • 8192: Good compromise for most systems
  • 16384: Optimal for high-performance validators
  • 32768: Maximum performance on enterprise SSDs / Storage Clusters

This enhancement enables rippled operators to optimize their node performance based on specific hardware capabilities while maintaining full backward compatibility.

treeol avatar Jun 03 '25 16:06 treeol