From: Albert Cahalan <albert@users.sf.net>
To: Brian McGroarty <brian@mcgroarty.net>
Cc: linux-kernel mailing list <linux-kernel@vger.kernel.org>,
lm@bitmover.com
Subject: Re: /proc reliability & performance
Date: 17 Oct 2003 00:31:14 -0400 [thread overview]
Message-ID: <1066365074.15931.195.camel@cube> (raw)
In-Reply-To: <20031017032436.GA17480@mcgroarty.net>
On Thu, 2003-10-16 at 23:24, Brian McGroarty wrote:
> On Thu, Oct 16, 2003 at 10:07:18PM -0400, Albert Cahalan wrote:
> > I created a process with 360 thousand threads,
> > went into the /proc/*/task directory, and did
> > a simple /bin/ls. It took over 9 minutes on a
> > nice fast Opteron. (it's the same at top-level
> > with processes, but I wasn't about to mess up
> > my system that much)
>
> Are there many cases where the /proc directory
> contents are read in this fashion?
Sure. Run any of: top, ps, lsof, fuser...
> I'd be more curious about how performance fares
> with reading a thousand entries by name with 1k
> processes and with 360k processes.
Judging by the crazy example and the observation
that an O(n*n) algorithm is involved, directory
reads on that very fast machine should get annoying
once you have a few thousand processes. They'd be
perceptable one-by-one, which adds up when you have
multiple reads due to scripts, top, or multiple
users.
Anyway, it's not just about performance! That's
only half of the problem. The other half is
reliability. The way /proc works is this:
Count tasks as you read them. The number is
your directory offset. Return a few dozen entries
at a time. For each read, you'll need to find
back your place. You do this by counting tasks
until you reach your offset. Of course, tasks
will have been created and destroyed between
reads, so who knows where you'll continue from?
That's simply not reliable.
next prev parent reply other threads:[~2003-10-17 4:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-17 2:07 /proc reliability & performance Albert Cahalan
2003-10-17 2:34 ` Larry McVoy
2003-10-17 8:01 ` dada1
2003-10-17 9:10 ` David S. Miller
2003-10-17 14:46 ` Valdis.Kletnieks
2003-10-17 17:24 ` dada1
2003-10-17 23:48 ` Albert Cahalan
2003-10-18 6:35 ` Willy Tarreau
2003-10-18 6:38 ` David S. Miller
2003-10-17 2:51 ` William Lee Irwin III
2003-10-17 3:24 ` Brian McGroarty
2003-10-17 4:31 ` Albert Cahalan [this message]
2003-10-17 4:56 ` William Lee Irwin III
2003-10-17 8:21 ` David Rees
2003-10-17 7:40 ` Zan Lynx
2003-10-17 7:54 ` William Lee Irwin III
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=1066365074.15931.195.camel@cube \
--to=albert@users.sf.net \
--cc=brian@mcgroarty.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lm@bitmover.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.