From: Nick Piggin <piggin@cyberone.com.au>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: bill davidsen <davidsen@tmr.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: So, Poll is not scalable... what to do?
Date: Thu, 13 Nov 2003 11:54:46 +1100 [thread overview]
Message-ID: <3FB2D656.60008@cyberone.com.au> (raw)
In-Reply-To: <Pine.LNX.4.44.0311121548470.2017-100000@bigblue.dev.mdolabs.com>
Davide Libenzi wrote:
>On 12 Nov 2003, bill davidsen wrote:
>
>
>>In article <20031112053207.GA9634@alpha.home.local>,
>>Willy Tarreau <willy@w.ods.org> wrote:
>>| On Tue, Nov 11, 2003 at 05:52:42PM -0600, kirk bae wrote:
>>| > If poll is not scalable, which method should I use when writing
>>| > multithreaded socket server?
>>|
>>| Honnestly, if you're using threads (I mean lots of threads, such as one
>>| per connection), I don't think that poll performance will be your worst
>>| ennemy. The first thing to do is to handle the task switching yourself
>>| either with a publicly available coroutine library or with one of your own.
>>
>>It's not clear that with 2.6 this is necessary or desirable. I'll let
>>someone who worked on the new thread and/or futex development say more
>>if they will, but I'm reasonable convinced that in most cases the kernel
>>will do it better.
>>
>
>Pros & Cons:
>
>*) Coroutines cost is basically its stack (8-16Kb). Threads there's a
>little bit more under the hood
>
>*) No locks at all with coroutines
>
>*) Coroutine context switch time was about 20 times faster last time I
>tried. I used this:
>
According to lmbench, 2.4 does a context switch in 0.67us (on one type
of uniprocessor cpu - the machines at osdl). 2.6.0-test9 manages 1.17us
(174% longer). I have some patches that brings this to 0.80us (119%).
This is with 2 active tasks, so O(1) doesn't get to show its advantage.
If you remove the realtime priority array (disable RT scheduling support)
you could probably drop this figure below 2.4's. I should get some numbers
Perhaps if there is demand I could make RT scheduling a config option in
my patchset. I think Andrea does something fancy like that. I'll have to
take a look at his code.
That said, I'd be inclined to think an application that it context switch
bound is broken by design. Although maybe there are some special cases.
2.4: http://khack.osdl.org/stp/282982/results/summary_report
2.6: http://khack.osdl.org/stp/282354/results/summary_report
np: http://khack.osdl.org/stp/283054/results/summary_report
next prev parent reply other threads:[~2003-11-13 0:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-11 23:52 So, Poll is not scalable... what to do? kirk bae
2003-11-12 3:52 ` Jeff Garzik
2003-11-12 5:32 ` Willy Tarreau
2003-11-12 23:26 ` bill davidsen
2003-11-13 0:32 ` Davide Libenzi
2003-11-13 0:54 ` Nick Piggin [this message]
2003-11-13 12:02 ` Bill Davidsen
2003-11-12 23:23 ` bill davidsen
2003-11-13 1:06 ` Bernd Eckenfels
2003-11-13 7:52 ` David Schwartz
-- strict thread matches above, loose matches on Subject: below --
2003-11-13 18:25 Dan Kegel
2003-11-13 23:10 kirk bae
2003-11-14 0:52 ` Mark Mielke
2003-11-14 0:27 Dan Kegel
2003-11-14 18:57 Frederic Rossi
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=3FB2D656.60008@cyberone.com.au \
--to=piggin@cyberone.com.au \
--cc=davidel@xmailserver.org \
--cc=davidsen@tmr.com \
--cc=linux-kernel@vger.kernel.org \
/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