angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Angular 7/8 FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Open arayik-yervandyan opened this issue 7 years ago β€’ 205 comments

🐞 Bug report

Command (mark with an x)

- [ ] new
- [X] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Description

With the last merge project build process is not working. I get failure that is pasted below. Tried to change --max-old-space-size=4096 still not working. Any suggestions what this can be ?

πŸ”¬ Minimal Reproduction

run command ng build --prod in angular.json file we have

"production": {
	"optimization": true,
	"outputHashing": "all",
	"sourceMap": false,
	"extractCss": true,
	"namedChunks": false,
	"aot": true,
	"extractLicenses": true,
	"vendorChunk": false,
	"buildOptimizer": true,
	"fileReplacements": [
	{
		"replace": "src/environments/environment.ts",
		"with": "src/environments/environment.prod.ts"
	}
	]
},

πŸ”₯ Exception or Error

Here is the log file.

{ Error: Command failed: ng build --prod --configuration=config --output-path=test --base-href=/test/
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x8dbaa0 node::Abort() [ng build --prod --configuration=config --output-path=test --base-href=/test/]
 2: 0x8dbaec  [ng build --prod --configuration=config --output-path=test --base-href=/test/]
 3: 0xad83de v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [ng build --prod --configuration=config --output-path=test --base-href=/test/]
 4: 0xad8614 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [ng build --prod --configuration=config --output-path=test --base-href=/test/]
 5: 0xec5c42  [ng build --prod --configuration=config --output-path=test --base-href=/test/]
 6: 0xec5d48 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [ng build --prod --configuration=config --output-path=test --base-href=/test/]
 7: 0xed1e22 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [ng build --prod --configuration=config --output-path=test --base-href=/test/]
 8: 0xed2754 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [ng build --prod --configuration=config --output-path=test --base-href=/test/]
 9: 0xed53c1 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [ng build --prod --configuration=config --output-path=test --base-href=/test/]
10: 0xe9d636  [ng build --prod --configuration=config --output-path=test --base-href=/test/]
11: 0xeafee7 v8::internal::Factory::NewLoadHandler(int) [ng build --prod --configuration=config --output-path=test --base-href=/test/]
12: 0xf2f4db v8::internal::LoadHandler::LoadFromPrototype(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Map>, v8::internal::Handle<v8::internal::JSReceiver>, v8::internal::Handle<v8::internal::Smi>, v8::internal::MaybeHandle<v8::internal::Object>, v8::internal::MaybeHandle<v8::internal::Object>) [ng build --prod --configuration=config --output-path=test --base-href=/test/]
13: 0xf36d1f v8::internal::LoadIC::ComputeHandler(v8::internal::LookupIterator*) [ng build --prod --configuration=config --output-path=test --base-href=/test/]
14: 0xf3d94c v8::internal::LoadIC::UpdateCaches(v8::internal::LookupIterator*) [ng build --prod --configuration=config --output-path=test --base-href=/test/]
15: 0xf3dffc v8::internal::LoadIC::Load(v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Name>) [ng build --prod --configuration=config --output-path=test --base-href=/test/]
16: 0xf42935 v8::internal::Runtime_LoadIC_Miss(int, v8::internal::Object**, v8::internal::Isolate*) [ng build --prod --configuration=config --output-path=test --base-href=/test/]
17: 0x235e3925be1d

🌍 Your Environment


Angular CLI: 7.3.1
Node: 10.15.1
OS: linux x64
Angular: 7.2.6
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.13.2
@angular-devkit/build-angular     0.13.2
@angular-devkit/build-optimizer   0.13.2
@angular-devkit/build-webpack     0.13.2
@angular-devkit/core              7.3.2
@angular-devkit/schematics        7.3.1
@angular/cdk                      7.3.3
@angular/cli                      7.3.1
@ngtools/webpack                  7.3.2
@schematics/angular               7.3.1
@schematics/update                0.13.1
rxjs                              6.4.0
typescript                        3.1.6
webpack                           4.29.0

arayik-yervandyan avatar Feb 21 '19 13:02 arayik-yervandyan

@johannesjo my sourceMap is set to false. I tried it with sourceMap set to true and it still builds

gak10100 avatar May 30 '19 15:05 gak10100

@gak10100 and are you using scss/sass?

johannesjo avatar May 30 '19 16:05 johannesjo

I think the increased memory requirement might be related to sass processing then. We moved from node-sass to sass in 8.

Can you follow the instructions in @angular-devkit/build-angular: use sass instead of node-sass (ce15899) to force usage of node-sass instead?

filipesilva avatar May 30 '19 16:05 filipesilva

@johannesjo Yes AngularBuildError AngularBuildSuccess

gak10100 avatar May 30 '19 16:05 gak10100

You can also try using Node 12, as it should increase the memory automatically. If there's enough memory, builds should succeed.

filipesilva avatar May 30 '19 16:05 filipesilva

Just FYI I'm on node v12.3.1

gak10100 avatar May 30 '19 16:05 gak10100

@gak10100 thank you.

I tried all combinations of the following: node: 10.15.3/12.3.1 angular: 7.4, 8.0 os: win10/ubuntu18.04

All result in the same error.

I have quite the powerful gaming laptop so memory and cpu power shouldn't normally be an issue. The code of project is open source and can be looked at here: https://github.com/johannesjo/super-productivity

johannesjo avatar May 30 '19 16:05 johannesjo

Upgrading from node 10 to node 12 resolved my compiling memory issue when using Angular 8.

However, when I try to run the compiled code from ng build --prod, it just displays a blank screen :/ Works fine with ng serve though

Troyd-Destin avatar May 30 '19 16:05 Troyd-Destin

@johannesjo I'm very, very grateful for the repro! It's so hard to find repros for these problems.

filipesilva avatar May 30 '19 16:05 filipesilva

@filipesilva I tried a lot of things here (took me quite a while to gather this). I use SASS.

With --max_old_space_size: ES2015 AOT ON => fail with Fatal process OOM in insufficient memory to create an Isolate ES2015 AOT OFF => success ES5 AOT ON => fail with Fatal process OOM in insufficient memory to create an Isolate

Without --max_old_space_size ES2015 AOT ON => fail with Ineffective mark-compacts near heap limit Allocation failed ES2015 AOT OFF => success ES5 AOT ON => fail with Ineffective mark-compacts near heap limit Allocation failed ES5 AOT OFF => success

This browserslist, I am not sure where it is picking it from, I upgraded a large application so ng update or anything about schematic did not do its job properly, so I updated everything manually. I tried to drop it in the root folder. It does not change anything.

As mentioned, Azure does not have Node 12. But only Node 10. I want to re-iterate, this is on Azure, an S3 machine.

I have never used the --aot flag. I use the --prod flag. I used angular.json with "aot" and "buildOptimizer" set to true. I moved my app from Angular 6.0.4 to 8.0.0.

jsgoupil avatar May 30 '19 18:05 jsgoupil

@johannesjo I tried your repo, here are my results.

First I updated manually to CLI and build-angular latest stable. The update is in https://github.com/filipesilva/super-productivity/tree/benchmark-8.

This is what I see for ng version:

kamik@RED-X1C6 MINGW64 /d/sandbox/oom/v8 (benchmark-8)
$ ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / β–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 8.0.1
Node: 10.10.0
OS: win32 x64
Angular: 8.0.0-rc.4
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.1
@angular-devkit/build-angular     0.800.1
@angular-devkit/build-optimizer   0.800.1
@angular-devkit/build-webpack     0.800.1
@angular-devkit/core              8.0.1
@angular-devkit/schematics        8.0.1
@angular/cdk                      8.0.0-rc.0
@angular/cli                      8.0.1
@angular/http                     7.2.14
@angular/material                 8.0.0-rc.1
@angular/pwa                      0.10.7
@angular/service-worker           7.2.14
@ngtools/webpack                  8.0.1
@schematics/angular               7.0.7
@schematics/update                0.800.1
rxjs                              6.5.1
typescript                        3.4.5
webpack                           4.30.0

Then I ran a custom benchmark tool we have in this repository to measure resource usage for commands.

kamik@RED-X1C6 MINGW64 /d/sandbox/oom/v8 (benchmark-8)
$ ../../../work/cli/bin/benchmark -- ng build --prod
[benchmark] Benchmarking process over 5 iterations, with up to 5 retries.
[benchmark]   ng build --prod (at D:\sandbox\oom\v8)
[benchmark] Process Stats
[benchmark]   Elapsed Time: 155162.80 ms (157246.00, 143200.00, 165534.00, 155899.00, 153935.00)
[benchmark]   Average Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Peak Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Average CPU usage: 17.40 % (16.74, 17.06, 18.40, 17.31, 17.52)
[benchmark]   Peak CPU usage: 190.04 % (165.60, 236.10, 189.10, 187.50, 171.90)
[benchmark]   Average Memory usage: 930.58 MB (928.38, 935.07, 917.83, 950.89, 920.71)
[benchmark]   Peak Memory usage: 1640.18 MB (1583.62, 1619.55, 1624.59, 1669.88, 1703.28)

So I am seeing peak memory usage juuuuust below the 1.7g default limit. I don't quite understand how you are reaching the memory limit of your machine. Is there anything else about your environment you can think of? Maybe symlinks somewhere.

@jsgoupil I am not on Azure, but I did my tests on a Windows machine. It is expected that AOT takes more memory mostly because it's a more complex build. More is happening there.

But I find your results interesting. You say that without --max_old_space_size+AOT off the builds succeed. So they succeed with less than 1.7g memory (the default for now). But you say that with --max_old_space_size=8192+AOT on, it always fails.

So the AOT build is taking at least 5x more memory. Which I don't think is very reasonable. I mean up to 2x I could imagine for an insanely complex TS setup, but 5x is just too much. I think it is more likely that there's some memory leak in the compiler, or something silly going on.

Do you have any repo we could look at? Even if only privately shared.

filipesilva avatar May 31 '19 14:05 filipesilva

Hello @filipesilva , thanks for being willing to look into this. I can share my repo, it is indeed private and on Bitbucket. I am able to build AOT on my windows machine with Node 12. It does take quite a while but it works. I'm not used into taking benchmark and check all that stuff. Can you go on my profile and send me a quick email, I can get you setup.

jsgoupil avatar May 31 '19 14:05 jsgoupil

@filipesilva thanks for checking this.

I'm not sure if understand you correctly.

First: Am I assuming correctly that on your machine the build is running fine? Or is it just, that it technically shouldn't fail according to the benchmark?

Second: Do you mean a repository of another angular app? Maybe the travis build logs are helpful, too? If I'm not mistaken they should be public anyway: https://travis-ci.org/johannesjo/super-productivity/builds/539736050 Results seem to be the same, even though the mac build is taking its sweet time again :)

Please let me know, if I can supply anything else of assistance.

johannesjo avatar May 31 '19 14:05 johannesjo

I think the increased memory requirement might be related to sass processing then. We moved from node-sass to sass in 8.

Can you follow the instructions in @angular-devkit/build-angular: use sass instead of node-sass (ce15899) to force usage of node-sass instead?

I installed node-sass as a dev dependency but still experienced insanely high memory consumption. Our builds are using more than 12GB.

stevenoctopus avatar Jun 04 '19 13:06 stevenoctopus

Not sure if this will help but here is a graph of our memory consumption.

The first spike is a default build with differential loading. Second spike is differential loading using node-sass.

The final spike is a build with differential loading turned off.

Both builds with differential loading failed after they reached the memory limit of the server. The last build was successful.

memoryconsumption

We have about 20 different projects defined in our angular.json. It would normally fail when building the second or third project.

stevenoctopus avatar Jun 04 '19 14:06 stevenoctopus

Below are two more issue related to the slowdown in version 8. The below have logs and a reproduction as well.

https://github.com/angular/angular-cli/issues/14666#issue-452183942 https://github.com/angular/angular-cli/issues/14604#issuecomment-498425823

alan-agius4 avatar Jun 05 '19 05:06 alan-agius4

@Troyd-Destin same here as you, did you solve your problem?

Svetomechc avatar Jun 06 '19 10:06 Svetomechc

Hey all,

Just want to give you an update on this issue. I've been looking into it to see if I can find something. Below are my findings so far.

filipesilva avatar Jun 07 '19 13:06 filipesilva

Debugging the memory situation in CLI 8

Environment:

kamik@RED-X1C6 MINGW64 /d/sandbox/memory-debug
$ ng version

Angular CLI: 8.0.1
Node: 12.3.1
OS: win32 x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.800.1
@angular-devkit/core         8.0.1
@angular-devkit/schematics   8.0.1
@schematics/angular          8.0.1
@schematics/update           0.800.1
rxjs                         6.4.0

kamik@RED-X1C6 MINGW64 /d/sandbox/memory-debug
$ npm -v
6.9.0

kamik@RED-X1C6 MINGW64 /d/sandbox/memory-debug
$ yarn -v
1.12.3

Measuring memory usage

We have a private benchmarking package for the CLI https://github.com/angular/angular-cli/tree/master/packages/angular_devkit/benchmark.

To install it, clone the CLI repo, then run follow these commands:

yarn
yarn build
npm pack dist/@angular-devkit/benchmark
npm install -g angular-devkit-benchmark-0.800.0-beta.18.tgz

The filename on the last command might change, depending on the version of the CLI you clone.

To use it, run benchmark -- command. The command will depend on the project you use. To benchmark a prod build, do benchmark -- ng build --prod.

You can also do benchmark --iterations 20 -- ng build --prod to get a larger sample size (20 instead of 5).

Methodology

I have gathered a bunch of projects of various sizes, and have setup a v7 and v8 folder for each.

To get the different versions I first update a project to version 8 following https://update.angular.io/. Thats the v8 variant.

Then I make the v7 variant by replacing:

  • @angular-devkit/build-angular version from ~0.800.0 to 0.13.8
  • @angular/cli version from ~8.0.1 to 7.3.9
  • target in ./tsconfig.json from es2015 to es5.

To change between node versions I used NVM. To disable Differential Loading (DL) I changed the target in ./tsconfig.json from es2015 to es5.

On each I do benchmark -- ng build --prod, then compare the results.

Benchmark matrix:

  • v8, DL, Node 10.10.0
  • v8, DL, Node 12.3.1
  • v8, no DL, Node 10.10.0
  • v8, no DL, Node 12.3.1
  • v7, Node 10.10.0
  • v7, Node 12.3.1

Results

new-project

From ng new new-project

Generated using Angular CLI 8.0.1

  • v8, DL, Node 10.10.0
[benchmark] Benchmarking process over 20 iterations, with up to 5 retries.
[benchmark]   ng build --prod (at D:\sandbox\memory-debug\new-project\v8)
[benchmark] Process Stats
[benchmark]   Elapsed Time: 46922.00 ms (39800.00, 45773.00, 45097.00, 45295.00, 46447.00, 47061.00, 49343.00, 48787.00, 58921.00, 50950.00, 45493.00, 45809.00, 47836.00, 45142.00, 45632.00, 45060.00, 45956.00, 45688.00, 45292.00, 49058.00)
[benchmark]   Average Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Peak Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Average CPU usage: 14.31 % (10.82, 12.30, 14.18, 13.79, 13.90, 13.75, 16.09, 15.20, 17.63, 16.20, 14.68, 14.51, 15.48, 14.43, 13.26, 14.56, 13.38, 13.03, 12.87, 16.10)
[benchmark]   Peak CPU usage: 109.84 % (92.30, 89.10, 137.60, 126.60, 103.10, 92.20, 128.20, 103.00, 142.20, 114.00, 90.60, 104.60, 107.80, 96.90, 93.70, 128.20, 123.40, 95.30, 92.20, 135.90)        
[benchmark]   Average Memory usage: 412.94 MB (410.61, 414.42, 412.02, 414.26, 414.95, 413.02, 411.16, 408.59, 408.12, 411.88, 417.27, 416.50, 410.62, 413.21, 416.36, 411.94, 411.58, 414.87, 412.33, 
415.01)
[benchmark]   Peak Memory usage: 972.38 MB (940.09, 1007.36, 939.21, 1014.48, 1012.67, 953.59, 934.79, 944.62, 860.78, 1008.56, 1019.51, 1005.97, 902.56, 1008.87, 999.36, 1005.65, 973.90, 1012.61, 974.84, 928.23)
  • v8, DL, Node 12.3.1
[benchmark] Benchmarking process over 20 iterations, with up to 5 retries.
[benchmark]   ng build --prod (at D:\sandbox\memory-debug\new-project\v8)
[benchmark] Process Stats
[benchmark]   Elapsed Time: 43714.45 ms (42475.00, 42905.00, 42806.00, 45229.00, 44435.00, 42946.00, 43730.00, 44409.00, 43320.00, 43331.00, 45213.00, 46699.00, 44467.00, 42552.00, 42833.00, 42773.00, 42621.00, 45640.00, 43103.00, 42802.00)
[benchmark]   Average Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Peak Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Average CPU usage: 15.08 % (13.71, 15.04, 14.23, 15.94, 15.58, 14.19, 14.84, 15.49, 15.26, 14.15, 15.76, 15.63, 16.43, 14.73, 15.51, 15.28, 15.06, 16.25, 14.92, 13.62)
[benchmark]   Peak CPU usage: 114.45 % (103.10, 153.10, 114.10, 98.50, 122.00, 98.40, 121.90, 109.40, 126.60, 109.40, 87.40, 109.30, 112.50, 114.00, 142.10, 120.30, 104.60, 150.00, 109.40, 82.80)    
[benchmark]   Average Memory usage: 443.99 MB (399.76, 469.47, 461.83, 416.02, 425.19, 433.08, 395.28, 459.70, 462.49, 419.98, 462.35, 476.16, 459.91, 463.51, 461.39, 423.32, 461.10, 424.20, 465.06, 
439.96)
[benchmark]   Peak Memory usage: 1041.65 MB (1056.51, 1166.15, 1030.32, 975.46, 1107.44, 920.04, 1028.92, 1062.10, 1067.24, 1075.11, 1040.00, 1087.46, 1005.02, 1073.69, 1040.01, 1034.72, 1059.59, 1003.81, 1081.23, 918.20)
  • v8, no DL, Node 10.10.0
[benchmark] Benchmarking process over 20 iterations, with up to 5 retries.
[benchmark]   ng build --prod (at D:\sandbox\memory-debug\new-project\v8)
[benchmark] Process Stats
[benchmark]   Elapsed Time: 39715.85 ms (41254.00, 38917.00, 38954.00, 39452.00, 39908.00, 39124.00, 41544.00, 39056.00, 39008.00, 38737.00, 39794.00, 41248.00, 41226.00, 42391.00, 38638.00, 41751.00, 36910.00, 41124.00, 39960.00, 35321.00)
[benchmark]   Average Process usage: 1.02 process(es) (1.37, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Peak Process usage: 1.15 process(es) (4.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Average CPU usage: 19.27 % (20.15, 18.37, 17.48, 19.86, 20.59, 19.83, 20.60, 19.03, 18.46, 18.66, 19.95, 18.84, 20.64, 21.30, 18.69, 20.99, 17.54, 19.45, 18.83, 16.05)
[benchmark]   Peak CPU usage: 118.53 % (170.40, 120.30, 89.00, 109.40, 140.70, 120.30, 132.90, 98.40, 107.80, 86.00, 93.70, 101.50, 132.80, 128.20, 112.60, 154.70, 90.60, 145.40, 134.40, 101.60)     
[benchmark]   Average Memory usage: 313.02 MB (360.81, 308.63, 312.78, 311.23, 310.24, 310.67, 312.26, 309.85, 310.46, 313.62, 310.08, 313.48, 308.39, 306.88, 309.72, 311.82, 311.05, 309.78, 310.82, 
307.85)
[benchmark]   Peak Memory usage: 800.08 MB (774.48, 774.38, 763.67, 807.96, 786.14, 815.06, 835.76, 762.01, 767.66, 861.41, 825.32, 855.64, 794.63, 767.91, 798.90, 805.75, 824.83, 823.76, 791.04, 765.35)
  • v8, no DL, Node 12.3.1
[benchmark] Benchmarking process over 20 iterations, with up to 5 retries.
[benchmark]   ng build --prod (at D:\sandbox\memory-debug\new-project\v8)
[benchmark] Process Stats
[benchmark]   Elapsed Time: 29947.20 ms (28681.00, 30854.00, 28829.00, 28346.00, 28471.00, 29073.00, 28534.00, 28585.00, 27104.00, 27578.00, 27421.00, 28399.00, 29042.00, 27301.00, 27480.00, 33175.00, 37174.00, 34747.00, 34038.00, 34112.00)
[benchmark]   Average Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Peak Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Average CPU usage: 15.59 % (14.65, 17.22, 15.86, 14.82, 15.21, 15.75, 15.03, 15.15, 12.67, 14.51, 13.17, 14.72, 14.46, 12.78, 13.69, 17.00, 19.96, 18.69, 17.80, 18.63)
[benchmark]   Peak CPU usage: 97.90 % (90.70, 106.20, 90.70, 90.70, 117.30, 89.00, 96.80, 103.10, 92.20, 75.00, 92.20, 93.80, 96.90, 92.20, 81.20, 134.40, 98.40, 106.20, 95.30, 115.60)
[benchmark]   Average Memory usage: 303.56 MB (294.81, 314.64, 298.23, 310.19, 303.41, 295.35, 293.39, 294.60, 310.87, 311.56, 316.21, 296.54, 305.72, 315.03, 315.93, 313.65, 311.67, 291.89, 283.43, 
294.12)
[benchmark]   Peak Memory usage: 847.21 MB (822.65, 948.96, 819.03, 852.73, 859.57, 764.29, 749.08, 811.35, 887.66, 905.15, 938.75, 799.78, 878.00, 912.18, 929.51, 819.72, 897.77, 769.11, 734.79, 844.19)
  • v7, Node 10.10.0
[benchmark] Benchmarking process over 20 iterations, with up to 5 retries.
[benchmark]   ng build --prod (at D:\sandbox\memory-debug\new-project\v7)
[benchmark] Process Stats
[benchmark]   Elapsed Time: 34065.15 ms (48589.00, 30736.00, 29772.00, 32748.00, 35670.00, 37796.00, 35251.00, 32773.00, 33065.00, 32493.00, 32957.00, 32942.00, 33630.00, 34067.00, 33241.00, 32454.00, 32997.00, 33366.00, 32509.00, 34247.00)
[benchmark]   Average Process usage: 1.06 process(es) (2.20, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Peak Process usage: 1.20 process(es) (5.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Average CPU usage: 15.93 % (17.74, 15.14, 14.45, 15.67, 16.94, 18.67, 17.13, 14.81, 15.50, 15.68, 15.22, 15.17, 17.00, 15.39, 15.49, 15.34, 15.15, 15.99, 15.94, 16.11)
[benchmark]   Peak CPU usage: 99.83 % (170.30, 98.50, 79.60, 117.20, 117.20, 96.90, 90.70, 82.70, 118.80, 106.20, 79.70, 82.90, 107.80, 93.70, 87.50, 84.30, 84.30, 89.00, 117.20, 92.10)
[benchmark]   Average Memory usage: 307.49 MB (455.09, 299.47, 299.79, 305.62, 300.43, 298.91, 298.40, 301.08, 300.22, 299.42, 298.72, 299.10, 299.30, 301.11, 299.16, 298.94, 300.26, 297.80, 298.66, 
298.40)
[benchmark]   Peak Memory usage: 805.72 MB (847.09, 820.75, 771.20, 851.10, 817.67, 831.61, 782.52, 815.22, 832.90, 798.27, 786.08, 753.38, 779.23, 821.07, 804.25, 824.09, 852.30, 765.94, 754.26, 805.57)
  • v7, Node 12.3.1
[benchmark] Benchmarking process over 20 iterations, with up to 5 retries.
[benchmark]   ng build --prod (at D:\sandbox\memory-debug\new-project\v7)
[benchmark] Process Stats
[benchmark]   Elapsed Time: 33382.50 ms (33115.00, 33274.00, 31484.00, 30663.00, 30814.00, 30642.00, 31120.00, 31219.00, 33208.00, 39141.00, 36040.00, 36106.00, 35269.00, 34795.00, 33526.00, 33014.00, 34918.00, 33872.00, 32882.00, 32548.00)
[benchmark]   Average Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Peak Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Average CPU usage: 17.92 % (17.56, 17.77, 16.47, 16.61, 15.86, 16.67, 16.90, 15.90, 18.98, 23.05, 18.36, 19.39, 20.03, 18.58, 17.52, 16.43, 19.60, 17.50, 17.58, 17.72)
[benchmark]   Peak CPU usage: 98.91 % (106.30, 99.90, 90.60, 98.40, 86.00, 87.50, 104.70, 93.70, 115.60, 128.10, 117.20, 103.10, 95.40, 85.90, 96.90, 81.30, 100.00, 85.90, 89.10, 112.60)
[benchmark]   Average Memory usage: 292.19 MB (293.59, 295.74, 293.63, 290.62, 293.48, 291.67, 292.69, 293.37, 293.36, 293.54, 293.94, 292.08, 291.17, 291.83, 292.20, 291.82, 283.89, 292.66, 291.06, 
291.52)
[benchmark]   Peak Memory usage: 846.53 MB (828.64, 886.21, 835.02, 820.26, 837.29, 883.92, 873.06, 882.54, 825.58, 889.52, 880.10, 831.73, 827.94, 868.43, 820.85, 871.18, 763.72, 800.90, 900.42, 803.35)

Super-productivity

From https://github.com/aviabird/angularspree

Provided by @johannesjo in https://github.com/angular/angular-cli/issues/13734#issuecomment-497393904

  • v8, DL, Node 10.10.0
[benchmark] Benchmarking process over 5 iterations, with up to 5 retries.
[benchmark]   ng build --prod (at D:\sandbox\memory-debug\super-productivity\v8)
[benchmark] Process Stats
[benchmark]   Elapsed Time: 269523.80 ms (257464.00, 255811.00, 285836.00, 279557.00, 268951.00)
[benchmark]   Average Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Peak Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Average CPU usage: 13.37 % (12.17, 12.49, 13.95, 15.03, 13.22)
[benchmark]   Peak CPU usage: 193.76 % (175.00, 179.80, 207.80, 223.40, 182.80)
[benchmark]   Average Memory usage: 1139.50 MB (1125.28, 1128.75, 1165.98, 1146.50, 1131.01)
[benchmark]   Peak Memory usage: 1753.78 MB (1712.68, 1726.49, 1809.78, 1796.38, 1723.58)
  • v8, DL, Node 12.3.1
[benchmark] Benchmarking process over 5 iterations, with up to 5 retries.
[benchmark]   ng build --prod (at D:\sandbox\memory-debug\super-productivity\v8)
[benchmark] Process Stats
[benchmark]   Elapsed Time: 302133.40 ms (379732.00, 271669.00, 295372.00, 289442.00, 274452.00)
[benchmark]   Average Process usage: 1.19 process(es) (1.97, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Peak Process usage: 1.80 process(es) (5.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Average CPU usage: 12.91 % (13.05, 12.47, 13.46, 13.09, 12.45)
[benchmark]   Peak CPU usage: 199.36 % (217.20, 198.50, 203.00, 178.10, 200.00)
[benchmark]   Average Memory usage: 1506.77 MB (1742.04, 1453.37, 1455.98, 1438.85, 1443.59)
[benchmark]   Peak Memory usage: 2335.48 MB (3000.09, 2137.67, 2118.84, 2190.41, 2230.37)
  • v8, no DL, Node 10.10.0
$ benchmark -- ng build --prod
[benchmark] Benchmarking process over 5 iterations, with up to 5 retries.
[benchmark]   ng build --prod (at D:\sandbox\memory-debug\super-productivity\v8)
[benchmark] Process Stats
[benchmark]   Elapsed Time: 137125.80 ms (134088.00, 140877.00, 137668.00, 139447.00, 133549.00)
[benchmark]   Average Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Peak Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Average CPU usage: 10.91 % (10.27, 11.17, 11.13, 11.15, 10.82)
[benchmark]   Peak CPU usage: 155.30 % (143.80, 154.70, 164.00, 153.10, 160.90)
[benchmark]   Average Memory usage: 944.34 MB (948.63, 948.80, 960.01, 950.97, 913.27)
[benchmark]   Peak Memory usage: 1664.48 MB (1723.53, 1670.94, 1670.71, 1684.96, 1572.24)
  • v8, no DL, Node 12.3.1
[benchmark] Benchmarking process over 5 iterations, with up to 5 retries.
[benchmark]   ng build --prod (at D:\sandbox\memory-debug\super-productivity\v8)
[benchmark] Process Stats
[benchmark]   Elapsed Time: 138378.80 ms (136618.00, 140146.00, 136281.00, 139331.00, 139518.00)
[benchmark]   Average Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Peak Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Average CPU usage: 10.63 % (10.72, 10.78, 10.38, 10.12, 11.17)
[benchmark]   Peak CPU usage: 154.38 % (162.50, 148.40, 167.20, 145.30, 148.50)
[benchmark]   Average Memory usage: 1173.09 MB (1182.91, 1179.12, 1162.80, 1162.17, 1178.46)
[benchmark]   Peak Memory usage: 2064.48 MB (2104.92, 2113.08, 2071.26, 2007.69, 2025.45)
  • v7, Node 10.10.0
$ benchmark -- ng build --prod
[benchmark] Benchmarking process over 5 iterations, with up to 5 retries.
[benchmark]   ng build --prod (at D:\sandbox\memory-debug\super-productivity\v7)
[benchmark] Process Stats
[benchmark]   Elapsed Time: 126331.00 ms (115769.00, 114542.00, 127353.00, 144113.00, 129878.00)
[benchmark]   Average Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Peak Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Average CPU usage: 12.75 % (11.16, 10.43, 12.28, 15.91, 13.96)
[benchmark]   Peak CPU usage: 160.92 % (175.00, 139.10, 140.60, 185.90, 164.00)
[benchmark]   Average Memory usage: 850.62 MB (851.26, 851.57, 859.25, 837.64, 853.40)
[benchmark]   Peak Memory usage: 1456.63 MB (1458.19, 1463.49, 1470.42, 1447.42, 1443.61)
  • v7, Node 12.3.1
[benchmark] Benchmarking process over 5 iterations, with up to 5 retries.
[benchmark]   ng build --prod (at D:\sandbox\memory-debug\super-productivity\v7)
[benchmark] Process Stats
[benchmark]   Elapsed Time: 128415.80 ms (121753.00, 121720.00, 124237.00, 143535.00, 130834.00)
[benchmark]   Average Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Peak Process usage: 1.00 process(es) (1.00, 1.00, 1.00, 1.00, 1.00)
[benchmark]   Average CPU usage: 12.02 % (11.37, 11.24, 12.02, 13.66, 11.79)
[benchmark]   Peak CPU usage: 155.96 % (160.90, 175.10, 176.60, 186.00, 81.20)
[benchmark]   Average Memory usage: 1126.36 MB (1138.10, 1105.06, 1135.59, 1126.35, 1126.68)
[benchmark]   Peak Memory usage: 1892.42 MB (1864.26, 1773.99, 2055.74, 1777.96, 1990.18)

filipesilva avatar Jun 07 '19 13:06 filipesilva

My conclusions are this point are:

  • I see increased memory usage just from using Node 12:
    • Super-productivity showed peak 1753 MB on v8, DL, Node 10.10.0 vs 2335 MB v8, DL, Node 12.3.1
  • I see about 15% extra memory usage between v7 and v8 for the same (non DL) case:
    • Super-productivity showed peak 1664 MB on v8, no DL, Node 10.10.0 vs 1456 MB v7, Node 10.10.0
    • Super-productivity showed peak 2064 MB on v8, no DL, Node 12.3.1 vs 1892 MB v7, Node 12.3.1
  • On Windows, the peak process usage is always 1. Our minifier plugin (Terser) is the only thing that uses extra processes. I think it's not using them on windows, I don't know why. Maybe I'll investigate it later. But it's not super relevant for memory usage because parallelizing something will always use more memory, even if it's not a lot. Might be related though.

I have gathered a few more example repositories, but after doing all these benchmarks manually I think I have to automate this. I really should have automated it from the start really. So I'll set up a repository that does this using CI.

filipesilva avatar Jun 07 '19 14:06 filipesilva