netty5/transport-native-epoll
Nick Hill 250b279bd9 Epoll: Avoid redundant EPOLL_CTL_MOD calls (#9397)
Motivation

Currently an epoll_ctl syscall is made every time there is a change to
the event interest flags (EPOLLIN, EPOLLOUT, etc) of a channel. These
are only done in the event loop so can be aggregated into 0 or 1 such
calls per channel prior to the next call to epoll_wait.

Modifications

I think further streamlining/simplification is possible but for now I've
tried to minimize structural changes and added the aggregation beneath
the existing flag manipulation logic.

A new AbstractChannel#activeFlags field records the flags last set on
the epoll fd for that channel. Calls to setFlag/clearFlag update the
flags field as before but instead of calling epoll_ctl immediately, just
set or clear a bit for the channel in a new bitset in the associated
EpollEventLoop to reflect whether there's any change to the last set
value.

Prior to calling epoll_wait the event loop makes the appropriate
epoll_ctl(EPOLL_CTL_MOD) call once for each channel who's bit is set.

Result

Fewer syscalls, particularly in some auto-read=false cases. Simplified
error handling from centralization of these calls.
2019-08-19 09:06:41 +02:00
..
src Epoll: Avoid redundant EPOLL_CTL_MOD calls (#9397) 2019-08-19 09:06:41 +02:00
pom.xml Fix native-build/target/lib wanted but build in native-build/target/lib64 (#9410) 2019-08-07 07:58:04 +00:00
README.md Change the netty.io homepage scheme(http -> https) (#9344) 2019-07-09 21:10:14 +02:00

Native transport for Linux

See our wiki page.