RFR: 8253478: (se) epoll Selector should use eventfd for wakeup instead of pipe

Brian Burkhalter bpb at openjdk.java.net
Tue Jan 19 22:24:48 UTC 2021


On Mon, 18 Jan 2021 09:04:24 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Throughput improvement as measured by the benchmark looks to be a bit over 3% for eventfd wakeup with respect to pipe wakeup. The confidence intervals of the pipe wakeup results mostly do not overlap those of the corresponding eventfd wakeup results which tends to suggest some degree of reliability.
>> 
>> Summary of benchmark results:
>> 1 fork, 5 10s warmup iterations, 10 10s measurement iterations, 1 thread
>> pipe wakeup
>> 
>> Mean average: 675594.1653333333
>> Max CI upper bound: 679184.706
>> 
>> eventfd wakeup
>> 
>> Mean average: 700086.3053333334
>> Min CI lower bound: 695349.503
>> Throughput change: +3.6%
>> 
>> 1 fork, 5 10s warmup iterations, 10 10s measurement iterations, 6 threads
>> pipe wakeup
>> 
>> Mean average: 3242398.7919999994
>> Max CI upper bound: 3317898.431
>> 
>> eventfd wakeup
>> 
>> Mean average: 3346113.4013333335
>> Min CI lower bound: 3298038.123
>> Throughput change: +3.2%
>
> Are you going to include the micro benchmark in the patch? The presentation of the summary in the comments is hard to read but a 3% is okay. It was inconclusive when I tried a long time ago.
> 
> The updated patch looks better. IOUtil.write(fd, long) begs the question as to whether the 8 bytes for the long are written in big or little endian. I realise it doesn't matter for EventFD but we will need to get this right. I would be tempted to call evetnfd with the flags set to 0 and then use IOUtil.configureBlocking when we need it non-blocking.

Updated the patch to:
- include the micro benchmark,
- create the `eventfd` with zero initial value and flags,
- use `IOUtil.configureBlocking()` to set the `eventfd` to non-blocking,
- remove the addition of `IOUtil.write(int fd, long value)` and its use in `EventFD.set()`,
- add `EventFD.set0()` and use it in `EventFD.set()`.

-------------

PR: https://git.openjdk.java.net/jdk/pull/2082


More information about the nio-dev mailing list