runtime integrated network poller for the rest of us, windows and BSD variants

317 views
Skip to first unread message

Mikio Hara

unread,
May 18, 2013, 8:49:02 AM5/18/13
to golang-dev
Hi,

Alex and I agreed that first we will try to implement windows then BSDs.
FWIW, here is a draft plan to make a series of CLs for avoiding stepping
on each other's toes.

- net: implement netpoll for windows
<https://codereview.appspot.com/8670044/>

- runtime: integrated network poller for freebsd/amd64,386, openbsd/amd64,386
adds kqueue stuff
Update issue 5199
<https://codereview.appspot.com/8825043/>

- net: simplify socket option helpers
makes sure which socket options are required for preflight,
unnamed sockets and inflight, named sockets.
Update issue 5199
<https://codereview.appspot.com/8637049/>

- net: make deadline helpers join to netFD as its methods
Update issue 5199
<https://codereview.appspot.com/8656044/>

- net: refactor socket creation helpers
chops internetSocket and unixSocket into dialerSocket,
streamListenerSocket and datagramListenerSocket to make sure
which socket creation helper needs to call runtime integrated
poller.
Update issue 5199
<https://codereview.appspot.com/8726051/>

- runtime: split runtime_pollOpen into runtime_PollOpen and runtime_PollStart
Update issue 5199
<https://codereview.appspot.com/8608044/>

- runtime: integrated network poller for freeebsd/arm, netbsd/amd64,386,arm
Update issue 5199
<not quite yet>

- net: enable runtime integrated network poller on freebsd, openbsd, netbsd
Fixes issue 5199
<not quite yet>

- net: drop embedded network poller
<not quite yet>

brainman

unread,
May 18, 2013, 11:30:01 PM5/18/13
to golan...@googlegroups.com
I pinged Dmitry about windows network poller. Hopefully, I could move that change along.

Alex

minux

unread,
May 20, 2013, 12:02:32 PM5/20/13
to Mikio Hara, golang-dev
I already have implementations for netbsd/amd64, and netbsd/386. 

- net: enable runtime integrated network poller on freebsd, openbsd, netbsd
  Fixes issue 5199
  <not quite yet>

- net: drop embedded network poller
  <not quite yet>
what about plan 9?

Mikio Hara

unread,
May 22, 2013, 9:41:16 AM5/22/13
to minux, golang-dev
On Tue, May 21, 2013 at 1:02 AM, minux <minu...@gmail.com> wrote:

>> - runtime: integrated network poller for freeebsd/arm,
>> netbsd/amd64,386,arm
>> Update issue 5199
>
> I already have implementations for netbsd/amd64, and netbsd/386.

Nice, thank you.
if you want to submit defs/sys stuff first, please proceed.

>> - net: drop embedded network poller
>> <not quite yet>
>
> what about plan 9?

I have no clue. Looks like Plan 9 doesn't need poller stuff.

minux

unread,
May 22, 2013, 4:20:43 PM5/22/13
to Mikio Hara, golang-dev
On Wed, May 22, 2013 at 9:41 PM, Mikio Hara <mikioh...@gmail.com> wrote:
On Tue, May 21, 2013 at 1:02 AM, minux <minu...@gmail.com> wrote:

>> - runtime: integrated network poller for freeebsd/arm,
>> netbsd/amd64,386,arm
>>   Update issue 5199
>
> I already have implementations for netbsd/amd64, and netbsd/386. 

