使用Linux合理的inotify手表数量是多少? [英] What is a reasonable amount of inotify watches with Linux?

查看:95
本文介绍了使用Linux合理的inotify手表数量是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个守护程序,该守护程序通过inotify监视文件事件,以在访问文件时触发各种类型的事件.我读到手表有些贵,因为内核存储着每个被监视文件的全路径名.

I am working on a daemon that monitors file events via inotify to trigger various types of events when files are accessed. I have read that watches are a little expensive, because the Kernel is storing the full path name of every file being watched.

多少手表会太多?

大多数情况下,我想知道..您是否曾经见过明显的性能下降,如果有的话,它发生了多少只手表?是的,我必须进行监视/递归(但是它是最小的自举系统).

Mostly, I'm wondering .. have you ever seen a noticeable performance hit, if so, at how many watches did it happen? Yes, I have to monitor / recursively (however its a minimal bootstrapped system).

推荐答案

AFAIK内核不是存储路径名,而是存储inode.但是,在32位系统上,每个Watch仍有540个字节.在64位上加​​倍.

AFAIK the kernel isn't storing the pathname, but the inode. Nevertheless, there are 540 bytes per Watch on a 32bit system. Double as much on 64bit.

我从Lsyncd知道(也许您想检查一下?)拥有100万只手表的人.它只是占用了1G的内存.

I know from Lsyncd (maybe you want to check that out?) people who have a million watches. It just eats a Gigabyte of memory.

这篇关于使用Linux合理的inotify手表数量是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