m2-devtools
m2-devtools copied to clipboard
Bundeling takes long time to deploy
This issue is a:
- Bug / Performance improvement
Environment
| Question | Answer |
|---|---|
| Magento version | 2.2.6 |
node.js version (node -v) |
v6.11.1 |
npm version (npm -v) |
3.10.10 |
Description
This shop has 4 themes (which inherent from the same theme) and 2 languages. We see a huge increase in deployment time when the Javascript bundeling is enabled.
Normal deployment, without the Javascript bundeling enabled takes about 10 minutes. With Javascript bundeling enabled it takes more then 40 minutes. So bundeling and running uglify over the files increases the deployment time substantially with 30 minutes.
Expected result:
I expect to see a light increate in deployment time, because you are adding more steps to the deployment. But an increate 3 times is a bit much.
Possible solutions:
I see the uglify is stuck on the Javascript of the Magento_Swagger module for quite some time.
Log files
Log files of deployment. Bundeling occurs in the step "magento:bundle" at 05:20 ends at 35:07. So takes close to 30 minutes.
Labeling this as a bug because that's way too much time. Believe we can address this with a mix of parallelized minifying and proper ignores.
Labeling this as a bug is great, but this is somewhat consistent with my experiences. The bundling is the shortest part for us, uglifier takes a lot of time to do it's work. Maybe a newer node version will help a little? We use 8.10 I think.
After this issue was opened, I spent some time digging for tools that used the latest version of Uglify and parallelized the execution, but didn't find anything that really did what I wanted.
I wrote a tiny tool to do this, and hope to publish it at some point. Should speed things up substantially (people see similar wins using webpack when switching to the Uglify webpack plugin that parallelizes the work).
@dverkade have you managed to speed up the process ?
As a hack for the time being, you can write a shell script (or node script) that uses multiple processes to minify the code, and then disable that optimization in your r.js config