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

fix(gatsby): Use shared gql runner in PQR workers #32355

Merged
merged 2 commits into from
Jul 14, 2021

Conversation

LekoArts
Copy link
Contributor

Description

Previously, every worker and its runQueries call initiated a new GraphQLRunner() call which was quite expensive time and memory wise. The problem with that is that it basically resets all fast filters cache on each chunk. It means in turn that we need to re-visit all nodes of a type on each chunk which could be pretty slow on big datasets.

So with this change it's not created every time 😆

In some tests (although not super representative as memory inside WSL2 is a bit weird and other stuff was running) this yielded these results:

With GATSBY_CPU_COUNT=7 NUM_NODES=150000 NUM_PAGES=10000 FILTER=eq-uniq yarn bench --verbose:

Before: ~10GB RAM and 14s with 696 queries/s
After: ~2.5GB RAM and 3s with 3200 queries/s

Related Issues

[ch34193]

@LekoArts LekoArts added the topic: core Relates to Gatsby's core (e.g. page loading, reporter, state machine) label Jul 13, 2021
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jul 13, 2021
@LekoArts LekoArts removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jul 13, 2021
@LekoArts LekoArts merged commit f75c833 into master Jul 14, 2021
@LekoArts LekoArts deleted the pqr/shared-gql-runner branch July 14, 2021 06:23
pragmaticpat pushed a commit to pragmaticpat/gatsby that referenced this pull request Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: core Relates to Gatsby's core (e.g. page loading, reporter, state machine)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants