some profiling info

From: Oskar Pearson <oskar@dont-contact.us>
Date: Sun, 2 Nov 1997 12:48:17 +0200

--MimeMultipartBoundary
Content-Type: text/plain; charset=us-ascii

Hi

2 things:

Diablo news-feed software:

Someone showed me this the other day - it's actually quite interesting
(though I haven't looked at it incredibly deeply :)

They have 2 parts to the program, a feeder program and a client program.
The client sits and accepts connections and accepts news articles, and then
writes them to the disk spool.

The server then reads these spool files and sends them to the client machines.

Now, somewhere the program forks lots (perhaps to handle incoming connections
or something).

To get rid of the 'fork;exec' time they wrote 2 function calls in the program,
one which does the client-side stuff, the other does the server-side stuff.
Normally the server-side stuff runs.
All the variables are defined as local in those functions, and when the
server would normally 'fork;exec("client-side")' it simply does
'fork;client-side()', completely avoiding the exec call...

hope that made sense :)

And - some profiling-type-stuff
------------------------------------

I don't know how accurate this is, but I though it might be useful. It's
not real profiling info, but anyway... you can do the same thing with
solaris 'truss' if you are interested.

The machine is running linux 2.0.31, and at the time of the trace
it isn't loaded. This is nearly a 30 minute sample (as you can see from
the bottom). I suppose I should compile in no_atime support in the kernel
sometime.

Perhaps it's time we had a 'statd' (like unlinkd)? Note that 'oldselect'
is the same as 'select'. On that topic - why are there unlink calls at
all?

Also - any idea why accept and connect would return errors? Is it because
the system would be forced to block?

[root@cache1 /root]# time strace -c -p 2098
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
 80.39 376.869164 5144 73263 1584 stat
  5.14 24.113076 115 209873 oldselect
  3.66 17.141290 151 113764 21 write
  3.60 16.864246 2062 8177 open
  1.69 7.912035 955 8282 3795 accept
  1.53 7.190404 207 34802 254 read
  1.21 5.683008 54 105947 gettimeofday
  0.59 2.754524 2527 1090 unlink
  0.55 2.567443 737 3483 socket
  0.35 1.654128 137 12072 sendto
  0.34 1.572721 33 48143 fcntl
  0.30 1.398763 52 27092 lseek
  0.29 1.346842 83 16159 close
  0.16 0.731478 105 6954 3502 connect
  0.13 0.599749 50 12072 recvfrom
  0.03 0.155988 1431 109 getdents
  0.02 0.098692 22 4487 getsockname
  0.02 0.079040 23 3483 setsockopt
  0.01 0.049988 57 874 brk
  0.00 0.000748 62 12 dup2
  0.00 0.000388 43 9 bind
------ ----------- ----------- --------- --------- ----------------
100.00 468.783715 690147 9156 total
35.79user 77.34system 27:17.05elapsed 6%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (90major+16minor)pagefaults 0swaps

--MimeMultipartBoundary--
Received on Tue Jul 29 2003 - 13:15:44 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:11:28 MST