From owner-freebsd-stable@FreeBSD.ORG Sat Sep 27 20:13:39 2008 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0131106568C; Sat, 27 Sep 2008 20:13:39 +0000 (UTC) (envelope-from 000.fbsd@quip.cz) Received: from elsa.codelab.cz (elsa.codelab.cz [91.103.162.4]) by mx1.freebsd.org (Postfix) with ESMTP id 8A8C88FC15; Sat, 27 Sep 2008 20:13:39 +0000 (UTC) (envelope-from 000.fbsd@quip.cz) Received: from localhost (localhost.codelab.cz [127.0.0.1]) by elsa.codelab.cz (Postfix) with ESMTP id 9B6DC19E02A; Sat, 27 Sep 2008 22:13:37 +0200 (CEST) Received: from [192.168.1.2] (r5bb235.net.upc.cz [86.49.61.235]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by elsa.codelab.cz (Postfix) with ESMTPSA id 6B29519E027; Sat, 27 Sep 2008 22:13:35 +0200 (CEST) Message-ID: <48DE9411.8010002@quip.cz> Date: Sat, 27 Sep 2008 22:14:09 +0200 From: Miroslav Lachman <000.fbsd@quip.cz> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: cz, cs, en, en-us MIME-Version: 1.0 To: Jeremy Chadwick References: <98425339-23F8-4A90-8CF1-2E85DD82D857@ish.com.au> <20080927030204.GB40195@icarus.home.lan> In-Reply-To: <20080927030204.GB40195@icarus.home.lan> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-stable Stable Subject: Re: sysctl maxfiles X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Sep 2008 20:13:39 -0000 Jeremy Chadwick wrote: > On Sat, Sep 27, 2008 at 11:10:01AM +1000, Aristedes Maniatis wrote: > >>By default FreeBSD 7.0 shipped with the sysctls set to: >> >>kern.maxfiles: 12328 >>kern.maxfilesperproc: 11095 [...] > Anyway, I'd like to know why you have so many fds open simultaneously in > the first place. We're talking over 11,000 fds actively open at once -- > this is not a small number. What exactly is this machine doing? Are > you absolutely certain tuning this higher is justified? Have you looked > into the possibility that you have a program which is exhausting fds by > not closing them when finished? (Yes, this is quite common; I've seen > bad Java code cause this problem on Solaris.) I can imagine some webhosting machine running Apache virtualhosts. Each virtual host using 3 logfiles (access log, error log, IO log) so it is "only" about 4000 domains (virtualhosts) which is not so uncommon in these days ;) I don't know what files are "really" open in the meaning of kern.maxfiles. I have webserver with about 100 hosted domains and there is some numbers: root@roxy ~/# fstat -u www | wc -l 9931 root@roxy ~/# fstat -u root | wc -l 718 root@roxy ~/# fstat | grep httpd | wc -l 6379 root@roxy ~/# fstat | grep httpd | wc -l 6002 root@roxy ~/# fstat -u www | wc -l 4691 root@roxy ~/# sysctl kern.openfiles kern.openfiles: 846 All above taken within few seconds. Can somebody explain the difference between kern.openfiles and fstat? Miroslav Lachman