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

Extremely large number of filesystem calls for single-file watches #134

Open
bendavis78 opened this issue Mar 29, 2021 · 2 comments
Open

Comments

@bendavis78
Copy link

When a watching a single file, I'm seeing an extremely large number of filesystem calls. This is a big issue when it comes to network mounted storage, especially in cases of where a cloud provider might charge per transaction.

I'm hosting my app (Theia) on Azure, which uses Azure Files for persistent storage, and I'm seeing thousands of transactions per minute, even when idle:

image

It seems that nsfw uses polling to watch individual files. Is there an option to disable polling and use inotify instead? What is the reason that nsfw has to use polling and not inotify?

@implausible
Copy link
Contributor

It's because tracking the delete and creation of a file can't be done without file polling. Single file watching through NSFW is deliberately not as performant as it could be due to the requirements for its interface. I would not recommend using nsfw in single file mode if you're manually setting up a ton of individual watches. Instead opt to watch the directory that will contain the files you care about, and then trigger your behavior when the file you care about shows up in the events callback.

@bendavis78
Copy link
Author

delete and creation of a file can't be done without file polling

Couldn't this be done by watching the parent directory and filtering events based on the file name? Are there use cases in which polling would be preferable to watching the parent directory?

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

No branches or pull requests

2 participants