-
Notifications
You must be signed in to change notification settings - Fork 12
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
Testnet indexer request takes multiple seconds #4516
Comments
A first inquiry suggests the following:
So it seems that we can seek to optimize the query in the indexer JSON-RPC server, following the call in the graphQL server. |
Replicated the slowness on local setup by artificially increasing indexer DB size to contain ~20M records (I believe it's a bit above 40M on testnet now) in transactions table. Calling:
Makes diesel generate and execute a query similar to the following:
which is slow (~40s) because of missing index on I didn't deeply investigate what graphql does internally, but since the entrypoint of the query is the checkpoint object, I assume that it may start looking at the checkpoints table, get transaction ids from there and then go for transactions table. The following query takes only 0.1s, producing the same results as the query above.
Creating the index:
makes the original query perform really fast (<0.01s) and also speeds up |
Ideally we would like to avoid adding a new index, as it will affect insertion time and hence transaction effects latency with the current setting. So this solution seems like a good candidate. At any case, I would suggest that you resolve the exact query used by GraphQL. I would assume to be the optimal solution. |
@tomxey this upstream patch might be relevant too. |
Bug description
I noticed that transactions are loaded pretty slowly on the explorer, one has to wait usually multiple seconds (5-10-15) for them to appear on the bottom of either the
Pacakge/Object
view page or on theCheckpoint
page.Looking at the monitoring dashboard, the cause of the slow loading is the huge response time from the indexer instance. On the attached screenshot you can see the spike that occured when this explorer page was opened:
The text was updated successfully, but these errors were encountered: