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 - redux cache) Reduced chunk size buffer from 150 gb to 1.5 gb #21993

Merged
merged 3 commits into from
Mar 5, 2020

Conversation

bebrian458
Copy link

Description

One of my team members @j218 noticed a buffer issue when trying to run build on our gatsby app with large amounts of rich text content.

Screen Shot 2020-03-05 at 10 41 24 AM

We were able to narrow it down to a redux caching issue. There seems to have been an attempt in fixing this by chunking the nodes. However, we noticed a slight math error. The intention was to chunk nodes to fit into a 1.5gb buffer, but the calculations indicate chunking for a 150gb buffer. Assuming that the max buffer length of node is 2GB, this calculation issue would create a huge chunk size if the the entries contained a large amount of content. Thus, the issue would always cause the number of chunks to equal one (essentially performing no actual chunking) and cause the issue shown in the screenshot above.

We have made the fix to chunk the nodes to fit into a 1.5 gb cache.

Fixes #17233

hashimwarren and others added 2 commits March 5, 2020 10:35
* Draft challenge 10 of 100daysofgatsby

* chore: format

* Fix challenge number

* Fix typos and add addititional links.

* Update docs/blog/100days/performance/index.md

Co-Authored-By: Obinna Ekwuno  <obinnacodes@gmail.com>

* Remove "first person" as per style guide

Co-authored-by: GatsbyJS Bot <mathews.kyle+gatsbybot@gmail.com>
Co-authored-by: Obinna Ekwuno  <obinnacodes@gmail.com>
@bebrian458 bebrian458 requested review from a team as code owners March 5, 2020 18:58
@blainekasten
Copy link
Contributor

cc @pvdz

@bebrian458 bebrian458 changed the title Redux cache (fix gatsby - redux cache) Reduced chunk size buffer from 150 gb to 1.5 gb Mar 5, 2020
@blainekasten
Copy link
Contributor

@bebrian458 a sort of weird nit, do you mind getting rid of the commits that include Hashim's 100 days of Gatsby blog post?

@pvdz
Copy link
Contributor

pvdz commented Mar 5, 2020

That's not a weird nit! My typo isn't weird! Code review isn't weird!

But also, thank you. That's a weird error indeed :(

@pvdz
Copy link
Contributor

pvdz commented Mar 5, 2020

But. That probably means my fixes unblocked you. I'm happy about that :D (If it weren't for my fix, you would be hitting that Buffer length limit not due to a bug, but simply because it wasn't designed to support that size :) )

Can you share some stats about your site? Why are you hitting this limit? Large page count or large page contents? How long does it take to build? What kind of site is it? Cu-ri-ous!

@blainekasten blainekasten added the bot: merge on green Gatsbot will merge these PRs automatically when all tests passes label Mar 5, 2020
@gatsbybot gatsbybot merged commit 7033664 into gatsbyjs:master Mar 5, 2020
@gatsbot
Copy link

gatsbot bot commented Mar 5, 2020

Holy buckets, @bebrian458 — we just merged your PR to Gatsby! 💪💜

Gatsby is built by awesome people like you. Let us say “thanks” in two ways:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. We’ve got Gatsby t-shirts, stickers, hats, scrunchies, and much more. (You can also unlock even more free swag with 5 contributions — wink wink nudge nudge.) See gatsby.dev/swag for details.
  2. We just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. Accept the invite by visiting https://github.com/orgs/gatsbyjs/invitation. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’.

Thanks again!

@blainekasten
Copy link
Contributor

Just published a patch under gatsby@2.19.29. Thanks for the quick PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: merge on green Gatsbot will merge these PRs automatically when all tests passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

V8 serialize error on build with huge number of pages(100k+)
5 participants