What is optimal value for fs.inotify.max_user_watches?


I came across this blog post which suggests half-million as suggested fs.inotify.max_user_watches value. But, I came to know that each watch consumes ~900 bytes (on 64-bit architecture). So, half-million watches implies ~400MB of memory (kernel memory), and kernel memory is not swappable.

I have few questions regarding this value:

Is this the optimal value of fs.inotify.max_user_watches?
Is inotify is recommended to watch half=million of handles/directories?
What happens if I specify a lower value than needed?
What happens if I dont use inotify at all?


Comment actions Permalink

Hello Chandra,

unused watch handles consume no memory. AFAIK they aren't shared: i.e. two programs watching same directory require two watch handles. If run out of watches IDEA shows a warning and reverts to recusive directory scan for changes.

Comment actions Permalink

thanks for the clarification.


Please sign in to leave a comment.