NeblioTeam / neblio

Neblio Daemon & Wallet
MIT License
121 stars 46 forks source link

Investigate whether repeated calls to lsn_reset from CheckpointLSN are necessary with BDB #314

Open nebliodev opened 3 years ago

nebliodev commented 3 years ago

Today we frequently flush changes of the wallet db to disk. Doing so by calling lsn_reset will write the entire wallet file contents to disk, no matter the size of the changes. Doing so repeatedly may be unnecessary and with huge wallet files could impact performance. We should investigate whether these lsn_resets can be removed or called less frequently.

Context: https://github.com/bitcoin/bitcoin/issues/7475 https://github.com/gridcoin-community/Gridcoin-Research/pull/1010

nebliodev commented 3 years ago

Since we are improving efficiency for devices such as the Raspberry Pi in 3.3.0, we should investigate this issue as well, as these excessive writes could certainly cause SD card wear. If we can remove them or make the writes less frequent, we should.

TheQuantumPhysicist commented 3 years ago

On one hand, yes, the whole wallet is written on disk. On the other hand, the wallet is only written if there's a change in it. I don't think this is an issue except for huge wallets that stake a lot. No way around it.

But about 3.3.0, yes, there will be tremendous amount of writes and reads to disk through LMDB. No way around that except establishng a real LRU cache that stands between the DB and the wallet that only writes at a rate we specify.

nebliodev commented 3 years ago

Moving this out of v3.3.0 as this needs more investigation.