* eth: bump Speed up basic operations like hashing and creating RLP:s - up to 25% improvement in certain block ranges! ``` 876729c.csv /data/nimbus_stats/stats-20240605_2204-ed4f6221.csv stats-20240605_2000-c876729c.csv vs stats-20240605_2204-ed4f6221.csv bps_x bps_y tps_x tps_y bpsd tpsd timed block_number (500001, 888889] 1,017.72 996.07 1,784.96 1742.438676 -2.72% -2.72% 3.31% (888889, 1277778] 528.00 536.30 2,159.79 2198.781046 1.69% 1.69% -1.44% (1277778, 1666667] 324.29 317.78 2,064.48 2008.106377 -2.82% -2.82% 3.33% (1666667, 2055556] 253.87 258.74 1,840.94 1872.935273 1.67% 1.67% -1.39% (2055556, 2444445] 175.79 178.66 1,340.61 1363.248939 0.93% 0.93% -0.74% (2444445, 2833334] 137.27 159.74 958.75 1113.323757 14.24% 14.24% -10.69% (2833334, 3222223] 170.48 228.63 1,272.70 1704.047195 34.41% 34.41% -25.17% (3222223, 3611112] 127.49 125.48 1,572.39 1548.835791 -1.19% -1.19% 1.47% (3611112, 4000001] 37.25 40.42 1,100.65 1184.740493 9.58% 9.58% -7.04% blocks: 3501696, baseline: 11h59m40s, contender: 11h21m38s bpsd (mean): 6.18% tpsd (mean): 6.18% Time (sum): -38m1s, -4.26% bpsd = blocks per sec diff (+), tpsd = txs per sec diff, timed = time to process diff (-) + = more is better, - = less is better ``` * ignore gitignore
Nimbus-eth1 -- Ethereum execution layer database architecture
Last update: 2024-03-08
The following diagram gives a simplified view how components relate with regards to the data storage management.
An arrow between components a and b (as in a->b) is meant to be read as a relies directly on b, or a is served by b. For classifying the functional type of a component in the below diagram, the abstraction type is enclosed in brackets after the name of a component.
-
(application)
This is a group of software modules at the top level of the hierarchy. In the diagram below, the EVM is used as an example. Another application might be the RPC service. -
(API)
The API classification is used for a thin software layer hiding a set of different drivers where only one driver is active for the same API instance. It servers as sort of a logical switch. -
(concentrator)
The concentrator merges several sub-module instances and provides their collected services as a single unified instance. There is not much additional logic implemented besides what the sub-modules provide. -
(driver)
The driver instances are sort of the lower layer workhorses. The implement logic for solving a particular problem, providing a typically well defined service, etc. -
(engine)
This is a bottom level driver in the below diagram.+-------------------+ | EVM (application) | +-------------------+ | | v | +-----------------------------+ | | State DB (concentrator) | | +-----------------------------+ | | | | v | | +------------------------+ | | | Ledger (API) | | | +------------------------+ | | | | | | v | | | +--------------+ | | | | ledger cache | | | | | (driver) | | | | +--------------+ | | | | v | | | +----------------+ | | | | Common | | | | | (concentrator) | | | | +----------------+ | | | | | | v v v v +---------------------------------------+ | Core DB (API) | +---------------------------------------+ | v +---------------------------------------+ | Aristo DB (driver,concentrator) | +---------------------------------------+ | | v v +--------------+ +---------------------+ | Kvt (driver) | | Aristo MPT (driver) | +--------------+ +---------------------+ | | v v +---------------------------------------+ | Rocks DB (engine) | +---------------------------------------+
Here is a list of path references for the components with some explanation. The sources for the components are not always complete but indicate the main locations where to start looking at.
-
-
Sources:
./nimbus/db/core_db/backend/aristo_* -
Synopsis:
Combines both, the Kvt and the Aristo driver sub-modules providing an interface similar to the legacy DB (concentrator) module.
-
-
-
Sources:
./nimbus/db/aristo* -
Synopsis:
Revamped implementation of a hexary Merkle Patricia Tree.
-
-
-
Sources:
./nimbus/common* -
Synopsis:
Collected information for running block chain execution layer applications.
-
-
-
Sources:
./nimbus/db/core_db* -
Synopsis:
Database abstraction layer. Unless for legacy applications, there should be no need to reach out to the layers below.
-
-
-
Sources:
./nimbus/core/executor/* ./nimbus/evm/* -
Synopsis:
An implementation of the Ethereum Virtual Machine.
-
-
-
Sources:
./vendor/nim-eth/eth/trie/hexary.nim -
Synopsis:
Implementation of an MPT, see compact Merkle Patricia Tree.
-
-
-
Sources:
./vendor/nim-eth/eth/trie/db.nim -
Synopsis:
Key value table interface to be used directly for key-value storage or by the Hexary DB (driver) module for storage. Some magic is applied in order to treat hexary data accordingly (based on key length.)
-
-
-
Sources:
./nimbus/db/kvt* -
Synopsis:
Key value table interface for the Aristo DB (driver) module. Contrary to the Key-value table (driver), it is not used for MPT data.
-
-
-
Sources:
./nimbus/db/ledger* -
Synopsis:
Abstraction layer for either the legacy cache (driver) accounts cache (which works with the legacy DB (driver) backend only) or the ledger cache (driver) re-write which is supposed to work with all Core DB (API) backends.
-
-
-
Sources:
./nimbus/db/ledger/accounts_ledger.nim
./nimbus/db/ledger/backend/accounts_ledger*
./nimbus/db/ledger/distinct_ledgers.nim -
Synopsis:
Management of accounts and storage data. This is a re-write of the legacy DB (driver) which is supposed to work with all Core DB (API) backends.
-
-
-
Sources:
./nimbus/db/core_db/backend/legacy_* -
Synopsis:
Legacy database abstraction. It mostly forwards requests directly to the to the Key-value table (driver) and/or the hexary DB (driver).
-
-
-
Sources:
./vendor/nim-rocksdb/* -
Synopsis:
Persistent storage engine.
-
-
-
Sources:
./nimbus/evm/state.nim
./nimbus/evm/types.nim -
Synopsis:
Integrated collection of modules and methods relevant for the EVM.
-