public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Kirby <sim@netnation.com>
To: Andi Kleen <andi@firstfloor.org>,
	kuznet@ms2.inr.ac.ru, linux-kernel@vger.kernel.org
Subject: Awfully slow /proc/net/tcp, netstat, in.identd in 2.4 (updated)
Date: Thu, 18 Oct 2001 09:42:22 -0700	[thread overview]
Message-ID: <20011018094222.A31919@netnation.com> (raw)

There is definitely something really broken here.  One of our web servers
that was having the problem before has now decided to hit a load average
of 50 because identd is taking so long to parse /proc/net/tcp and give
back ident information.

stracing a process, I see:

open("/proc/net/tcp", O_RDONLY)         = 4
fstat(4, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40009000
read(4, "  sl  local_address rem_address "..., 4096) = 4096
read(4, "00000000 01:0000023B 00000000   "..., 4096) = 4096
read(4, "0374800 2 c9ae0a60 25 4 0 2 -1  "..., 4096) = 4096
read(4, "           \n  81: 0CDFAECC:0050"..., 4096) = 4096
read(4, "06 00000000:00000000 03:0000131F"..., 4096) = 4096
read(4, "0        0 0 2 e3a92800         "..., 4096) = 4096

...Switching to "strace -tt" on the same process which still hadn't
exited by the time I had typed "strace -tt", I see:

09:25:45.481608 read(4, "0                               "..., 4096) = 4096
09:25:46.843441 read(4, " \n 354: 17612840:0050 23925BC0:"..., 4096) = 4096
09:25:47.542388 read(4, "0:00000000 03:00000B6C 00000000 "..., 4096) = 4096
09:25:49.649454 read(4, " 10385399 2 c9ae0a60 96 4 7 2 -1"..., 4096) = 4096
09:25:51.743338 read(4, "", 4096)       = 0

Each 4k block is taking 2 seconds!  It's probably competing with other
processes, but still, this is crazy.

[sroot@pro:/root]# time wc -l /proc/net/tcp
    427 /proc/net/tcp
0.000u 0.650s 0:01.38 47.1%     0+0k 0+0io 69pf+0w

Also, other servers running exactly the same kernel on the exact same
hardware have _more_ entries in the table and are much faster:

[sroot@bridge:/root]# time wc -l /proc/net/tcp
    805 /proc/net/tcp
0.010u 0.100s 0:00.10 100.0%    0+0k 0+0io 68pf+0w

Also, some inactive servers exactly the same kernel return instantly,
which is why I don't understand why walking too big a hash table can be
the problem:

[sroot@devel:/root]# time wc -l /proc/net/tcp
     10 /proc/net/tcp
0.000u 0.000s 0:00.00 0.0%      0+0k 0+0io 113pf+0w

What gives?

Simon-

[  Stormix Technologies Inc.  ][  NetNation Communications Inc. ]
[       sim@stormix.com       ][       sim@netnation.com        ]
[ Opinions expressed are not necessarily those of my employers. ]

             reply	other threads:[~2001-10-18 16:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-18 16:42 Simon Kirby [this message]
2001-10-18 16:49 ` Awfully slow /proc/net/tcp, netstat, in.identd in 2.4 (updated) David S. Miller
2001-10-18 17:05   ` Simon Kirby
2001-10-19 12:57 ` Andi Kleen
2001-10-19 15:59   ` Simon Kirby
2001-10-19 18:22     ` Andi Kleen
2001-10-19 20:59       ` David S. Miller
2001-10-19 21:30         ` Benjamin LaHaise
2001-10-19 21:56           ` David S. Miller
2001-10-19 22:04             ` Benjamin LaHaise
2001-10-19 22:11               ` David S. Miller
2001-10-19 22:13                 ` Benjamin LaHaise

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=20011018094222.A31919@netnation.com \
    --to=sim@netnation.com \
    --cc=andi@firstfloor.org \
    --cc=kuznet@ms2.inr.ac.ru \
    --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