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

[ui] Improve global search perf #16965

Merged
merged 1 commit into from
Oct 12, 2023
Merged

[ui] Improve global search perf #16965

merged 1 commit into from
Oct 12, 2023

Conversation

hellendag
Copy link
Member

@hellendag hellendag commented Oct 2, 2023

Summary & Motivation

Improve render and interaction performance on global search for users with very large workspaces.

A key part of the problem here is that writing/reading with the Apollo cache becomes prohibitively slow at scale. Therefore:

  • Use cache-first policy on search queries. Currently, we always hit the backend when opening search, which can be expensive both in terms of performing the query and updating the cache. Instead, we can leverage the workspace and asset catalog queries to read data from the Apollo cache, if available.
  • Only query or read the cache once per search query. If we already have WebWorkers set up for search, don't repeat the query at all, even to do a cache lookup -- the data is already available on the workers. Just go straight to the existing workers, thus making search instantly available.
  • Skip the Apollo cache entirely for the run timeline query. When the user has a huge number of runs, the Apollo cache read/write can be very slow, blocking the main thread and affecting everything else on the page. Since this data needs to be fresh in all cases anyway, just skip the cache.

How I Tested These Changes

Viewing the app as a user with tens of thousands of objects, open search after the workspace and asset catalog have loaded. Verify that new queries are not performed, and that the data is available to be searched as soon as the cache has populated the values. Close search, reopen it. Verify that search is available right away, without having to wait for the cache to populate the values.

@hellendag
Copy link
Member Author

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@github-actions
Copy link

github-actions bot commented Oct 2, 2023

Deploy preview for dagit-core-storybook ready!

✅ Preview
https://dagit-core-storybook-5tzpbzg8a-elementl.vercel.app
https://dish-slow-search.core-storybook.dagster-docs.io

Built with commit b338d2e.
This pull request is being automatically deployed with vercel-action

@github-actions
Copy link

Deploy preview for dagster-docs ready!

Preview available at https://dagster-docs-dsuypcqs1-elementl.vercel.app
https://dish-slow-search.dagster.dagster-docs.io

Direct link to changed pages:

@github-actions
Copy link

Deploy preview for dagit-storybook ready!

✅ Preview
https://dagit-storybook-mkfgxawbu-elementl.vercel.app
https://dish-slow-search.components-storybook.dagster-docs.io

Built with commit b338d2e.
This pull request is being automatically deployed with vercel-action

// With a very large number of runs, operating on the Apollo cache is too expensive and
// can block the main thread. This data has to be up-to-the-second fresh anyway, so just
// skip the cache entirely.
fetchPolicy: 'no-cache',
Copy link
Contributor

Choose a reason for hiding this comment

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

👍🏾

@hellendag hellendag merged commit f1cb3f2 into master Oct 12, 2023
@hellendag hellendag deleted the dish/slow-search branch October 12, 2023 15:25
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.

2 participants