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

fix: optimize the round trips when reconciling the subgraph deployments #1058

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

abarmat
Copy link
Collaborator

@abarmat abarmat commented Dec 12, 2024

Issue

I was running the Indexer Agent and after a few days I realized the amount of queries it sent to the network subgraphs was out of proportion and quickly draining my api key.

Investigation

The Indexer Agent performs a number of “housekeeping” queries at regular periods of time to sync with the latest network status.

One of those queries gets the entire set of subgraphs on the network but it does so paginating by 10 items batches. With the current number of subgraphs over 10,000, it takes more than 1,000 queries to get them all.

The eventual runs every 120 seconds, that means it's sending about 720,000 queries a day.

Resolution

Set the first parameter to 1000 for the query within subgraphDeployments function of the NetworkMonitor.

Copy link
Contributor

@dwerner dwerner left a comment

Choose a reason for hiding this comment

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

Good find. I have another PR in that was intended to fix a test in that same function (#1056), I bumped the page size there as well.

Copy link
Contributor

@fordN fordN left a comment

Choose a reason for hiding this comment

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

🙌

@dwerner
Copy link
Contributor

dwerner commented Dec 12, 2024

closing in favor of #1056, thanks!

@dwerner dwerner closed this Dec 12, 2024
@abarmat
Copy link
Collaborator Author

abarmat commented Dec 12, 2024

@dwerner it seems that #1056 is not including this change, is that right? take a look at this line

@abarmat
Copy link
Collaborator Author

abarmat commented Dec 12, 2024

This PR is fixing a different function than #1056, this one is for SubgraphDeployments and the other one for Subgraphs.

@abarmat abarmat mentioned this pull request Dec 12, 2024
@abarmat
Copy link
Collaborator Author

abarmat commented Dec 12, 2024

Also tagging @fordN for visibility

@dwerner dwerner reopened this Dec 12, 2024
@dwerner
Copy link
Contributor

dwerner commented Dec 12, 2024

My bad, I mixed up a similar fix.

@dwerner dwerner merged commit c2ff8fb into main Dec 12, 2024
14 of 17 checks passed
@dwerner dwerner deleted the reconciliation-optimization-1 branch December 12, 2024 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🚗 Merged
Development

Successfully merging this pull request may close these issues.

3 participants