From owner-freebsd-performance@FreeBSD.ORG Tue Nov 23 06:06:56 2004 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0A99516A4CE for ; Tue, 23 Nov 2004 06:06:56 +0000 (GMT) Received: from daemon.kr.FreeBSD.org (www.kr.freebsd.org [211.115.73.199]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6CE2843D5D for ; Tue, 23 Nov 2004 06:06:55 +0000 (GMT) (envelope-from cjh@kr.FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by daemon.kr.FreeBSD.org (Postfix) with ESMTP id BA98C1A6F1; Tue, 23 Nov 2004 15:06:50 +0900 (KST) Received: from daemon.kr.FreeBSD.org ([127.0.0.1]) by localhost (daemon.kr.freebsd.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 86664-14; Tue, 23 Nov 2004 15:06:46 +0900 (KST) Received: from localhost (gradius [211.44.63.164]) by daemon.kr.FreeBSD.org (Postfix) with ESMTP id 6E8EF1A6E4; Tue, 23 Nov 2004 15:06:45 +0900 (KST) Date: Tue, 23 Nov 2004 15:06:47 +0900 (KST) Message-Id: <20041123.150647.41628290.cjh@kr.FreeBSD.org> To: aaron.glenn@gmail.com From: CHOI Junho 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> Organization: Korea FreeBSD Users Group X-URL: http://www.kr.FreeBSD.org/~cjh X-Mailer: Mew version 4.1.50 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at kr.FreeBSD.org cc: freebsd-performance@freebsd.org cc: arne_woerner@yahoo.com Subject: Re: I've ran out of ideas X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2004 06:06:56 -0000 From: Aaron Glenn 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 cjh@[kr.]FreeBSD.org Key fingerprint =3D 1369 7374 A45F F41A F3C0 07E3 4A01 C020 E602 60F5