Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constant CPU usage on watch #634

Closed
Vasiliy-Bondarenko opened this issue Aug 22, 2014 · 9 comments
Closed

constant CPU usage on watch #634

Vasiliy-Bondarenko opened this issue Aug 22, 2014 · 9 comments

Comments

@Vasiliy-Bondarenko
Copy link

i see constant CPU usage around 12% on quite small number of files. ~230 *.php files.
no files changing at that time, no other watchers, no action at all.

CPU: i7 2.2
Mac OS X 10.9.4
node -v
v0.10.30
gulp -v
[02:08:51] CLI version 3.8.7
[02:08:51] Local version 3.8.7

watcher:

gulp.task('default', function (){
    gulp.watch('_lara/app/**/*.php', ['codecept']);
})
@yocontra
Copy link
Member

cc @shama

@shama
Copy link

shama commented Aug 23, 2014

Try increasing the interval. By default it is 100ms which for some environments hits the CPU usage:

gulp.task('default', function (){
    gulp.watch('_lara/app/**/*.php', { interval: 500 }, ['codecept']);
})

@Vasiliy-Bondarenko
Copy link
Author

it helps quite well.
is it happens bacause of nodejs or some deep system-level stuff? aniviruses watch for all files on file system and have no problems :)

@shama
Copy link

shama commented Aug 27, 2014

I'm not sure. Two users with the apparent same environment, 100ms works for one but raises the CPU for the other. My guess is it's the hardware or how the disk is organized causing the stat calls to take longer.

The next version only uses native OS events. More comparable to how applications installed with admin privileges watch files, such as antivirus programs. There are a couple issues outstanding preventing the update though. Please follow this issue for updates: shama/gaze#137

@yocontra
Copy link
Member

yocontra commented Sep 1, 2014

Merging into #651

@yocontra yocontra closed this as completed Sep 1, 2014
@griiettner
Copy link

I Tried the solution posted by @shama, but it did not do any change on CPU usage for my mac very similar to @Vasiliy-Bondarenko

@pkyeck
Copy link

pkyeck commented Oct 24, 2014

works for me on a i7 3.0GHz MBP. thanks for the tip.

@starikovs
Copy link

Ubuntu 14.04.1 LTS the same bug, 12% of cpu.
If I set "interval: 500", ~3% of cpu constantly.
Anyway, thanks for the tip!

@unphased
Copy link

Hey guys, so... CPU usage should be 0% because polling is wrong. Does anybody agree?

I mean, I would use slightly less strong phrasing if this is actually a point of contention. But I mean... this is 2015. There are filesystem APIs.

@gulpjs gulpjs locked and limited conversation to collaborators Sep 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants