Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 May 1997 19:42:43 -0700
From:      Julian Elischer <julian@whistle.com>
Cc:        julian@alpo.whistle.com, hackers@freebsd.org
Subject:   WHy does Appache eat my system?
Message-ID:  <338F9023.41C67EA6@whistle.com>

next in thread | raw e-mail | index | archive | help
I've been doing some kernel profiling on a freeBSD system, trying
to figure out why I have 0% idle and 60% in the kernel.
I haven't tracked it all down but here are a few bits of the 
traces...

Apache seems to be the main culprit.

does anyoen who really knows apache heve any suggestions?

---------begin Kernel syscall trace extract-----
 10077 httpd    865038863.248455 RET   read 8192/0x2000
 10077 httpd    865038863.249045 CALL  break(0x13e000)
 10077 httpd    865038863.249476 RET   break 0
 10077 httpd    865038863.249817 CALL  break(0x140000)
 10077 httpd    865038863.250209 RET   break 0
 10077 httpd    865038863.250547 CALL  break(0x142000)
 10077 httpd    865038863.250936 RET   break 0
 10077 httpd    865038863.251277 CALL  break(0x144000)
 10077 httpd    865038863.251665 RET   break 0
 10077 httpd    865038863.252005 CALL  break(0x146000)
 10077 httpd    865038863.252394 RET   break 0
 10077 httpd    865038863.252732 CALL  break(0x148000)
 10077 httpd    865038863.253117 RET   break 0
 10077 httpd    865038863.253454 CALL  break(0x14a000)
 10077 httpd    865038863.254057 RET   break 0
 10077 httpd    865038863.254463 CALL  break(0x14c000)
 10077 httpd    865038863.254860 RET   break 0
 10077 httpd    865038863.255196 CALL  break(0x14e000)
 10077 httpd    865038863.255579 RET   break 0
### this continues for a while
 10077 httpd    865038863.312158 CALL  break(0x1e6000)
 10077 httpd    865038863.312546 RET   break 0
 10077 httpd    865038863.312879 CALL  break(0x1e8000)
 10077 httpd    865038863.313263 RET   break 0
 10077 httpd    865038863.313598 CALL  break(0x1ea000)
---------end extract--
'break' is the 'brk()' syscall.

This occurs apparently on every request..
it's just spent about 60 msec doing basically nothing but
picking up 8K pages of memeory from the kernel.

I can't help thinking that this must be able to be made better.
when the request is serviced, it is ALL thrown back. and the next
request goes and fetches it again.


A dump of a kernel execution profile at the same time
shows the following:

--begin extract---------------------------------------------

               13.23       63.35  614785/614785      _Xsyscall [2]
[3]     78.1   13.23       63.35  614785         _syscall [3]
                2.61       19.49  415263/415263      _obreak [4]
                0.52       10.42   47275/47275       _read [7]
                0.26        4.45   17514/17514       _write [17]
                0.07        4.63    7122/7122        _stat [18]
                1.13        3.39    9210/9210        _select [19]
                0.11        3.82    6206/6206        _open [23]
                2.87        0.00  613302/671847      _generic_copyin[29]
                0.05        0.73    5868/5868        _fstat [77]
                0.09        0.61    8722/8722        _flock [79]
                0.01        0.65     937/937         _lstat [87]
                0.05        0.60    7391/7391        _close [88]
---end extract--


this shows that 19% of all system time was being spent in obreak()
(which is the brk() syscall.)
over a 100 second period there were 415263 calls to it
(4000 per second?) which nearly all came from apache.

Has anyone done anything on this?

our system is limited to 6 servers so each is doing 800
brk() calls per second!(in fact in my traces they are nearly
all done by a couple of the servers. I am also tracking more
such innefficiencies, but this is the obvious one to start 
with :)

If not I will work on it and make the results available but
I hate to duplicate work by others.

julian
(julian@freebsd.org, julian@whistle.com)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?338F9023.41C67EA6>