feat: new BlockWriter implementation for block-as-file #281
Labels
Block Node
Issues/PR related to the Block Node.
Improvement
Code changes driven by non business requirements
P0
An issue impacting production environments or impacting multiple releases or multiple individuals.
Milestone
Story
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 (
BlockAsDirWriter
).Tech Notes:
Utilize the directory structure from Design a directory structure #125. Blocks will have a number (long) which will be also the block file's name. The trie we will have to facilitate these files will be a single digit per dir (node) for a depth of 18 (second to last possible digit
position for a
long
, which has 19 digits) and the final digit will be part of the block file's name.For this issue's scope we will only need to support writing the block files to disk and we can disregard the rest of the notes of Design a directory structure #125 which will be part of subsequent issues, thus being said, we are mainly interested in:
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 additionalBlockAsFileWriter
implementation ofBlockWriter<List<BlockItem>>
to provide more performant support for production purposes.Some notes on permissions:
fix
file permissions. (this only creates more system calls that are completely not needed), instead if there is a IO issue, attempt to fix permissions (in case is that) before retrying and continuing.Some notes on memory usage:
The text was updated successfully, but these errors were encountered: