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

Octavian Purdila a écrit :
> On Wednesday 04 November 2009 23:30:27 you wrote:
> 
>> I knew someone would do this kind of patch one day, I tried it one year ago
>>  :)
>>
> 
> And I knew you would give us feedback, thanks ! You are unstoppable lately, 
> how many of are out there? :) 
> 
>> First of all, you are mixing several things in this patch.
>>
>> Dont do this, its not possible for us to correctly review such complex
>>  patch.
>>
>> Then, your patch is not based on net-next-2.6, and you really need to work
>>  on this tree.
>>
> 
> Yes, the patch is not in any shape for review, we just wanted some early 
> feedback on the approach itself, and I've noticed its more likely to get 
> feedback when code is posted.
> 
>> Then, if you had worked on net-next-2.6, you whould have noticed UDP hash
>>  tables are now dynamically sized at boot.
>> An admin can even force a 65536 slots hash table for heavy duty UDP
>>  servers.
>>
>> Then, last point : Say I have a machine with 65000 udp sockets bound to a
>>  different port, and a 65536 slots hash table, (sane values in fact, in
>>  order to have best performances), then your two phase lookup will be
>>  slower than the one-phase current lookup (two cache misses instead of one)
>>
>> So your patch seems to solve a pathological case (where many udp sockets
>>  are bounded to a particular port, but on many different IPs), and slow
>>  down 99% of other uses.
>>
> 
> Very true, the benchmark itself shows a significant overhead increase on the TX 
> side and indeed this case is not very common. But for us its an important 
> usecase. 
> 
> Maybe there is a more clever way of fixing this specific use-case without 
> hurting the common case?
> 

Clever way ? Well, we will see :)

I now understand previous Lucian patch (best match) :)

Could you please describe your usecase ? I guess something is possible,
not necessarly hurting performance of regular usecases :)

I have struct reorderings in progress to reduce number of cache lines read
per socket from two to one. So this would reduce by 50% time to find
a particular socket in the chain.

But if you *really* want/need 512 sockets bound to _same_ port, we probably can use
secondary hash tables (or rbtree), as soon as we stack more than XX sockets on a
particular slot.

At lookup, we check if extended hash table exists before doing
normal rcu lookup.

Probably can be done under 300 lines of code.
On normal machines, these extra tables/trees would not be used/allocated

  reply	other threads:[~2009-11-04 23:32 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 [this message]
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

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=4AF20F02.7000601@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).