ng serve uses a lot of CPU %
Mac OSX El Capitan
Versions.
angular-cli: 1.0.0-beta.17 node: 5.7.1 os: darwin x64
angular-cli uses about 85% CPU when I only use ng serve during development, also when I'n not changing code but just use the webapp in a browser.
Increasing the polling interval is enough to calm down the watching and will work even on non *nix.
I helped our Windows guys with their overeager virus scanners in the past.
same issue here
Angular CLI: 6.1.1
Node: 10.7.0
OS: darwin x64
Angular: 6.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.7.1
@angular/cli 6.1.1
@ngtools/webpack 6.0.8
@schematics/angular 0.7.1
@schematics/update 0.7.1
rxjs 6.2.2
typescript 2.7.2
webpack 4.8.3
Still seems to be an issue with CLI v 5.0.0.
Fixed with fsevents. My ng process CPU usage went from 80-100% all the time down to a max of 8% only while compiling otherwise it's at 0 as expected.
This is still definitely an issue on linux in CLI 6.2.2
Angular CLI: 6.2.2
Node: 8.12.0
OS: linux x64
Angular: 6.1.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.8.2
@angular-devkit/build-angular 0.8.2
@angular-devkit/build-optimizer 0.8.2
@angular-devkit/build-webpack 0.8.2
@angular-devkit/core 0.8.2
@angular-devkit/schematics 0.8.2
@angular/cli 6.2.2
@ngtools/webpack 6.2.2
@schematics/angular 0.8.2
@schematics/update 0.8.2
rxjs 6.3.2
typescript 2.9.2
webpack 4.19.1
This is a major issue when running within a Vagrant machine for example. When I run this on my host machine (OSX) everything if fine with fsevents, but using poll in linux on the VM, both cores will steadily be at 80-90%+ usage.
@filipesilva Any chance at getting this issue re-opened? It still seems to be an issue.
I had experienced it a few months ago on an older version of CLI and Angular but just finished doing a complete upgrade in the hopes this issue would be resolved in later versions. Sadly it is not.
In my other custom Webpack configs for other watchers, I normally have
watchOptions: {
ignored: /node_modules/,
aggregateTimeout: 300,
poll: 1000
},
and that works great within Vagrant, without much CPU usage. Based on what I'm seeing in this repo when searching for watchOptions, I only ever see the poll flag set, nothing for ignored. Is it possible it's trying to watch the whole node_modules folder as well resulting in high CPU usage?
With some local exploration, I've found that adding the following to the watchOptions in the common webpack config resolved CPU usage issues in a Vagrant setup and allowed or 1 second polling without high CPU usage.
packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts#L264
watchOptions: {
ignored: /node_modules/,
aggregateTimeout: 300,
poll: buildOptions.poll
},
With that, instead of adding more flags for what to put into watchOptions, it'd be great to be able to specify the whole watch options block instead of just the poll option. Just in case this causes issues for other setups.
I can look into setting up a PR but it may take a while as I familiarize myself with the process for this project.
Hopefully the ignored flag can be exposed via #12313
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.