Configuring Linux for many Watch Folders
To run many (>100) push Watch Folders on Linux® computers, adjust three system settings and then reload the sysctl.conf file to activate them.
Procedure
-
Increase the maximum number of watches allowed by the system.
Retrieve the current value by running the following command:
$ cat /proc/sys/fs/inotify/max_user_watches 8192To permanently increase the number of available watches (to a value that is greater than the number of files to watch, such as 524288), add the configuration to /etc/sysctl.conf:
$ sudo echo "fs.inotify.max_user_watches=524288" >> /etc/sysctl.conf -
Increase the maximum number of notify instances, which correspond to the number of allowed
Watch Services instances.
Retrieve the current value by running the following command:
$ cat /proc/sys/fs/inotify/max_user_instances 128On many systems, the default value is 128, which means that only 128 watches can be created. To permanently increase the number available (to a value that is greater than the number of wanted Watch Folder instances, such as 1024), add the configuration to /etc/sysctl.conf:
$ sudo echo "fs.inotify.max_user_instances=1024" >> /etc/sysctl.conf -
Increase the open file limit.
Retrieve the current value by running the following command:
$ cat /proc/sys/fs/file-max 794120To permanently increase the open file limit (to a value that is greater than the number of wanted watches, such as 2097152), add the configuration to /etc/sysctl.conf:
$ sudo echo "fs.file-max=2097152" >> /etc/sysctl.conf -
Reload
systemdsettings to activate the new settings.To reloadsystemdsettings, either restart the machine or run the following command:$ sudo sysctl -p /etc/sysctl.conf