Date: Tue, 23 Nov 2004 15:06:47 +0900 (KST) From: CHOI Junho <cjh@kr.FreeBSD.org> To: aaron.glenn@gmail.com Cc: arne_woerner@yahoo.com Subject: Re: I've ran out of ideas Message-ID: <20041123.150647.41628290.cjh@kr.FreeBSD.org> In-Reply-To: <18f60194041122145543bda4a3@mail.gmail.com> References: <20041122223823.15007.qmail@web14123.mail.yahoo.com> <20041122224530.65940.qmail@web41213.mail.yahoo.com> <18f60194041122145543bda4a3@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
From: Aaron Glenn <aaron.glenn@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=F6rner > 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[12304]: mmc panic - freeing all unreferenced= maps > Nov 22 15:23:20 d thttpd[12304]: mmap - Cannot allocate memory > = > Regards, > aaron.glenn 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 config.h: #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() allocation. -- CHOI Junho <http://www.kr.FreeBSD.org/~cjh> cjh@[kr.]FreeBSD.org Key fingerprint =3D 1369 7374 A45F F41A F3C0 07E3 4A01 C020 E602 60F5
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041123.150647.41628290.cjh>