public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Vincent Sweeney" <v.sweeney@barrysworld.com>
To: "Andrew Morton" <akpm@zip.com.au>, "Dan Kegel" <dank@kegel.com>
Cc: <linux-kernel@vger.kernel.org>, <coder-com@undernet.org>,
	"Dan Kegel" <dank@kegel.com>
Subject: Re: PROBLEM: high system usage / poor SMP network performance
Date: Tue, 12 Feb 2002 18:48:00 -0000	[thread overview]
Message-ID: <003d01c1b3f5$ce90a570$0201010a@frodo> (raw)
In-Reply-To: <3C56E327.69F8B70F@kegel.com> <001901c1a900$e2bc7420$0201010a@frodo> <3C58D50B.FD44524F@kegel.com> <001d01c1aa8e$2e067e60$0201010a@frodo> <3C5CEEED.E98D35B7@kegel.com> <3C5CF686.1145AE14@zip.com.au>

Well I've recoded the poll() section in the ircu code base as follows:

Instead of the default :

    ...
    nfds = poll(poll_fds, pfd_count, timeout);
    ...

we now have

    ...
    nfds = poll(poll_fds, pfd_count, 0);
    if (nfds == 0) {
      usleep(1000000 / 10); /* sleep 1/10 second */
      nfds = poll(poll_fds, pfd_count, timeout);
    }
    ...

And as 'top' results now show, instead of maxing out a dual P3-800 we now
only use a fraction of that without any noticable side effects.

  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME COMMAND
14684 ircd      15   0 81820  79M   800 S    22.5 21.2 215:39 ircd
14691 ircd      12   0 80716  78M   800 S    21.1 20.9 212:22 ircd


Vince.

----- Original Message -----
From: "Andrew Morton" <akpm@zip.com.au>
To: "Dan Kegel" <dank@kegel.com>
Cc: "Vincent Sweeney" <v.sweeney@barrysworld.com>;
<linux-kernel@vger.kernel.org>; <coder-com@undernet.org>; "Kevin L.
Mitchell" <klmitch@mit.edu>
Sent: Sunday, February 03, 2002 8:36 AM
Subject: Re: PROBLEM: high system usage / poor SMP network performance


> Dan Kegel wrote:
> >
> > Before I did any work, I'd measure CPU
> > usage under a simulated load of 2000 clients, just to verify that
> > poll() was indeed a bottleneck (ok, can't imagine it not being a
> > bottleneck, but it's nice to have a baseline to compare the improved
> > version against).
>
> I half-did this earlier in the week.  It seems that Vincent's
> machine is calling poll() maybe 100 times/second.  Each call
> is taking maybe 10 milliseconds, and is returning approximately
> one measly little packet.
>
> select and poll suck for thousands of fds.  Always did, always
> will.  Applications need to work around this.
>
> And the workaround is rather simple:
>
> ....
> + usleep(100000);
> poll(...);
>
> This will add up to 0.1 seconds latency, but it means that
> the poll will gather activity on ten times as many fds,
> and that it will be called ten times less often, and that
> CPU load will fall by a factor of ten.
>
> This seems an appropriate hack for an IRC server.  I guess it
> could be souped up a bit:
>
> usleep(nr_fds * 50);
>
> -
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>


  parent reply	other threads:[~2002-02-12 18:48 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-29 18:00 PROBLEM: high system usage / poor SMP network performance Dan Kegel
2002-01-29 20:09 ` Vincent Sweeney
2002-01-31  5:24   ` Dan Kegel
     [not found]     ` <001d01c1aa8e$2e067e60$0201010a@frodo>
2002-02-03  8:03       ` Dan Kegel
2002-02-03  8:36         ` Andrew Morton
2002-02-04 14:57           ` [Coder-Com] " Darren Smith
2002-02-04 17:41             ` Aaron Sethman
2002-02-04 18:11               ` Darren Smith
2002-02-04 18:30                 ` Aaron Sethman
2002-02-04 18:48                   ` Kev
2002-02-04 18:59                     ` Aaron Sethman
2002-02-04 18:53                   ` Doug McNaught
2002-02-08 22:11                 ` James Antill
2002-02-12 18:48           ` Vincent Sweeney [this message]
2002-02-03 19:22         ` Kev
     [not found]       ` <5.1.0.14.2.20020203173247.02c946e8@pop.euronet.nl>
2002-02-03 19:16         ` [Coder-Com] Re: PROBLEM: high system usage / poor SMPnetwork performance Dan Kegel
2002-02-04  0:07           ` Kev
2002-02-04  0:37             ` Dan Kegel
2002-02-04  0:59               ` Aaron Sethman
2002-02-04  1:16                 ` Dan Kegel
2002-02-04  1:30                   ` Aaron Sethman
2002-02-04  1:38                     ` Dan Kegel
2002-02-04  4:38                       ` Aaron Sethman
2002-02-04  5:35                         ` Dan Kegel
2002-02-04  5:43                           ` Aaron Sethman
2002-02-04  6:11                 ` Daniel Phillips
2002-02-04  6:26                   ` Aaron Sethman
2002-02-04  6:29                     ` Daniel Phillips
2002-02-04  6:39                       ` Aaron Sethman
2002-02-04  2:55               ` Kev
2002-02-04  3:25                 ` Dan Kegel
2002-02-04  4:47                   ` Aaron Sethman
2002-02-04  5:10                   ` Kev
  -- strict thread matches above, loose matches on Subject: below --
2002-01-27 22:23 PROBLEM: high system usage / poor SMP network performance Vincent Sweeney
2002-01-27 22:42 ` Andrew Morton
2002-01-27 22:54 ` Alan Cox
2002-01-27 22:52   ` arjan
2002-01-27 23:08   ` Vincent Sweeney
2002-01-28 19:34   ` Vincent Sweeney
2002-01-28 19:40     ` Rik van Riel
2002-01-29 16:32       ` Vincent Sweeney

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='003d01c1b3f5$ce90a570$0201010a@frodo' \
    --to=v.sweeney@barrysworld.com \
    --cc=akpm@zip.com.au \
    --cc=coder-com@undernet.org \
    --cc=dank@kegel.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