ng build --configuration production takes 30+ mins on Jenkins but 5-6 mins on local

2.4k Views Asked by At

I have an Angular Application getting built on Jenkins Server which is running very slow (taking more than 30 mins). Command used: ng build --configuration production However when i run the same command on my local windows machine, it completes in ~5 mins. I have tried setting NODE_OPTIONS=--max-old-space-size=8192 but it doesn't seem to have any affect.

I think the issue might be with ng build not utilizing all the server cores, but am not sure.

Angular versions:

Angular CLI: 9.1.15
Node: 10.22.1
OS: win32 x64

Angular: 9.1.13
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.15
@angular-devkit/build-angular     0.901.15
@angular-devkit/build-optimizer   0.901.15
@angular-devkit/build-webpack     0.901.15
@angular-devkit/core              9.1.15
@angular-devkit/schematics        9.1.15
@angular/cdk                      9.2.4
@angular/cli                      9.1.15
@ngtools/webpack                  9.1.15
@schematics/angular               9.1.15
@schematics/update                0.901.15
rxjs                              6.6.7
typescript                        3.8.3
webpack                           4.42.0
1

There are 1 best solutions below

2
On

Adding more cores will not reduce the build-time. Put in mind that the angular builder(angular-devkit) is built with Node.js and therefore uses a single thread. If you want to reduce the build time, add a GPU to your server. Probably your local machine has a GPU, that's why it takes a shorter time.