Nice, thank you.
if you want to submit defs/sys stuff first, please proceed.
netbsd/arm support is also done. once we figure out how to deal with different types for
kevent.udata, i will send the CL (https://codereview.appspot.com/9545044/).

>> - net: drop embedded network poller
>>   <not quite yet>
>
> what about plan 9?

I have no clue. Looks like Plan 9 doesn't need poller stuff.
Do you think we should retain the builtin poller to ease future porting of package net?
Lack of build and test is a concern if we do this though.

Lucio De Re

unread,
May 23, 2013, 12:36:07 AM5/23/13
to minux, Mikio Hara, golang-dev
It will get tested, fear not. But we have bigger fish to fry right
now, don't let us get in your way. Rather put the details in now,
than discover along the way that they cannot be shoehorned when
needed, at least in my opinion.

Lucio.

Mikio Hara

unread,
May 23, 2013, 6:45:43 AM5/23/13
to Lucio De Re, minux, golang-dev
On Thu, May 23, 2013 at 1:36 PM, Lucio De Re <lucio...@gmail.com> wrote:

> It will get tested, fear not.

Thanks.

> But we have bigger fish to fry right now, don't let us get in your way.

Ack.

Mikio Hara

unread,
May 23, 2013, 6:50:52 AM5/23/13
to minux, golang-dev
On Thu, May 23, 2013 at 5:20 AM, minux <minu...@gmail.com> wrote:

> netbsd/arm support is also done. once we figure out how to deal with
> different types for
> kevent.udata, i will send the CL (https://codereview.appspot.com/9545044/).

It's C stuff, so using typedef looks fine to me.

Mikio Hara

unread,
Jul 22, 2013, 4:44:15 AM7/22/13
to golang-dev
Hi Alex,

> Alex and I agreed that first we will try to implement windows then BSDs.

Looks like your CLs have landed, so shall I start the CLs for BSDs?

Dmitry Vyukov

unread,
Jul 22, 2013, 5:35:41 AM7/22/13
to Mikio Hara, golang-dev
Yes, sure.
You just need to adapt darwin kqueue-based impl, right?

Mikio Hara

unread,
Jul 22, 2013, 5:54:47 AM7/22/13
to Dmitry Vyukov, golang-dev
On Mon, Jul 22, 2013 at 6:35 PM, Dmitry Vyukov <dvy...@google.com> wrote:

> You just need to adapt darwin kqueue-based impl, right?

Yup, on-line manual on almost all BSDs except darwin says that
we need to pass a listened socket to kqueue for net.Listeners.
Otherwise kqueue will check data to be read w/ SO_RCVLOWAT
and will never indicate a new listener coming.

http://www.freebsd.org/cgi/man.cgi?query=kqueue&apropos=0&sektion=0&manpath=FreeBSD+9.1-stable&arch=default&format=html

brainman

unread,
Jul 22, 2013, 6:30:08 AM7/22/13
to golan...@googlegroups.com
Thanks for waiting.

Alex

Mikio Hara

unread,
Aug 14, 2013, 11:00:44 PM8/14/13
to brainman, golang-dev
Hi,

I've been trying to land runtime-integrated network pollster stuff for
BSD variants and submitted preliminary CLs last week. Looks like all
builders have been doing so-so during the past week (even if we saw
several red alerts, almost unrelated to networking stuff except
existing fragile test case issues or undiscovered runtime-network
combo issues), so I'd like to proceed this work as the following;

1. Rearranging the call order of network pollster and syscall functions

The reason why the existing combination of network file
descriptor+runtime-integrated network pollster doesn't work well on
BSD variants is that the call order of raw networking primitives is
not good for some platforms; specifically, unlike Darwin's kqueue and
package own one-shot I/O event bounce network pollster, BSD's kqueue
with runtime-integrated network pollster requires a socket that has
been passed for syscall.Listen previously for a passive stream
connection listener to pull up pending incoming connections from the
kernel.

CL 12730043 will take care of this, and update issue 5199.
https://codereview.appspot.com/12730043/

2. Switching network pollster from package own to runtime's

CL 8264043 which now includes CL 12730043 for convenience, will take
care of this, less I/O event bounce will make a bit performance
improvement on FreeBSD and OpenBSD, and fixes issue 5199.
https://codereview.appspot.com/8264043/

Port stuff to FreeBSD/ARM, NetBSD/AMD64,386 still remains (issue
6146); actually waiting for minux.

Once we've done, we will see four network pollsters in Go 1.2.

- runtime-integrated network pollster on top of epoll for Linux
available in Go 1.1
- runtime-integrated network pollster on top of I/O completion mech.
for Windows available from Go 1.2
- runtime-integrated network pollster on top of kqueue for Darwin
available in Go 1.1, FreeBSD/AMD64,386 and OpenBSD available from Go
1.2
- net package own pollster on top of kqueue for FreeBSD/ARM and NetBSD
available in Go 1.1

Thanks.

Dmitry Vyukov

unread,
Aug 15, 2013, 5:55:52 AM8/15/13
to Mikio Hara, brainman, golang-dev
Great!
Can't wait we remove old net pollster.
Thanks for working on this!



--

---
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages