m2-devtools icon indicating copy to clipboard operation
m2-devtools copied to clipboard

Bundeling takes long time to deploy

Open dverkade opened this issue 6 years ago • 5 comments

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.

pipelineLog-581.txt

dverkade avatar Jan 21 '19 11:01 dverkade

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.

DrewML avatar Jan 21 '19 11:01 DrewML

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.

Vinai avatar Jan 21 '19 12:01 Vinai

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).

DrewML avatar Feb 25 '19 20:02 DrewML

@dverkade have you managed to speed up the process ?

Januszpl avatar Jun 20 '19 18:06 Januszpl

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

DrewML avatar Jul 17 '19 16:07 DrewML