# kqueues & kern.kq_calloutmax



## Peter Eriksson (Oct 10, 2017)

Is there some way to (using an external program) monitor the kqueue resources in the kernel? I think we are running into the default 4096 limit (kern.kq_calloutmax) on our Samba servers - but I'd like to add a nagios check to verify that....

(I've increased it into 8192 and have my fingers crossed that it solves the problem now).

Samba 4.7.0 on a FreeBSD 11.0 server with >200 concurrent users, and we found an smbd process with thousands of open file descriptors - looks like the inotify-kqueue emulation in action (libinotify). 

At the time when we are starting to have problems the number of open fd's goes over 4k in that process...


----------



## Crest (Feb 12, 2018)

The kern.kq_calloutmax sysctl isn't related to open files per queue or process. Instead it limits the number timers that may be created through kqueue system wide. It is better to store events in a time ordered priority queue and invoke the kevent() syscall with the min() of that queue as timeout.


----------

