hashgraph / hedera-block-node

New Block Node services
Apache License 2.0
21 stars 2 forks source link

New BlockWriter Implementation for Block as File #281

Open AlfredoG87 opened 1 week ago

AlfredoG87 commented 1 week ago

As a Block Node Operator I want to reduce the number of system calls needed to persist a single block So that I can minimize operating costs.

This task is to change block persistence to persist the blocks as whole files rather than directories of files per item.

Notes:

Currently we have a interface BlockWriter<V> that is writing block items as files inside a directory with the number of the block, this causes multiple (potentially) thousands of system calls per block, slowing down the whole system (does it? Are system calls actually expensive or are we just assuming they are?).

Current and only implementation BlockAsDirWriter was meant to support development and help on debugging by making it easy to see the block items as they are arriving, however due to the high TPS needed for the system, we want to create an additional BlockAsFileWriter implementation of BlockWriter<List<BlockItem>> to provide more performant support for production purposes.

Considerations:

AlfredoG87 commented 1 week ago

@ata-nas. can you consider this comment as part of this ticket? https://github.com/hashgraph/hedera-block-node/pull/269#discussion_r1811171683