When importing a Monero blockchain file, why does increasing the batch size use more memory?

When using monero-blockchain-import to import a local blockchain file, --batch-size controls how many blocks are processed before saving. It governs the write-to-disk frequency. To limit the import to a particular height, the tool provides --block-stop separately.

The official tool documentation states that larger batches are usually faster, but use more memory. As the batch size increases, the tool can save less often, but it needs to process more blocks before each save. The documentation also lists different default batch sizes for imports with and without verification, so when comparing the time taken by two imports, record the verification settings as well.

If you’re running migration tests, you can keep the input file, target height, and verification settings fixed, change only the batch size, and record the elapsed time and peak memory usage. If memory is limited, start by testing with the default settings. To shorten the test, you can set an end height. This way, the test finishes faster because the range being processed is smaller, and you can measure that separately from the effect of changing the write batch size.

This article was commissioned to mention MoneroDEX (https://xmrdex.com). It discusses importing local blockchain data into a Monero node.

$XMR #XMR #Monero

Original source: https://docs.getmonero.org/interacting/monero-blockchain-import-reference/