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

Scale observation building with massive amount of results #317

Conversation

amirylm
Copy link
Collaborator

@amirylm amirylm commented Apr 1, 2024

AUTO-9416

Description

Currently we sort the entire set of staged upkeeps by random seed order based on the OCR round/seq number, then take a limit of items to be added to observation.
As part of the sorting we are doing string shuffling with the random seed, which is CPU+memory intensive work that makes the entire operation slow, and breaks when scaling as we repeat the same expensive operation to get random order in each round. Eventually resulting in multiple “Observation is taking too long” warnings or even crushes the nodes.

We will use a random number every x rounds (e.g. 10) and maintain a cache for the shuffled work ids.
A map will be used to store shuffled ids, it will get cleaned every time the random source changes (10 rounds).

Changes

  • Added staging hook state with cache and last src
  • Populate cache before sorting
  • Use cache when sorting

@amirylm amirylm marked this pull request as ready for review April 5, 2024 13:13
@amirylm amirylm requested review from infiloop2 and ferglor April 5, 2024 13:13
Copy link
Collaborator

@infiloop2 infiloop2 left a comment

Choose a reason for hiding this comment

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

PR looks great to me!

Could we add some unit test coverage for the updated logic

ferglor
ferglor previously approved these changes Apr 5, 2024
@amirylm amirylm requested review from infiloop2 and ferglor April 8, 2024 10:00
@amirylm amirylm merged commit 13d6bb7 into main Apr 8, 2024
7 checks passed
@amirylm amirylm deleted the AUTO-9416-scale-observation-building-with-massive-amount-of-results branch April 8, 2024 12:33
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.

3 participants