Welcome to the next crypto level
← Nexorena

Ethereum

Nethermind adapts new state database layouts to available memory

The Ethereum client’s main branch adopts automatic layout selection for new flat state databases. Below 16 GiB of memory available to .NET, it favors FlatInTrie, with an exception for flat history.

Nexorena Editorial Team

Nethermind adapts new state database layouts to available memory

The choice comes before RocksDB opens

On November 8, Nethermind changed the default setting for flat state databases on its Ethereum client’s main branch. The FlatDb.Layout setting moves from Flat to Auto. The change concerns the choice of storage layout when this type of database is enabled. The client must resolve that choice before opening RocksDB, because the opening options depend on the chosen layout. The commit therefore introduces a startup step separate from opening the database and reading its internal metadata.

For a new enabled database without flat history, the code chooses FlatInTrie when memory available to .NET is below 16 GiB. At or above that threshold, it chooses Flat. The threshold applies to memory as seen by the runtime, which matters in a container. The configuration description says .NET uses 75% of the container’s memory limit as its reference there. With flat history enabled, a new database uses Flat even below the threshold.

A marker preserves the layout on restart

After resolving the layout, Nethermind records it in the layout.marker file in the database directory. The client synchronizes a temporary file write to disk and then renames the file. The goal is for an interruption to leave either a complete marker or no marker. On subsequent starts in Auto mode, the client reads this file before reconsidering memory. A container limit change can therefore affect the decision for a future database, while a database with a marker retains the layout recorded on disk.

The patch also handles databases created before Auto mode arrived. Without a marker, the presence of data selects Flat, the old default. The code recognizes a RocksDB table file or a nonempty write-ahead log, including when the first data has yet to be transferred to a table file. An empty log is insufficient to treat a database that was opened but never written to as an existing database. A marker with unrecognized contents triggers a configuration error.

Configuration exceptions to check

Operators who already specify an explicit layout retain their choice. When the flat state database is disabled, the client creates no marker. The tests added to the repository cover both cases, along with preserving a recorded layout after a memory change, handling older files, and the history exception. For teams preparing a new node, these cases show which settings to check together before the first startup.

The change is documented in a November 8 commit on the main branch. It describes the client’s configuration behavior and local storage. It sets neither a date for availability in a distributed release nor a change to the Ethereum protocol. The repository provides layout selection tests without quantifying how the decision affects memory use or synchronization time for a production node.

Written with love byEthan BrooksMeet this editorial pen name ↗

Explorer Nexorena