[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-nio-dev
Subject: Re: RFR: 8266369: (se) Add wepoll based Selector [v8]
From: Brian Burkhalter <bpb () openjdk ! java ! net>
Date: 2021-05-07 22:54:53
Message-ID: kgns-AGpDXomiXppor1grgCQhxG-pC1aonRYUaxEsoE=.731a04d2-2347-4f70-b872-8926053dfcdb () github ! com
[Download RAW message or body]
On Fri, 7 May 2021 07:31:17 GMT, Alan Bateman <alanb@openjdk.org> wrote:
> > This PR proposes a new Selector implementation for the Windows platform based on \
> > the Bert Belder's "wepoll" library. The wepoll library provides a scalable \
> > polling interface to the Ancillary Function Driver for Winsock. The interface \
> > that it exposes is close to the Linux epoll interface. The main benefit is that \
> > the cost of selection operations are a function of the number of sockets that are \
> > ready for I/O rather than the number of channels registered with the Selector. \
> > The existing Selector on Windows uses the legacy "select" which scales horribly, \
> > partly because it's O(N) on the number of registered channels and partly because \
> > it is limited to 1024 sockets and so requires a thread per 1024 sockets.
> > The patch brings the wepoll sources into the repo, adds a small shim, and the \
> > Selector implementation itself. The new implementation needs to handle OOB data \
> > in the same way as the old implementation so the method to discard OOB moves to \
> > Net.
> > I've added a microbenchmark to demonstrate the scaling when there is 1, 10, ... \
> > 10k connections and one socket ready for I/O. Windows Server 2019 was used for \
> > the data here. I've seen improvements with almost everything that I've tried. The \
> > only exception is a select after a wakeup where the old implementation skips the \
> > selection operation (arguably a long standing bug in the old implementation).
> > Existing select based Selector where the selection operation is almost 1ms when \
> > there are 10,000 channels registered.
> > Benchmark (nchannels) Mode Cnt Score Error Units
> > SelectOne.testSelectOne 1 avgt 20 1587.429 ± 4.053 ns/op
> > SelectOne.testSelectOne 10 avgt 20 2515.324 ± 8.141 ns/op
> > SelectOne.testSelectOne 100 avgt 20 10903.445 ± 65.508 ns/op
> > SelectOne.testSelectOne 1000 avgt 20 101651.369 ± 673.781 ns/op
> > SelectOne.testSelectOne 10000 avgt 20 932032.385 ± 59004.246 ns/op
> >
> >
> > New wepoll based Selector:
> >
> > Benchmark (nchannels) Mode Cnt Score Error Units
> > SelectOne.testSelectOne 1 avgt 20 1428.914 ± 6.648 ns/op
> > SelectOne.testSelectOne 10 avgt 20 1429.806 ± 5.537 ns/op
> > SelectOne.testSelectOne 100 avgt 20 1433.371 ± 3.253 ns/op
> > SelectOne.testSelectOne 1000 avgt 20 1435.007 ± 12.420 ns/op
> > SelectOne.testSelectOne 10000 avgt 20 1445.201 ± 7.902 ns/op
> >
> >
> > Replacing the Selector implementation after 19 years of service is a big step. \
> > The proposal is to leave the existing implementation until there is confidence \
> > with the new implementation. It also serves as a backup in case Windows were to \
> > significantly change the AFD interface. The old Selector can be used by running \
> > with -Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.WindowsSelectorProvider. \
> > A selection of existing tests have been updated to run a second time with the old \
> > Selector so that it is continues to be tested.
> > CSR and Release Note planned.
>
> Alan Bateman has updated the pull request with a new target base due to a merge or \
> a rebase. The incremental webrev excludes the unrelated changes brought in by the \
> merge/rebase. The pull request contains 14 additional commits since the last \
> revision:
> - Merge
> - Windows 32-bit support
> - Update micro to bind to loopback address
> - Merge
> - Bring back getDescriptor, bzero poll array when initially created
> - epoll_create1 returns NULL on error
> - Remove unused WEPoll.getDescriptor. Update micro to close listener
> - Fix copyright header on SelectOne benchmark
> - Merge
> - Propagate exception from discardOOB, cleanup
> - ... and 4 more: https://git.openjdk.java.net/jdk/compare/29d66ac3...d2be1c3a
A good improvement. Approved.
-------------
Marked as reviewed by bpb (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/3816
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic