osmosis
osmosis copied to clipboard
Try out making a read cache for poolmanager pool modules (backport #8128)
Try out making a read cache to avoid extra unmarshals.
For the state machine im pretty confident it will work, it may break the errors for some weird queries to old heights (since it will share this cache, and should really return a miss). But this will only be an edge case for new pools.
We should def test it in prod, but I think this should eliminate this 4.73 out of 1100 seconds of sync time:
More importantly i think this will be helpful as a stepping stone to figuring out a more general, re-usable design pattern for us. We could just cache the proto unmarshals, but we would then still pay the key formatting cost. We could cache both key formatting and proto unmarshal in this case.
More general case, we likely do need to cache the two steps differently and use LRU's.
Summary by CodeRabbit
-
New Features
- Introduced caching for pool module results to enhance performance.
- Added gas tracking for key-value store operations to improve resource management.
-
Bug Fixes
- Improved error handling in pool creation tests by including pool ID context.
-
Refactor
- Transitioned method receivers to pointers for consistency and efficiency in pool management modules.
-
Chores
- Implemented synchronization mechanisms in pool management to ensure thread safety.
- Added reset functionality for cache in testing environments to maintain test accuracy.
This is an automatic backport of pull request #8128 done by [Mergify](https://mergify.com).
Cherry-pick of 76d390b6a53859c18aa6d1b49c12fde1840b27f0 has failed:
On branch mergify/bp/v24.x/pr-8128
Your branch is up to date with 'origin/v24.x'.
You are currently cherry-picking commit 76d390b6.
(fix conflicts and run "git cherry-pick --continue")
(use "git cherry-pick --skip" to skip this patch)
(use "git cherry-pick --abort" to cancel the cherry-pick operation)
Changes to be committed:
modified: CHANGELOG.md
modified: app/apptesting/test_suite.go
modified: osmomath/go.mod
modified: osmomath/go.sum
modified: osmoutils/go.mod
modified: osmoutils/go.sum
modified: osmoutils/store_helper.go
modified: osmoutils/store_helper_test.go
modified: x/epochs/go.mod
modified: x/epochs/go.sum
modified: x/ibc-hooks/go.sum
modified: x/poolmanager/create_pool.go
modified: x/poolmanager/export_test.go
modified: x/poolmanager/keeper.go
modified: x/poolmanager/router.go
modified: x/poolmanager/router_test.go
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: go.mod
both modified: go.sum
both modified: x/ibc-hooks/go.mod
To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally
Important Notice
This PR modifies an in-repo Go module. It is one of:
- osmomath
- osmoutils
- x/ibc-hooks
- x/epochs
The dependent Go modules, especially the root one, will have to be updated to reflect the changes. Failing to do so might cause e2e to fail.
Please follow the instructions below:
- Open https://github.com/osmosis-labs/osmosis/actions/workflows/go-mod-auto-bump.yml
- Provide the current branch name
- On success, confirm if an automated commit corretly updated the go.mod and go.sum files
Please let us know if you need any help.
This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you!