git: udp: Implement asynchronized pru_connect.

Sepherosa Ziehau sephe at crater.dragonflybsd.org
Wed Oct 28 18:33:28 PDT 2015


commit 5aaa7016a5796af988e90dad0a3cc2fc015d3e1c
Author: Sepherosa Ziehau <sephe at dragonflybsd.org>
Date:   Fri Oct 23 21:40:23 2015 +0800

    udp: Implement asynchronized pru_connect.
    
    This is mainly used to improve UDP connect(2) performance.  Most
    of the DNS resolvers (getaddrinfo(3) and curl's DNS resolver, etc)
    and RTP application will see improvement.
    
    Before this commit the user space thread uses connect(2) will have
    to wait for the netisr to complete all preceeding messages.  This
    could be performance hit for connect(2): the user space thread is
    suspended, even if the UDP connect(2) should always be nonblocking.
    
    The only drawback is that bunch of datagrams sent immediately after
    connect(2) may not appear on the network in the sending order, but
    UDP applications should always be able to handle out-of-order data-
    grams.
    
    UDP's asynchronous pru_connect implementation will set ISCONNECTED
    before dispatching connect message to netisr.  The errors like
    EADDRNOTAVAIL, i.e. out of local port space, will be notified
    through later send(2)/recv(2), or getsockopt(2) SOL_SOCKET/SO_ERROR.
    
    The measured effect of this change on 2-ways E5-2600v2 with Intel
    82599 (10Gbe) using tools/kq_connect_client -u, i.e. UDP socket/
    connect/send /close before initiating a TCP connection:
    - Connect rate increases by ~45Kconns/s; we are now doing
      300Kconns/s.
    - IPIs rate to the CPUs not running netisrs reduces (23Kipis/s ->
      16Kipis/s).

Summary of changes:
 sys/netinet/in_proto.c   |  2 +-
 sys/netinet/udp_usrreq.c | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/5aaa7016a5796af988e90dad0a3cc2fc015d3e1c


-- 
DragonFly BSD source repository


More information about the Commits mailing list