What are the main differences between select, epoll, kqueue and evport?
I recently read Redis. Redis implements a simple event driven library based on I / O multiplexing. Redis says it would pick the best multiplexing supported by the system and gives the following code:
/* Include the best multiplexing layer supported by this system.
* The following should be ordered by performances, descending. */
#ifdef HAVE_EVPORT
#include "ae_evport.c"
#else
#ifdef HAVE_EPOLL
#include "ae_epoll.c"
#else
#ifdef HAVE_KQUEUE
#include "ae_kqueue.c"
#else
#include "ae_select.c"
#endif
#endif
#endif
I want to know if they have fundamental performance differences? If so, why?
Regards
source to share
In general, all Async I / O subsystems have different internal components, but in the current particular case, these particular asynchronous I / O libraries are used to support as many platforms as possible. I.e:
- evport = Solaris 10
- epoll = Linux
- kqueue = OS X, FreeBSD
- select = is usually set on all platforms as
fallback
Evport
, Epoll
and KQueue
have an O (1) complexity of the descriptor selection algorithm , and they all use the internal memory structures of the kernel space. Also, they can serve lots (hundreds of thousands) file descriptors .
Apart from the rest, it select
can only serve descriptors up to 1024 and does a full scan of the descriptors (so every time it iterates through all the descriptors to pick one to work with), so the complexity is O (n) .
source to share