-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve main event loop #264
Comments
After digging into the code and doing a survey of the available libraries out there, we settled on libuv (https://github.com/libuv/libuv). It handles file descriptors directly, which means it can handle all of the current input sources. It also has built-in support for DNS lookups which means the code in |
I ran into what might be an issue with libuv: libuv/libuv#2428 |
Here's the layout of the work to be done and a priority list. Work to be done:
Priority list:
|
Another issue with using libuv that we need to resolve is that they require CMake 3.x. The current limiting factor for this is CentOS 7, which comes with 2.8.12 by default. CMake 3 is available via the |
Updating to cmake3 seems reasonable, that's been our for 5 years. I'll create a separate ticket for that. |
Some observations from a week of working with libuv: Poll timeout is set to zero if we use This is fine for things that have real file descriptors, since the poll will block for packet sources that are interfaces and for broker, or it will fire based on a timer being ready. The existing thread manager code doesn't return any file descriptors and so it currently doesn't have a say in when I haven't dug super-far into how the existing timers work yet. libuv timers fire based on a millisecond timeout from when The real problem with the looping is in the case of pcap files. With pcap files, we actually want the loop to spin as fast as it can, only it will ignore packet data when in psuedo-realtime mode and the timestamp hasn't been met yet. I'm considering just making this a See http://docs.libuv.org/en/v1.x/design.html#the-i-o-loop for more info on how the poll loop works. |
The things I haven't really dug into yet:
|
This is done via #681 |
The main event loop has always been a bit of a nuisance -- primary problems seem to be that devs find it hard to understand and also there's high-ish CPU utilization even in situations where it should be mostly idling.
Here's an old reference with other thoughts/ideas that I'm not sure are still relevant: https://bro-tracker.atlassian.net/browse/BIT-1388
A concrete project would be to test out porting the event loop to use something like
libev
orlibuv
(or other event library) and seeing what results from it.The text was updated successfully, but these errors were encountered: