EOSIO / eos

An open source smart contract platform
https://developers.eos.io/manuals/eos
MIT License
11.27k stars 3.76k forks source link

Support database-map-mode = tmpfs #10517

Open matthewdarwin opened 3 years ago

matthewdarwin commented 3 years ago

EOSIO chains which have a lot of state change activity need a lot of RAM and takes a long time to start/stop (database-map-mode = heap); or they use a lot of disk I/O (database-map-mode = mapped).

There is a hybrid solution documented here where statedb is kept on tmpfs. https://cc32d9.medium.com/wax-blockchain-node-performance-challenges-c5c7a10cad

Maybe there is some opportunity to include this sort of functionality OOB. The long term solution is probably RocksDB, but the performance is not yet acceptable (see https://github.com/EOSIO/eos/issues/10408)

spoonincode commented 3 years ago

A mode such as this seems tricky to explain to users: when using this mode and stopping nodeos cleanly, shutting down the box will still lose state. Unless the user performs some other manual action to persist state (doing it automatically is literally heap mode). So maybe a nodeos -d datadir --backup-the-tmpfs-state-to-disk whenever the user wants to persist to disk after using this mode? Any other reasonable options?

Personally, I would rather see improvements to "heap" mode, such as quick start/stop (sub 5s I guess) and elimination of the environment check & pinned builds.

matthewdarwin commented 3 years ago

Speed improvements on "heap" mode are definitely desirable. Maybe needs a --yes-i-know-what-im-doing-ignore-checks-flag. LOL.

matthewdarwin commented 3 years ago

There are times where you care about saving the state when nodeos stops, there are other times where you don't (ie start from snapshot is fine). So making it optional to save state would be cool to save on disk i/o.