EthernetFace: workaround with kqueue and Boost 1.56.0
EthernetFace obtains a file descriptor from
pcap_get_selectable_fd API, and passes it to Boost.Asio.
On OS X and FreeBSD, Boost.Asio uses kqueue as an alternate to
poll syscall, in order to gain better performance.
Since Boost 1.56, Boost.Asio's usage of kqueue becomes incompatible with libpcap's file descriptor.
Attempting to create an EthernetFace causes runtime error.
Although it's possible to disable kqueue and revert to
poll syscall, the performance would be worse than using kqueue.
Therefore, EthernetFace is forcibly disabled on platforms with kqueue, when NFD is compiled with Boost 1.56 or above.
This Task is to find a workaround, so that EthernetFace can work with kqueue and Boost 1.56.0.
#5 Updated by Junxiao Shi about 5 years ago
OSX poll(2) manpage doesn't mention a limit on how many file descriptors can be monitored in this syscall, so I believe the limit on file descriptors isn't a problem.
It's useful to know how much overhead would we incur if we disable kqueue and revert to
Currently I do not know how to design a benchmark that is suitable to the specific use case of NFD.
http://www.kegel.com/dkftpbench/Poller_bench.html has a generic benchmark with results from FreeBSD 4.x on 600MHz CPU:
- with 100 socketpairs:
- with 1000 socketpairs:
- with 10000 socketpairs:
Typically NFD would operate with less than 200 sockets, and today's CPU is 1.8GHz or faster.
polls per second should be reasonable for an end node. It would takes 1.7ms, or 0.17% of total time.
A busy router node has more packets to process and more events in the scheduler, so there could 5000
polls per second.
That's 83ms per second, or 8.3% of total time. This seems too much.
#9 Updated by Davide Pesavento almost 5 years ago
- Status changed from New to Code review
- Target version changed from Unsupported to v0.3
- % Done changed from 0 to 100
If disabling for boost == 1.56.0 is an acceptable resolution for this task, good. Otherwise it should be rejected because we're not going to implement any other workarounds.