httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dean gaudet <dgaudet-list-new-ht...@arctic.org>
Subject Re: simple HTTP/1.0 request strace
Date Sun, 07 Jan 2001 19:30:49 GMT
malloc/free are not system calls.

libc manages regions of memory allocated from the system via sbrk() or
mmap(), a lot like we manage blocks in the pool allocator.  i deliberately
did not strace the first request in this child because the memory
allocation (and other libc setup foo) are totally misleading.

free() generally doesn't return memory to the system.  on some libc's it
does... linux, for example, on large memory requests will use
mmap()/munmap() directly.  (and realloc() is implemented with mremap()
which doesn't require memory to be copied, it just tweaks the page
tables).  freebsd does something similar though i don't know the details.

-dean

On Sun, 7 Jan 2001 rbb@covalent.net wrote:

>
> One minor comment.  I agree this isn't that bad, but I don't see the
> malloc()/free() combination that I know are there, so this is a bit
> misleading, especially since on complex requests, we are doing a LOT of
> malloc/free calls.
>
> I want to look through this in more detail before I respond any more than
> this.
>
> Ryan
>
> On Sun, 7 Jan 2001, dean gaudet wrote:
>
> > hey so this isn't such a bad starting point.  here's an strace of "GET
> > /index.html.en HTTP/1.0" on current HEAD, using prefork mpm (on linux of
> > course).
> >
> > accept(5, {sin_family=AF_INET, sin_port=htons(1982), sin_addr=inet_addr("204.107.140.52")}},
[16]) = 8
> > rt_sigaction(SIGUSR1, {SIG_IGN}, {0x807f774, [], SA_INTERRUPT|0x4000000}, 8) = 0
> > setsockopt(8, IPPROTO_TCP1, [1], 4)     = 0
> > getsockname(8, {sin_family=AF_INET, sin_port=htons(8888), sin_addr=inet_addr("204.107.140.52")}},
[16]) = 0
> > fcntl(8, F_GETFL)                       = 0x2 (flags O_RDWR)
> > fcntl(8, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
> > read(8, "GET /index.html.en HTTP/1.0\nHost"..., 8192) = 46
> > gettimeofday({978893823, 340674}, NULL) = 0
> > stat("/home/dean/ap2/htdocs/index.html.en", {st_mode=S_IFREG|0664, st_size=1349,
...}) = 0
> > open("/home/dean/ap2/htdocs/index.html.en", O_RDONLY) = 9
> > getsockopt(8, IPPROTO_TCP, 1, [1], [4]) = 0
> > setsockopt(8, IPPROTO_TCP1, [0], 4)     = 0
> > setsockopt(8, IPPROTO_TCP3, [1], 4)     = 0
> > writev(8, [{"HTTP/1.1 200 OK\r\nDate: Sun, 07 J"..., 294}], 1) = 294
> > sendfile(8, 9, [0], 1349)               = 1349
> > setsockopt(8, IPPROTO_TCP3, [0], 4)     = 0
> > setsockopt(8, IPPROTO_TCP1, [1], 4)     = 0
> > read(8, 0x814cfb0, 8192)                = -1 EAGAIN (Resource temporarily unavailable)
> > write(4, "204.107.140.52 - - [07/Jan/2001:"..., 87) = 87
> > shutdown(8, 1 /* send */)               = 0
> > gettimeofday({978893823, 343148}, NULL) = 0
> > read(8, "", 512)                        = 0
> > close(8)                                = 0
> > rt_sigaction(SIGUSR1, {0x807f774, [], SA_INTERRUPT|0x4000000}, {SIG_IGN}, 8) = 0
> > close(9)                                = 0
> >
> > 24 system calls (vs. something like 17 or 18 for 1.3 i think)
>
> _______________________________________________________________________________
> Ryan Bloom                        	rbb@apache.org
> 406 29th St.
> San Francisco, CA 94131
> -------------------------------------------------------------------------------
>
>
>


Mime
View raw message