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

Optimize subgraph synced check #5085

Closed
leoyvens opened this issue Dec 18, 2023 · 1 comment · Fixed by #5198
Closed

Optimize subgraph synced check #5085

leoyvens opened this issue Dec 18, 2023 · 1 comment · Fixed by #5198
Labels
area/indexing good first issue Good for newcomers ops Relevant to Graph Node Ops performance

Comments

@leoyvens
Copy link
Collaborator

Every time we process a block, we check if the subgraph has reached the chain head and can be considered synced. Right now this requires a roundtrip to the DB to check the chain head, here:

self.inputs.chain.chain_store().chain_head_ptr().await?,

This overhead is unnecessary, since if a subgraph checks the chain head once and sees that it is very far, there is no need to check again on every block processed.

@lutter
Copy link
Collaborator

lutter commented Dec 20, 2023

In a similar vein, there is a check store.is_deployment_synced() in the runner to see if the subgraph is synced:
https://github.com/graphprotocol/graph-node/blob/master/core/src/subgraph/runner.rs#L590

The runner should know whether a subgraph is synced and only ask the store for that when it starts a subgraph; after that, it already is in control of the synced status and keep that in memory.

@leoyvens leoyvens added the ops Relevant to Graph Node Ops label Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/indexing good first issue Good for newcomers ops Relevant to Graph Node Ops performance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants