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($core): render static html via stream pipe (fix #1819) #2454
Conversation
f4c9f65
to
6253f52
Compare
6253f52
to
79f1ca4
Compare
79f1ca4
to
3ce5176
Compare
3ce5176
to
9379895
Compare
9379895
to
961f033
Compare
cc @f3ltron I think from the linked issue, you may be the most relevant reviewer for this PR? |
I'm going to close this PR. After using it for some time it has a significant performance degradation. Also, we worked around our underlying issue in that we moved off using Travis to build (it was killing the build because of no output for 10+ minutes) |
@sgtcoolguy , hello, I've just read about this, and I'm experiencing this js oom issue recently. Since this pr is closed, is there any other wok around on this? |
@8zf basically I just had to "throw RAM" at Node: |
I've tried this, but in my case, there are 700+ pages(auto generated), which costs all 8gb ram I allocated and still OOM.... I think this PR is a good way to solve problem like this, maybe you can add some configuration to vuepress to trigger build page by sequence/batch, or when large number of pages are detected :) |
I opened this PR to try and solve the issue - but:
So hey - you can fork and try the patch as a starting point, go right ahead - but I think it ultimately didn't solve the problem and instead introduced a huge performance regression. A simpler patch may work better for you just using something like p-limit to throttle the number of simultaneous renders. |
Maybe the dev team is too busy to handle so many problems. 😅 Really appreciate your advice :), I'll have a try |
Summary
This PR attempts to handle larger doc sites to avoid blowing up the NodeJs heap as seen in #1819, as well as provide a better experience by not just silently chewing through thousands of files. The PR attempts to achieve this by:
bundleRenderer.renderToStream()
and then usingfs.writeStream()
andstream.pipe()
. This avoids rendering to a string that we then write to file. It should pipe it to the file as it goes (which I assume should reduce RAM usage)I should note that for our site with 1618 pages, I still had to increase the Node heap or it would sometimes blow up during the Webpack client/server bundling.
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
fix #xxx[,#xxx]
, where "xxx" is the issue number)You have tested in the following browsers: (Providing a detailed version will be better.)
If adding a new feature, the PR's description includes:
To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.
Other information:
While this adds an explicit dependency on p-limit, I did find it in the
node_modules
tree of my site, and I believe it was already deeply nested in the dependency chain of VuePress:@vuepress/core > copy-webpack-plugin > p-limit
I aligned versions so it used^2.2.0
.