Conversation
Notices
-
Embed this notice
feld (feld@friedcheese.us)'s status on Saturday, 12-Apr-2025 14:38:37 JST feld
@zirias @pertho suppose you could watch a path with dtrace, I've done that before with a script so it must be possible to do it reliably -
Embed this notice
Felix Palmen :freebsd: :c64: (zirias@mastodon.bsd.cafe)'s status on Saturday, 12-Apr-2025 14:38:39 JST Felix Palmen :freebsd: :c64:
@pertho The only little drawback compared to epoll is the lack of atomic signal mask setting, so you need a bit more code and a thoughtful structure to handle signals in the same loop. Apart from that, indeed much better than #epoll.
Unfortunately, it's not beter than inotify (for a completely different purpose, #file #monitoring ... kqueue covers them all). With #inotify, you can for example set a #watch by path, while #kqueue requires opened file descriptors. 😞
-
Embed this notice
Tom (pertho@mastodon.bsd.cafe)'s status on Saturday, 12-Apr-2025 14:38:40 JST Tom
@zirias And kqueue is so much better than Linux's epoll
-
Embed this notice
Felix Palmen :freebsd: :c64: (zirias@mastodon.bsd.cafe)'s status on Saturday, 12-Apr-2025 14:38:41 JST Felix Palmen :freebsd: :c64:
Well, tried it. Works! 🥳
Accepting a whole list of changes (so you can buffer them during an event loop iteration) and then even submitting them in the same call that receives events (with the changes already applied) is *indeed* a pretty cool thing with #kqueue.
https://github.com/Zirias/poser/commit/4630d6a8b87284da21097c30ea8a6ba02cc40df6
-
Embed this notice
Felix Palmen :freebsd: :c64: (zirias@mastodon.bsd.cafe)'s status on Saturday, 12-Apr-2025 14:38:43 JST Felix Palmen :freebsd: :c64:
First change since #swad 0.2 will actually be a (huge?) improvement to my #poser lib. So far, it was hardwired to use the good old #POSIX #select call. This is perfectly fine for handling around up to 100 (or at least less than 1000, YMMV) clients.
Some #select implementations offer defining the upper limit for checked file descriptors. Added support for that.
POSIX also specifies #poll, which has very similar #scalability issues, but slightly different. Added support for this as well.
And then, I went on to add support for the #Linux-specific #epoll and #BSD-specific #kqueue (#FreeBSD, #NetBSD, #OpenBSD, ...) which are both designed to *solve* any scalability issues 🥳
A little thing that slightly annoyed me about kqueue was that there's no support for temporarily changing the signal mask, so I had to do the silly dance shown in the screenshot. OTOH, it offers changing event filters and getting events in a single call, which I might try to even further optimize ... 😎
-
Embed this notice