Description
Currently all ChainStore
queries such as get_block_header
, get_block_hash_by_height
, get_block_height
, get_block_header_on_chain_by_height
and so on go straight to rocksdb.
In practice most of the queries will involve just a couple dozen most recent heights1, so in theory it should be possible to improve certain workloads significantly. If ChainStore
maintained deserialized data for these recent blocks in warm memory, these queries could avoid a trip through the rocksdb layers (all the way to its block cache,) deserialization overhead, etc.
A particular workload where such queries appear to have a significant overhead is a native token transfer benchmark with a lower number of accounts. A profile of such a workload can be seen here.
Footnotes
-
verify this theory! both in a benchmark and a real node -- I imagine we could log how far behind
HEAD
queries reach to for each query and then plot a frequency graph. My intuition is that it should take a shape of a normal distribution bell. ↩