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

Reduce memory used for balancer v2 liquidity #2099

Merged
merged 3 commits into from
Nov 30, 2023
Merged

Reduce memory used for balancer v2 liquidity #2099

merged 3 commits into from
Nov 30, 2023

Conversation

MartinquaXD
Copy link
Contributor

Description

The new driver is using a huge amount of memory. One low hanging fruit is to slightly redesign the internals of balancer v2 liquidity. Currently all those stable and weighted pools contain big pieces of data that don't change and are duplicated.
For other liquidity sources this was handled by having an Inner component that contains that data which is shared with Arcs across all liquidity components.

Changes

This PR applies that same pattern for balancer stable and weighted pools.

How to test

Just the compiler since it's only a minor refactor

@MartinquaXD MartinquaXD requested a review from a team as a code owner November 29, 2023 07:57
Copy link
Contributor

@fleupold fleupold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love your branch names.

Do you have a slight indication/benchmark of how big this reduction is (e.g. on your local machine) that you could add to the PR description?

@MartinquaXD
Copy link
Contributor Author

Went back over this optimization to supply a reasonable visualization of this improvement. For these graphs I applied the optimization on top of #2102 because it makes it easier to see its impact.

  1. With optimizations of Reduce memory consumption of RecentBlockCache #2102
2_cache_eviction
  1. With this PR's optimization in addition we can see that the big but slim spikes are gone now. This is actually not the exact outcome I would have predicted but I take it. 😅
3_balancer_arcs

@MartinquaXD MartinquaXD enabled auto-merge (squash) November 30, 2023 13:23
@MartinquaXD MartinquaXD merged commit df37aff into main Nov 30, 2023
7 of 8 checks passed
@MartinquaXD MartinquaXD deleted the second-try branch November 30, 2023 13:26
@github-actions github-actions bot locked and limited conversation to collaborators Nov 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants