vocdoni-node icon indicating copy to clipboard operation
vocdoni-node copied to clipboard

bug: vochain is too heavy after refactor

Open p4u opened this issue 3 years ago • 3 comments

Describe the bug The Vochain stored on disk take too much space.

From a vochain only node (--mode=miner so without indexer/scrutinizer nor census service), in a testing blockchain with 3670 blocks mined, 182 processes and 6137000 votes.

Looking into directory dev/vochain/data we can see the following:

  • 5.1G blockstore/ (tendermint blockstore)
  • 994M cs.wal (tendermint wal file)
  • 217M state/ (tendermint state)
  • 11.9G *.sst files (badger files for vochain state)

Can we do something to reduce the disk space?

p4u avatar Oct 03 '21 17:10 p4u

@arnaucube any updates on this ?

jordipainan avatar Mar 03 '22 11:03 jordipainan

It's possible that this is a lot better now that we've removed badger and badgerhold.

mvdan avatar Feb 06 '23 10:02 mvdan

I don't think this has a real impact.

The actual problem is how Arbo is implemented and how it uses Pebble, since it stores all the intermediate states of the Statedb Tree, which is a nice feature for rolling back to any previous state but makes the blockchain store very heavy. I have had several conversations with Arnau regarding this issue, there are two options:

  1. Implement on Arbo an auto-pruning method to remove not use tree branches. It should be feasible on Add() but AddBatch() which parallelizes the writes to the tree, is much more complicated.
  2. Implement the pruning on the statedb layer. This means every N blocks, stop the block processing, build a snapshot of the current tree, remove the whole pebble datadir, create it from scratch and import the snapshot.

The second method is partially implemented, I started with the snapshot some months ago and its working. However we are still missing the import mechanism. This approach seems feasible, might took some seconds (even minutes if the blockchain is big), but it only needs to be executed once every month or so.

What's your thinking on this matter @mvdan, any input is welcome.

p4u avatar Feb 06 '23 10:02 p4u