Rework schema queries to be quicker #763
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
When building schema for the autocomplete we currently query up to 5 nodes, and then attempt to merge them into a single view of the possible fields. This is susceptible to individual nodes being slow and causing poor query performance, which you can see in the example trace below.
As we do not necessarily need all nodes to respond (a single node responding is likely to be sufficient), and this should be an in-memory map result we can aggressively cap the timeout. I've currently left this as a system property, which we may explore moving to a config value at a later date if it's deemed a useful config to expose.
I've also reworked the schema endpoint to use structured concurrency as well, similar to that was done for the search functionality in #704