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

feat: restructure loadData and rebalanceRoot cache to disallow parallelism #1351

Merged
merged 8 commits into from
Mar 23, 2024

Conversation

mrice32
Copy link
Contributor

@mrice32 mrice32 commented Mar 22, 2024

alternative solution to problem described in #1350

nicholaspai and others added 3 commits March 22, 2024 18:10
I’ve noticed that the executor is very slow and seems to stall for a long time when evaluating L2 leaves. I believe the problem is that the executor tries to execute leaves for all chains in parallel. For example, the executor tries to execute leaves from the latest 2 root bundles for 7 chains in parallel. That means that  this [function](https://github.com/across-protocol/relayer-v2/blob/2a986a267c72af02390124ffee545840f14f7b0a/src/dataworker/Dataworker.ts#L1094) which calls `BundleDataClient.loadData`  is running 7 times in parallel. The `loadData` function is designed to cache the bundle data in-memory (not in Redis!) but we can’t take advantage of this if we call it many times in parallel.

Therefore, I propose warming this cache for each executor run, which ensures we call `loadData` only once per executor run.

To add confluence to this observation about the source of slowdown, the execution of the relayer refund roots is very fast compared to the slow roots, and they `loadData` over the exact same block ranges. In this case, the refund root execution logic runs AFTER the loadData cache has been warmed.
@mrice32 mrice32 force-pushed the mrice32/cache-restructure branch from e53c082 to 0f5ba2b Compare March 22, 2024 22:47
@mrice32 mrice32 changed the title feat: restructure loadData cache to disallow parallelism feat: restructure loadData and rebalanceRoot cache to disallow parallelism Mar 22, 2024
@mrice32 mrice32 marked this pull request as ready for review March 22, 2024 23:02
@nicholaspai nicholaspai merged commit c63c1c1 into master Mar 23, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants