Date: Sat, 27 Sep 2008 23:41:10 +0200 (CEST) From: Oliver Fromme <olli@lurza.secnetix.de> To: freebsd-stable@FreeBSD.ORG, 000.fbsd@quip.cz Subject: Re: sysctl maxfiles Message-ID: <200809272141.m8RLfALZ085971@lurza.secnetix.de> In-Reply-To: <48DE9411.8010002@quip.cz>
next in thread | previous in thread | raw e-mail | index | archive | help
Miroslav Lachman wrote: > 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? Those are different things: fstat lists file descriptors, while kern.openfiles counts open file objects, which are often shared among processes. For example, when the apache master process forks its children, the children inherit the open file objects from the parent process. While every child has its own set of file descriptors (listed separately by fstat), they reference the same underlying open file objects, so they don't contribute separately to kern.openfiles. In the same way, fstat lists stdin + stdout + stderr for almost every process, but in most cases they are not separate file objects because they were inherited from the parent process. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "In My Egoistical Opinion, most people's C programs should be indented six feet downward and covered with dirt." -- Blair P. Houghton
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200809272141.m8RLfALZ085971>