-
Notifications
You must be signed in to change notification settings - Fork 416
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
Serialized compile to address #299 #517
Serialized compile to address #299 #517
Conversation
@asprouse This is awesome, thank you! Can you fix the merge conflicts on this? |
d4db9e9
to
dbe5ecb
Compare
Rebased! @daniel-cottone @HyperBrain |
@daniel-cottone @HyperBrain Is anything else required for this to go in? Would love to give it a try and see if it solves our build issues.. |
@HyperBrain @mgarciadelojo is there anything I can do to move this along? |
@HyperBrain @mgarciadelojo can you guys review and merge this? We've been hitting #299 and it's a pity that a solution exists in this PR and sits here for 1 year... |
I just approved because I was in the same situation as you. It seems this PR needs an approval from @serverless-heaven in order to be merged? |
@serverless-heaven @ceilfors @franciscocpg @hassankhan @HyperBrain @MartinRisk @nathanchapman @rdsedmundo could one of you please take a look at this PR |
This should helps my situation when worked along with TypeStrong/fork-ts-checker-webpack-plugin#425, I have ~100 lambda bundling at the same time because of |
@asprouse Do you think |
@vicary I think it would add some more flexibility, however running in parallel might be best done in separate processes. You should look at #570 it may be the solution you are looking for. At this point this PR has been open for over a year and approved for ~8 months I think it should be merged as is and then we can address enhancements with other PRs like #570. |
I did a dry-run of this PR in my setup of 13 lambdas and total time of a I tried playing with Based on the above, I suggest that the serializedCompile option be changed to maxParallelCompiles (or similar). Not present uses old behavior (no maximum); when present, it uses |
Found that @vicary already implemented the concurrency setting in his fork. I forked it to add a compile-concurrency override so I can call serverless package with different concurrency levels based on whether it runs in CI or not. This solved the problems we've been having with this plugin. @miguel-a-calles-mba @asprouse @vicary I think we should bring together this as "the solution" for #299, for the time being, since it doesn't introduce any breaking changes (I tried #570 and it didn't work). Opinions? |
I am open to anything that makes progress here. @coyoteecd You may try |
@coyoteecd @vicary My priority here is getting this PR merged in some form or another. It has already been approved by @mgarciadelojo and @miguel-a-calles-mba. We are just waiting for someone to hit merge. If the reviewers are on board with the change it's an easy tweak to make. I don't want to jeopardize it being merged for the 5.4.0 milestone. @mgarciadelojo, @miguel-a-calles-mba, @rdsedmundo what are your thoughts? |
@asprouse reason I think the fixes should be combined is that having a "concurrency" setting kinda obsoletes the serializedCompile one (just set concurrency to 1 and you get the same effect). If this PR is merged as-is, you'll have to support and document both. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I re-ran the unit tests and code coverage decreased.
4378efb
to
0cf085d
Compare
@miguel-a-calles-mba Hi, we are running into resource issues and would love to use this flag in our serverless stack. Any ETA on the release of v5.4.0 ? Is it safe to directly take this git branch as an npm dependency in production? Thanks. |
@lhr0909, release/5.4.0 branch has been successfully building. Give it a try. |
@lhr0909 any plan to release this feature along with 5.4.0 ? |
What did you implement:
Add the option to serialize webpack compilation when packaging individually. This addresses concerns in #299 and improves compilation speed significantly. In our project with 25 function this decreased the build time from ~400s to ~265s when run with the following command:
While using
thread-loader
+cache-loader
might be able to optimize accross the multiple builds it takes significant effort to get to a performant build. Running the webpack compilation in series appears to have better performance out of the box, so much so that I suggest it be the default behavior of this plugin. This PR maintains the existing multi-compile as the default and usescustom.webpack.serializedCompile
to enable the serial build.How did you implement it:
Modified
compile.js
to useBbPromise.mapSeries
instead of webpack's multi-compiler functionality. This cut downHow can we verify it:
Set
custom.webpack.serializedCompile
totrue
inserverless.yml
and run the following command:Now set the
custom.webpack.serializedCompile
tofalse
or omit the option entirely to revert to the default behavior and run the same command. Verify that both compile successfully and observe a significant speed improvement when a project with many functions is serialized.Todos:
Is this ready for review?: YES
Is it a breaking change?: NO