Skip to content

Low-cost monitoring of directory file changes

Notifications You must be signed in to change notification settings

zemul/go-fanotify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

中文 English

go-fanotify - High-Performance Linux Filesystem Monitoring Library

go-fanotify

go-fanotify is a Go language wrapper for the fanotify monitoring library, designed for efficient Linux filesystem event listening. It is particularly useful for large-scale directory monitoring. Compared to inotify, fanotify can monitor an entire mount point or a specified directory with lower resource consumption.

Features

  • Low resource usage, suitable for large directories
  • Supports monitoring multiple directories simultaneously
  • Provides a Go API for easy integration

fanotify Details

fanotify man page

Why Choose fanotify?

Feature go-fanotify Traditional inotify
Monitoring Scope Covers entire mount point Requires recursive addition of subdirectories
Kernel Resource Usage O(1) constant consumption O(n) linear growth
Monitoring Millions of Files Single monitor point Requires thousands of inotify watches
Dynamic Subdirectories Automatically includes newly created subdirectories Must be manually tracked and added
Event Latency ~0.5ms on average 2-5ms on average

Advantages Over inotify

Compared to inotify, fanotify is more suitable for large-scale directory monitoring due to:

  • inotify requiring recursive directory monitoring, while fanotify can directly watch an entire mount point.
  • Lower event processing overhead with fanotify.
  • Ideal for use cases such as security auditing, cache invalidation, and file access monitoring.

About

Low-cost monitoring of directory file changes

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages