Skip to content

v0.44.3x-osmo-v5.1 - Fast storage (IAVL upgrade)

Compare
Choose a tag to compare
@p0mvn p0mvn released this 11 Feb 19:03
· 4 commits to v0.44.3x-osmo-v5 since this release
cfeeeb1

Background
Historically IAVL has had a very slow performance during state machine execution, and for responding to queries to live state. This release speeds up these routines by an order of magnitude, alleviating large amounts of pressure from all users of the IAVL database.

Details

This release introduces an auxiliary fast storage system to IAVL, which represents a copy of the latest state much more amenable to efficient querying and iteration.

Prior to this release, all data gets & iterations suffered two significant performance drawdowns:

  • Every get/iteration is forced to walk the tree structure
  • Every node (including leaves) is stored on disk, with its key being a SHA256 hash of something. Leaves were Hash(logical key), internal nodes were indexed by their Merkle tree inner node hash as well. This breaks data locality and makes every get that should be in RAM / CPU caches instead be a random leveldb file open.

The fast storage nodes are instead indexed by the logical key on the disk. This allows us to preserve data locality for the latest state, significantly improving iterations and queries. (Depending on the particular benchmark, between 5-30x improvements) This implementation introduces a negligible overhead for writes.

Downgrade-re-upgrade protection
We introduced a downgrade and re-upgrade protection where we guard for potential downgrades of iavl and the subsequent enablement of the fast storage again. This is done so by storing the metadata about the current version of the storage and the latest live state stored.