-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
add support parallel builds #11984
base: main
Are you sure you want to change the base?
add support parallel builds #11984
Conversation
🦋 Changeset detectedLatest commit: 3e26b4c The changes in this PR will be included in the next version bump. 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 |
2a97510
to
5c36939
Compare
At the beginning I thought you were implementing the solution using worker threads, but your solution stil uses a main thread. This solution feels more like a queue instead. Is my analysis incorrect? |
Thanks, as we're in the middle of releasing Astro 5 beta we likely won't get to this right away but we'll circle back in a couple of weeks and take a look. Note that we have had a few attempts to bring this in, but it never quite worked out. Might look at old PRs to see what went wrong in the past. Also, generating pages isn't usually the slow part of the builds, so would love to see some examples of where this has big benefits. cc @bluwy who might have thoughts. |
Yeah this seems to still run on the main thread, but what I understand is that it allows multiple fetch calls from different pages to be executed in parallel? Usually for cases like this, we suggest doing all the fetches beforehand (e.g. from a shared file, during build only), that way you're not blocked by the page rendering order and better cache things if needed. Maybe that's the better approach here for your app? I think there's some value in a |
Assuming I have 10 pages, from page 1 to page 10, is the current program generating page 2 after page 1 is completed, page 3 after page 2 is completed, until page 10 is generated. |
@bluwy could we maybe get an experimental release for this? I have an app that does all fetching beforehand and then renders pages from a shared cache of sorts so I could maybe see if this makes any difference. It is quite a bit smaller (around 800 pages) but we should still be able to see if there's any improvement. |
@gacek1123 you can clone and run test by yourself through pnpm link. https://github.com/withastro/astro/blob/main/CONTRIBUTING.md#development https://pnpm.io/cli/link#replace-an-installed-package-with-a-local-version-of-it |
I think using Like I mentioned, if you perform all the fetch calls beforehand, cache it, and share it between pages, does that help with the generation speed? That should make page generation even faster than having a
If you've not tested linking locally like @chaegumi mentioned, I can definitely cut a preview release for this. But it looks like the lockfile is borked as it's installed with pnpm v8, so i'm not sure publishing will pass. Would have to fix that first. |
My program was designed to do this, and I started using it https://github.com/11ty/eleventy-fetch I did request caching, but when my program cached the
ok |
!snapshot build-concurrency |
It looks like preview releases doesn't work on forks :(
Ah so you've already optimized network fetching, that's good to know. I'm curious what's making page rendering slow still. Anyways I can't seem to cut a preview release, so we might have to wait for the rest of the team to discuss about this feature. |
English is not my native language, so my expression may not be very accurate, causing your misunderstanding. My page rendering should not be slow, 200ms, 300ms, 500ms, 600ms, etc., and some may take about 1 second. |
Just like we need to request 10 URLs at the same time and send 10 requests at the same time |
Changes
Testing
When greater than 1 using parallel builds during the build.
pnpm run build
Docs
add a configuration options
concurrency
in build options