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

Linux: Watching large directories is still pegging CPU #860

Closed
bpasero opened this issue May 28, 2019 · 10 comments
Closed

Linux: Watching large directories is still pegging CPU #860

bpasero opened this issue May 28, 2019 · 10 comments
Labels

Comments

@bpasero
Copy link

bpasero commented May 28, 2019

Describe the bug
I am giving [email protected] a try to see if watching large directories still keeps the CPU busy or not. My simple test shows no difference to previous versions so I wonder if there is a new option that is needed.

Versions (please complete the following information):

  • Chokidar version: 3.0.0
  • Node version: 10.15.1
  • OS version: Linux p520 4.15.0-50-generic #54-Ubuntu SMP Mon May 6 18:46:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

To Reproduce

const chokidar = require("chokidar");

const watcher = chokidar.watch('/', {
    ignoreInitial: true,
    ignorePermissionErrors: true
});

image

Expected behavior
By default, I would expect to not see high CPU spikes when watching. I think the default options should optimise for low hits on CPU.

Additional context
High CPU from watching large folders is an issue VSCode users are reporting very often (microsoft/vscode#3998).

PS: this is the first time I see how many processes chokidar produces when looked at via htop, any clues?

@bpasero bpasero changed the title Chokidar: watching large directories is still pegging CPU Chokidar 3.0.x: watching large directories is still pegging CPU May 28, 2019
@paulmillr
Copy link
Owner

Yeah, the fact it creates many processes is not normal. I haven’t saw this behavior while testing the lib. Can you try watching NOT root directory? There are a few files that may break something. Perhaps watch user directory.

@bpasero
Copy link
Author

bpasero commented May 28, 2019

@paulmillr pretty much the same when watching just home:

image

Btw I see those flood of processes even appearing when watching a folder that does not exist...

@paulmillr
Copy link
Owner

that’s not normal at all. I wonder what’s the difference here.

@bpasero
Copy link
Author

bpasero commented May 28, 2019

Almost looks like node was using some kind of clustering. I have never seen this before.

@paulmillr
Copy link
Owner

Could you see whether there's any difference after upgrading to node 12.x?

@paulmillr
Copy link
Owner

Also, try chokidar@master — we've changed a few things...

@bpasero
Copy link
Author

bpasero commented May 29, 2019

@paulmillr same result with node.js 12.3.1 and master: high CPU and multiple node processes.

On macOS I see high CPU but just a single node process.

@paulmillr paulmillr changed the title Chokidar 3.0.x: watching large directories is still pegging CPU Linux: Watching large directories is still pegging CPU Aug 13, 2019
@paulmillr
Copy link
Owner

paulmillr commented Sep 30, 2019

3.2 should fix this.

@vilicvane
Copy link

@paulmillr Does this issue affect version ^2?

@paulmillr
Copy link
Owner

No, you should upgrade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants