FAQ
I was reading in the release notes for Go 1.1 about performance
enhancements through the coupling of the net package and the scheduler and
I'm curious how that works. Could someone please give me a pointer to the
file(s) I should be looking at to better understand that?

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

Search Discussions

  • Ian Lance Taylor at May 22, 2013 at 5:23 pm

    On Wed, May 22, 2013 at 7:50 AM, Bill Neubauer wrote:
    I was reading in the release notes for Go 1.1 about performance enhancements
    through the coupling of the net package and the scheduler and I'm curious
    how that works. Could someone please give me a pointer to the file(s) I
    should be looking at to better understand that?
    net/fd_poll_runtime.go
    runtime/netpoll.goc

    Ian

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
    For more options, visit https://groups.google.com/groups/opt_out.
  • Rob Pike at May 22, 2013 at 5:29 pm
    The short version as I understand it (I am not an expert in this
    topic, so the weasel words have meaning) is that when a read system
    call completes on the network, the goroutine doing the read is woken
    up directly, whereas in the old code the scheduler would wake up and
    then in turn wake up the receiving goroutine. The speedup is therefore
    due, at least in part, to eliminating one context switch per network
    operation.

    I reiterate that weasel words apply.

    -rob

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dmitry Vyukov at May 22, 2013 at 5:40 pm

    On Wed, May 22, 2013 at 6:50 PM, Bill Neubauer wrote:
    I was reading in the release notes for Go 1.1 about performance enhancements
    through the coupling of the net package and the scheduler and I'm curious
    how that works. Could someone please give me a pointer to the file(s) I
    should be looking at to better understand that?

    Hi,

    It consists of 2 parts:
    Improved scheduler with polling support:
    https://codereview.appspot.com/7314062/
    https://codereview.appspot.com/7448048/
    and the network poller itself:
    https://codereview.appspot.com/7579044/

    These two changes together improve network performance ~10x on linux:
    BenchmarkTCPPersistent 81670 7782 -90.47%
    BenchmarkTCPPersistent-2 26598 4808 -81.92%
    BenchmarkTCPPersistent-4 15633 3674 -76.50%
    BenchmarkTCPPersistent-8 18093 2407 -86.70%
    BenchmarkTCPPersistent-16 17472 1875 -89.27%
    BenchmarkTCPPersistent-32 7679 1637 -78.68%

    Why it is faster:
    - global mutex for poller state is eliminated
    - edge-triggered epoll is used instead of level-triggered
    - it uses heap-based runtime timers instead of home-grown list-based timers
    - moreover, timers are set only once as opposed to setting them on
    each read/write
    - the polling is done by runtime worker threads at appropriate
    moments, as opposed to by a separate goroutine at inappropriate
    moments
    - poller injects batches of newly runnable goroutines directly into scheduler
    - blocking/unblocking of goroutines is more efficient in runtime and
    no need to allocate additional channels for that
    - other minor improvements

    If you want to look at the current code:
    src/pkg/net/fd_unix.go (Read and Write functions)
    src/pkg/net/fd_poll_runtime.go (interface to runtime poller)
    src/pkg/runtime/netpoll.c (poller code)
    src/pkg/runtime/netpoll_epoll.c (linux part)
    src/pkg/runtime/proc.c (scheduler integration, search for netpoll)

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMay 22, '13 at 5:04p
activeMay 22, '13 at 5:40p
posts4
users4
websitegolang.org

People

Translate

site design / logo © 2023 Grokbase