gaia icon indicating copy to clipboard operation
gaia copied to clipboard

feat/Add memiavl based storage

Open chillyvee opened this issue 11 months ago • 3 comments

Description

Add memiavl storage support

  • Faster state-sync recovery
  • Reduced disk i/o and space usage

No operational change when memiavl is not enabled.

Note github.com/crypto-org-chain/cronos requires go 1.22

Statesync, Snapshot, Validation works well in Theta Testnet as provided in this branch against v15.0.0-rc3 https://github.com/chillyvee/gaia/tree/cv15.0.0-rc3-memiavl

Quickly test on theta testnet with app.toml as follows:

[memiavl]
  async-commit-buffer = 0
  cache-size = 1000
  enable = true
  snapshot-interval = 61
  snapshot-keep-recent = 3
  zero-copy = false

[state-sync]
  snapshot-interval = 61
  snapshot-keep-recent = 3

The statesync chunk apply time for Theta Testnet is approximately:

  • 70 minutes for goleveldb (as is - on test server)
  • 2 minutes for memiavl (same server)

This work follows a general effort to provide options to increase the speed of statesync and improved i/o utilization.

Related discussion here: https://github.com/cosmos/iavl/pull/878

Author Checklist

I have...

  • [X] Included the correct type prefix in the PR title
  • [ ] Added ! to the type prefix if API, client, or state breaking change (i.e., requires minor or major version bump)
  • [X] Targeted the correct branch (see PR Targeting)
  • [ ] Provided a link to the relevant issue or specification
  • [ ] Followed the guidelines for building SDK modules
  • [ ] Included the necessary unit and integration tests
  • [X] Added a changelog entry in .changelog (for details, see contributing guidelines)
  • [ ] Included comments for documenting Go code
  • [ ] Updated the relevant documentation or specification
  • [x] Reviewed "Files changed" and left comments if necessary
  • [ ] Confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.

I have...

  • [ ] confirmed the correct type prefix in the PR title
  • [ ] confirmed ! in the type prefix if API or client breaking change
  • [ ] confirmed all author checklist items have been addressed
  • [ ] reviewed state machine logic
  • [ ] reviewed API design and naming
  • [ ] reviewed documentation is accurate
  • [ ] reviewed tests and test coverage

chillyvee avatar Mar 01 '24 13:03 chillyvee

I'm not certain the cosmos-sdk/versiondb needs to be replaced.

@yihuang - Do you have a chance to comment on this?

I need more information to figure out what this means for future chain upgrades:

memiavl is an alternate key value storage db. On Jackal chain, running memiavl prior to upgrade and after upgrade resulted in a fast upgrade with no problems.

Mixing db drivers before and after upgrade will not work. Similar as switching goleveldb to rocksdb. Must delete local database storage and resync when database drivers change.

Is this a purely optional feature?

Purely optional and opt-in by configuration.

If we add it, does it affect all users?

Default opt-out. PR is configured for Opt-in-only by operators who are interested.

Does this impact upgrade speed and how?

Upgrade speed should be much faster. The one hour downtime for the previous hub upgrade would be greatly reduced. If you prefer an actual tested time, can provision a node an give an actual time.

The statesync chunk apply time for Theta Testnet is approximately:

70 minutes for goleveldb (as is - on test server) 2 minutes for memiavl (same server)

Upgrades changing key value pairs should have similar performance improvements. Statesync is an upgrade from height 0 to current head height.

Can we upgrade to v16 and add these without issues?

Typically no issue seen adding. memiavl needs to be active

With this, we would need some docs or guides to communicate to validators how and why use this. Would you be able to provide a more comprehensive guide?

If this PR is acceptable, we can allocate time to create usage documentation prior to merge.

chillyvee avatar Mar 26 '24 03:03 chillyvee

I'm not certain the cosmos-sdk/versiondb needs to be replaced. @yihuang - Do you have a chance to comment on this?

Yes, unneeded, there's no this package in the first place.

yihuang avatar Mar 26 '24 04:03 yihuang

updated code to remove version db as suggested by @yihuang

go 1.22 required

go: github.com/crypto-org-chain/cronos/[email protected] requires go >= 1.22; switching to go1.22.1

chillyvee avatar Mar 26 '24 13:03 chillyvee

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 13 '24 00:05 github-actions[bot]