Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Commit ee04d53

Browse files
author
Jonathan Yu
committed
code review comments
1 parent b06d7f9 commit ee04d53

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

guides/admin/inotify-watch-limits.md

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@ title: Troubleshooting inotify Watcher Limit Problems
33
description: Learn how to resolve problems related to the inotify Watcher Limit.
44
---
55

6-
The [`inotify` facility] allows programs to monitor files and directories for
7-
changes, so that they will receive an event immediately whenever a user or
8-
program modifies the file or directory. Many such programs can fall back to
9-
periodically checking files and directories for changes, also known as polling.
10-
Using polling avoids the watch limit, but may result in higher system loading
11-
and a longer interval for the program to detect changes.
6+
The [`inotify` facility] allows programs to monitor files for changes, so that
7+
they will receive an event immediately whenever a user or program modifies the
8+
file. Many such programs can fall back to periodically checking files for
9+
changes, also known as polling. Using polling avoids the watch limit, but may
10+
result in higher system loading and a longer interval for the program to detect
11+
changes.
1212

1313
`inotify` requires kernel resources (memory and processor) for each file it
1414
tracks. As a result, the Linux kernel limits the number of file watchers that
1515
each user can register. The default settings vary according to the host system
16-
distribution; on Ubuntu 20.04 LTS, the default limit is 8,192 watches per instance
16+
distribution; on Ubuntu 20.04 LTS, the default limit is 8,192 watches per
17+
instance.
1718

1819
[`inotify` facility]: https://en.wikipedia.org/wiki/Inotify
1920

@@ -38,13 +39,13 @@ it is likely that you are encountering this limit.
3839

3940
There are three kernel tuning options related to the `inotify` system:
4041

41-
- `fs.inotify.max_queued_events`, which defines an upper bound on the number of
42-
file notification events pending delivery to programs.
43-
- `fs.inotify.max_user_instances`, which determines the maximum number of
44-
`inotify` instances per user. Programs using `inotify` will typically create
45-
a single _instance_, so this limit is unlikely to cause issues.
46-
- `fs.inotify.max_user_watches`, which defines the maximum number of files and
47-
folders that programs can monitor for changes.
42+
- `fs.inotify.max_queued_events`: the upper bound on the number of file
43+
notification events pending delivery to programs.
44+
- `fs.inotify.max_user_instances`: the maximum number of `inotify` instances
45+
per user. Programs using `inotify` will typically create a single _instance_,
46+
so this limit is unlikely to cause issues.
47+
- `fs.inotify.max_user_watches`: the maximum number of files and folders that
48+
programs can monitor for changes.
4849

4950
For additional detail regarding the `inotify` system, please see
5051
[inotify(7)](https://man7.org/linux/man-pages/man7/inotify.7.html).
@@ -90,8 +91,8 @@ for its usage.
9091

9192
[`inotify-consumers`]: https://github.com/fatso83/dotfiles/blob/master/utils/scripts/inotify-consumers
9293

93-
To see the specific files and directories that the tools track for changes, you
94-
can use `strace` to monitor invocations of the `inotify_add_watch` system call:
94+
To see the specific files that the tools track for changes, you can use `strace`
95+
to monitor invocations of the `inotify_add_watch` system call:
9596

9697
```console
9798
$ strace --follow-forks --trace='inotify_add_watch' inotifywait --quiet test
@@ -104,10 +105,12 @@ to the `test` file.
104105
## Resolution
105106

106107
If you encounter the file watcher limit, there are two potential resolutions:
107-
either reduce the number of file watcher registrations, or increase the maximum
108-
file watcher limit. We recommend attempting to reduce the file watcher
109-
registrations first, because increasing the number of file watches may result
110-
in high processor utilization.
108+
109+
1. Reduce the number of file watcher registrations; or,
110+
1. Increase the maximum file watcher limit.
111+
112+
We recommend attempting to reduce the file watcher registrations first, because
113+
increasing the number of file watches may result in high processor utilization.
111114

112115
### Reduce watchers
113116

0 commit comments

Comments
 (0)