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

Introduce step cache to reduce load on deduplicate #2279

Merged
merged 35 commits into from
Dec 10, 2024
Merged

Conversation

benjie
Copy link
Member

@benjie benjie commented Dec 10, 2024

Description

Deduplicate is expensive; this new step cache enables the duplicate steps to not be created in the first place, reducing the load on deduplicate. By carefully controlling the way in which steps can be cached (and when these caches need to be cleared) we can enable this functionality safely without risking the complexities that would occur with more naive approaches.

Performance impact

Should reduce planning time for most queries, however the act of writing to the cache does incur some performance penalty so it's certainly possible that some queries will be slower than before. I expect them to be faster in the vast majority of cases.

Security impact

Reduced memory usage (and time usage) during planning should reduce security threats slightly.

Checklist

  • My code matches the project's code style and yarn lint:fix passes.
  • I've added tests for the new feature, and yarn test passes.
  • I have detailed the new feature in the relevant documentation.
  • I have added this feature to 'Pending' in the RELEASE_NOTES.md file (if one exists).
  • If this is a breaking change I've explained why.

Copy link

changeset-bot bot commented Dec 10, 2024

🦋 Changeset detected

Latest commit: ee30542

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages
Name Type
postgraphile Patch
@dataplan/pg Patch
grafast Patch
graphile-utils Patch
pgl Patch
graphile Patch
graphile-build-pg Patch
@localrepo/grafast-bench Patch
@dataplan/json Patch
@grafserv/persisted Patch
grafserv Patch
ruru-components Patch
@localrepo/grafast-website Patch
graphile-build Patch
graphile-export Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@benjie
Copy link
Member Author

benjie commented Dec 10, 2024

This reduces the planning time of @slaskis' reproduction from ~6.25s to ~1.26s - i.e. it's now 5x as fast.

@benjie
Copy link
Member Author

benjie commented Dec 10, 2024

(The actual solution to @slaskis' issue is #2060; but this fix is welcome nonetheless.)

@benjie benjie merged commit 9eda1cf into main Dec 10, 2024
42 checks passed
@benjie benjie deleted the large-input-array-perf branch December 10, 2024 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

1 participant