net.box: avoid unnecessary syscalls when socket is ready most of the time
Don't run event loop if socket is ready to write. *Always* write optimistically. With fiber.channel(), channel push wakes up the waiter without in the same event loop iteration. This means that whenever we have data on an incoming connection, we can push messages to outgoing connections in the same iteration, without epoll_ctl syscalls or unnecessary epoll_wait. With 1 incoming and 5 outgoing connections, for example, this saves ~10 syscalls per each incoming request.
Loading
Please register or sign in to comment