Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try out making a read cache for poolmanager pool modules (backport #8128) #8153

Merged
merged 1 commit into from
Apr 28, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Apr 27, 2024

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:
image

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).

* Try out making a read cache

* Make this stored in the keeper to fix tests

* Fix test reset caches

* Auto: update go.mod after push to dev/test_out_read_cahce that modified dependencies locally

* Add changelog

---------

Co-authored-by: github-actions <[email protected]>
(cherry picked from commit 76d390b)
Copy link
Contributor

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:

  1. Open https://github.com/osmosis-labs/osmosis/actions/workflows/go-mod-auto-bump.yml
  2. Provide the current branch name
  3. 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.

@PaddyMc PaddyMc closed this Apr 28, 2024
@PaddyMc PaddyMc reopened this Apr 28, 2024
@ValarDragon ValarDragon merged commit 8a960fc into v25.x Apr 28, 2024
1 check passed
@ValarDragon ValarDragon deleted the mergify/bp/v25.x/pr-8128 branch April 28, 2024 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants