netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Octavian Purdila <opurdila@ixiacom.com>,
	Lucian Adrian Grijincu <lgrijincu@ixiacom.com>
Cc: netdev@vger.kernel.org
Subject: Re: [RFC] [PATCH] udp: optimize lookup of UDP sockets to by including destination address in the hash key
Date: Fri, 06 Nov 2009 19:34:00 +0100	[thread overview]
Message-ID: <4AF46C18.5030104@gmail.com> (raw)
In-Reply-To: <4AF2FF22.2000805@gmail.com>

Eric Dumazet a écrit :
> Octavian Purdila a écrit :
> 
>> IIRC, we first saw this issue in VoIP tests with up to 16000 sockets bound on a 
>> certain port and IP addresses (each IP address is assigned to a particular 
>> interface). We need this setup in order to emulate lots of VoIP users each 
>> with a different IP address and possible a different L2 encapsulation.
> 
> Interesting case indeed, is it SIP 5060 port or RTP ports ?
> (I want to know how many messages per second you want to receive)
> 
> An rbtree with 16000 elements has 15 levels, its a lot, but OK
> for small trafic.
> 
>> Now, as a general note I should say that our usecases can seem absurd if you 
>> take them out of the network testing field :) but my _personal_ opinion is that 
>> a better integration between our code base and upstream code may benefit both 
>> upstream and us:
>>
>> - for us it gives the ability to stay close to upstream and get all of the new 
>> shiny features without painful upgrades
>>
>> - for upstream, even if most systems don't run into these scalability issues 
>> now, I see that some people are moving in that direction (see the recent PPP 
>> problems); also, stressing Linux in that regard can only make the code better 
>> - as long as the approach taken is clean and sound
>>
>> - we (or our customers) use a plethora of networking devices for testing so 
>> exposing Linux early to those devices can only help catching issues earlier
>>
>> In short: expect more absurd patches from us :) 
> 
> I might cook something too :)
> 

I tried the rbtree thing and suddenly realized it was not possible at all.

This is not possible because of all wildcards we have in UDP.

1) You can for example bind a socket s1 on address X, port p, dev eth0
2) You can bind socket s2 on adress X, port p  (same values as previous socket), and dev eth1

As bindtodevice can be called after bind() itself, we can get several sockets with same
rbtree key  (port, address), but rbtree doesnt allow duplicates.

I'll try hash based extent.
(Ie allocate an hash extent for given primary hash slot in case number of sockets
in this hash chain exceeds 10 or some threshold)

key hash would be function_of(port, address), duplicates allowed.

allocating 4096 bytes secondary hashes would divide per 1024 or 512 time of lookups, but keeping
rcu lookup might be difficult.


      parent reply	other threads:[~2009-11-06 18:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-04 21:03 [RFC] [PATCH] udp: optimize lookup of UDP sockets to by including destination address in the hash key Lucian Adrian Grijincu
2009-11-04 21:30 ` Eric Dumazet
2009-11-04 23:04   ` Octavian Purdila
2009-11-04 23:32     ` Eric Dumazet
2009-11-05 12:12       ` Andi Kleen
2009-11-05 13:02         ` Eric Dumazet
2009-11-05 14:54           ` Andi Kleen
2009-11-05 15:07             ` Eric Dumazet
2009-11-05 15:16               ` Andi Kleen
2009-11-05 16:25       ` Octavian Purdila
2009-11-05 16:36         ` Eric Dumazet
2009-11-05 17:03           ` Octavian Purdila
2009-11-05 17:39             ` Eric Dumazet
2009-11-06 18:34           ` Eric Dumazet [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AF46C18.5030104@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=lgrijincu@ixiacom.com \
    --cc=netdev@vger.kernel.org \
    --cc=opurdila@ixiacom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).