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

Update the Finalizer to reduce the frequency of heavy query #16132

Merged
merged 2 commits into from
Feb 3, 2025

Conversation

amit-momin
Copy link
Contributor

@amit-momin amit-momin commented Jan 29, 2025

Context

Increased DB load was noticed on CCIP prod testnet after upgrading to 2.20.0. The culprit was a query used by the EVM TXM Finalizer component to fetch attempts requiring receipt fetch.

Changes

The Finalizer was updated to maintain an attempts cache for receipt fetch. It will only fetch attempts from the transaction store every 6 heads and use the cache every other time. This change will help reduce the frequency that the query is called to reduce the DB load.

@amit-momin amit-momin requested review from a team as code owners January 29, 2025 23:01
@amit-momin amit-momin requested a review from ilija42 January 29, 2025 23:01
// Attempts are cached and used for subsequent fetches to reduce the load of the query.
// The attempts cache is refreshed every 3 requests.
func (f *evmFinalizer) fetchAttemptsRequiringReceiptFetch(ctx context.Context) ([]TxAttempt, error) {
f.attemptsCacheMu.Lock()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is locking necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably not since the two calls that use the cache are sequential. I added it just in case there's any changes to it in the future since it's not obvious that this needs to be protected if it's called in a thread unsafe way. I'm probably getting ahead of myself though so I can remove it

Copy link
Contributor

github-actions bot commented Jan 30, 2025

AER Report: CI Core ran successfully ✅

aer_workflow , commit

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

@amit-momin amit-momin requested a review from a team as a code owner January 31, 2025 19:43
@prashantkumar1982 prashantkumar1982 added this pull request to the merge queue Feb 3, 2025
Merged via the queue into develop with commit 141e1c0 Feb 3, 2025
185 of 186 checks passed
@prashantkumar1982 prashantkumar1982 deleted the fix/reduce-db-load branch February 3, 2025 22:26
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.

4 participants