I've ran out of ideas
cjh at kr.FreeBSD.org
Tue Nov 23 06:06:56 GMT 2004
From: Aaron Glenn <aaron.glenn at gmail.com>
Subject: Re: I've ran out of ideas
Date: Mon, 22 Nov 2004 14:55:10 -0800
> On Mon, 22 Nov 2004 14:45:30 -0800 (PST), Arne Wörner
> Hopefully the thttpd list has some ideas. Disabling the USE_SENDFILE
> macro in config.h actually decreased thoroughput, and filled my
> /var/log/messages with:
> Nov 22 15:23:20 d thttpd: mmc panic - freeing all unreferenced maps
> Nov 22 15:23:20 d thttpd: mmap - Cannot allocate memory
This message is logged then thttpd's memory management routime('mmc')
failed to allocate new memory for incoming request. Maybe your files
is too many and too big to fit in your RAM. thttpd's memory allocation
try to mmap() first in case of the requested file.
USE_SENDFILE patch changes this behavior to use sendfile() first, so
when you use sendfile(), this message will not occur.
You need to check how much memory thttpd use, If you have too many
file to serve at a certain period. thttpd's mmc use timeout(10 sec?)
and reference count to flush mmap() allocation. If you have 1G memory
and total size of requested file is over 1G in 10 seconds, this
message can occur. You can check this with 'top', seeing RES field
for thttpd when it's busy use.
If mmc failed, that request denied. mmc tries to dealloc all mmap'ed
memory(first message) and try to allocate new one(second message).
If sendfile() failed(usually for allocation failure to kernel's
sendfile buffer), it try to wait until allocate buffer even in
nonblocking mode(SFALLOC state when you see 'top'), so it delays
further processing, finally performance decreased.
If your thttpd memory usage is relatively low when you see RES field
of top's output(non-sendfile mode), you need to increase two values in
#define DESIRED_MAX_MAPPED_FILES 1000
#define DESIRED_MAX_MAPPED_BYTES 1000000000
Increase two values to fit your case. This is mmc's limit of mmap()
CHOI Junho <http://www.kr.FreeBSD.org/~cjh> cjh@[kr.]FreeBSD.org
Key fingerprint = 1369 7374 A45F F41A F3C0 07E3 4A01 C020 E602 60F5
More information about the freebsd-performance