nimbus-eth1/nimbus
Jacek Sieka f034af422a
Pre-allocate vids for branches (#2882)
Each branch node may have up to 16 sub-items - currently, these are
given VertexID based when they are first needed leading to a
mostly-random order of vertexid for each subitem.

Here, we pre-allocate all 16 vertex ids such that when a branch subitem
is filled, it already has a vertexid waiting for it. This brings several
important benefits:

* subitems are sorted and "close" in their id sequencing - this means
that when rocksdb stores them, they are likely to end up in the same
data block thus improving read efficiency
* because the ids are consequtive, we can store just the starting id and
a bitmap representing which subitems are in use - this reduces disk
space usage for branches allowing more of them fit into a single disk
read, further improving disk read and caching performance - disk usage
at block 18M is down from 84 to 78gb!
* the in-memory footprint of VertexRef reduced allowing more instances
to fit into caches and less memory to be used overall.

Because of the increased locality of reference, it turns out that we no
longer need to iterate over the entire database to efficiently generate
the hash key database because the normal computation is now faster -
this significantly benefits "live" chain processing as well where each
dirtied key must be accompanied by a read of all branch subitems next to
it - most of the performance benefit in this branch comes from this
locality-of-reference improvement.

On a sample resync, there's already ~20% improvement with later blocks
seeing increasing benefit (because the trie is deeper in later blocks
leading to more benefit from branch read perf improvements)

```
blocks: 18729664, baseline: 190h43m49s, contender: 153h59m0s
Time (total): -36h44m48s, -19.27%
```

Note: clients need to be resynced as the PR changes the on-disk format

R.I.P. little bloom filter - your life in the repo was short but
valuable
2024-12-04 11:42:04 +01:00
..
beacon Bump nim-web3 to c8f36f59cb354196cfe117b6866e81d450c8cfd7 (#2878) 2024-11-27 20:16:31 +07:00
common Revert "Adopt latest changes to requests hash computation" (#2892) 2024-11-29 16:13:08 +07:00
core Add desc validator to fc unit tests (#2899) 2024-12-02 17:49:53 +00:00
db Pre-allocate vids for branches (#2882) 2024-12-04 11:42:04 +01:00
evm Speed up evm stack (#2881) 2024-11-30 10:07:10 +01:00
graphql Cleanup db/core_apps error handling (#2838) 2024-11-07 08:24:21 +07:00
rpc Bump nim-web3 to c8f36f59cb354196cfe117b6866e81d450c8cfd7 (#2878) 2024-11-27 20:16:31 +07:00
stateless replace deprecated types (#2704) 2024-10-16 08:34:12 +07:00
sync Fc module various base tree admin updates (#2895) 2024-12-02 08:25:58 +00:00
transaction Speed up evm stack (#2881) 2024-11-30 10:07:10 +01:00
utils Revert "Adopt latest changes to requests hash computation" (#2892) 2024-11-29 16:13:08 +07:00
common.nim implement better hardfork management 2022-12-02 13:51:42 +07:00
compile_info.nim Simplify LedgerRef: remove unnecessary abstraction (#2826) 2024-11-06 09:01:56 +07:00
config.nim Fix simulator RPC object: add fields from latest spec (#2859) 2024-11-21 21:58:12 +07:00
constants.nim Fixes related to Prague execution requests (#2847) 2024-11-08 10:47:07 +07:00
errors.nim Remove EVM indirect imports and unused EVM errors (#2370) 2024-06-17 09:56:39 +02:00
makefile Snap sync fix trie interpolation fringe condition (#1457) 2023-02-01 18:56:06 +00:00
nim.cfg import: read from era files (#2254) 2024-05-31 09:13:56 +02:00
nimbus_desc.nim Suppress beacon sync unless potential actions (#2765) 2024-10-21 18:01:45 +00:00
nimbus_execution_client.nim Feature: Prevent loading an existing data directory for the wrong network (#2825) 2024-11-06 09:01:42 +07:00
nimbus_import.nim fix: show correct blockNumber and log in end of era files (#2691) 2024-10-04 01:37:50 +00:00
rpc.nim Port p2p to server API (#2769) 2024-11-02 10:30:45 +01:00
tracer.nim Simplify state root api (#2864) 2024-11-22 14:15:35 +01:00
transaction.nim Unify tx validation (#2777) 2024-10-26 09:19:48 +02:00
version.nim Feature: User configurable extraData when assemble a block (#2823) 2024-11-06 09:01:25 +07:00