Index | Thread | Search

From:
Otto Moerbeek <otto@drijf.net>
Subject:
Re: UDP send in parallel
To:
Alexander Bluhm <alexander.bluhm@gmx.net>, tech@openbsd.org
Date:
Mon, 8 Jan 2024 13:22:56 +0100

Download raw body.

Thread
On Mon, Jan 08, 2024 at 01:02:24PM +0100, Otto Moerbeek wrote:

> On Mon, Jan 08, 2024 at 11:25:18AM +0100, Florian Obser wrote:
> 
> > On 2024-01-05 23:06 +01, Alexander Bluhm <alexander.bluhm@gmx.net> wrote:
> > > Hi,
> > >
> > > Sending UDP packets via datagram socket is MP safe now.  Same applies
> > > to raw IPv4 and IPv6, and divert sockets.  Switch sosend() from
> > > exclusive net lock to shared net lock in combination with per socket
> > > lock.  TCP and GRE still use exclusive net lock.
> > >
> > > Please test this diff if you have applications that run multithreaded
> > > and send lots of UDP packets.
> > 
> > So I ran dnsbench and things do not look good.
> 
> I ran my tests wit pdns_recursor and dnsperf using 10 clients on
> another machine (which is running debian). That might explain why I
> did not spot a performance regression.
> 
> 	-Otto

Specifically, I'm running dnsperf against a pdns recursor that is Lua
scripted to sends NODATA response for any query. So no upstream
traffic occurs, only query-answer.  rec is running with 1 thread
reading queries and 4 threads answering.

Patched code is much faster (amd64, on a 8 core machine).

	-Otto

Current:

Statistics:

  Queries sent:         2165838
  Queries completed:    2164720 (99.95%)
  Queries lost:         1118 (0.05%)

  Response codes:       NOERROR 2164720 (100.00%)
  Average packet size:  request 38, response 38
  Run time (s):         60.008196
  Queries per second:   36073.738994

  Average Latency (s):  0.000233 (min 0.000111, max 0.008237)
  Latency StdDev (s):   0.000043

Patched:

Statistics:

  Queries sent:         12873279
  Queries completed:    12873046 (100.00%)
  Queries lost:         233 (0.00%)

  Response codes:       NOERROR 12873046 (100.00%)
  Average packet size:  request 38, response 38
  Run time (s):         60.039529
  Queries per second:   214409.510108

  Average Latency (s):  0.000356 (min 0.000133, max 0.039529)
  Latency StdDev (s):   0.000049