Date: Fri, 22 Jan 2016 19:36:30 +0100 From: Mark Martinec <Mark.Martinec+freebsd@ijs.si> To: freebsd-hackers@freebsd.org Subject: RE: get number of open files in a process? Message-ID: <8a32fa24128e9def077522b1ea0414e6@mailbox.ijs.si> In-Reply-To: <8ca419f8820c4280a81f03102c7c0372@hioexcmbx08-prd.hq.netapp.com> References: <ea9f2ab2d4f543c8ad34fdeb082f8c7a@hioexcmbx08-prd.hq.netapp.com> <20160121153636.GA10961@britannica.bec.de> <20160121161637.GA83843@night.db.net> <20160121162527.GA11600@britannica.bec.de> <d26cc2fcea304ea6a89f61c2ec497322@hioexcmbx08-prd.hq.netapp.com> <20160121191308.GA21869@dft-labs.eu> <31126442b7d347c5976a57aabc2e5792@hioexcmbx08-prd.hq.netapp.com> <20160121224511.GA74045@stack.nl> <20160121225111.GB21869@dft-labs.eu> <8ca419f8820c4280a81f03102c7c0372@hioexcmbx08-prd.hq.netapp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2016-01-22 00:14, Batutis, Ed wrote: >> I'm still not convinced the approach here (of checking fds) is the >> right one >> to take - you have to have a very big reserve to not suddenly run out >> of fds, >> one would just limit amount of clients and, well, handle errors as >> they can >> pop up for reasons other than running out of fd slots. > > I have a large reserve - usually more than 1000 fd slots. But > occasionally something happens and the process runs out. There are a > lot of different things going on in the process in terms of fd usage. > So, finding the issue could be easier if I know when the number > started rising to an unusual level. And I can possibly find the root > cause more easily if I stop doing some things when this happens. I can > monitor memory usage and CPU usage easily enough, but I could not > figure out how to monitor fd usage. There are other approaches, yes. > But I was looking for something simple but useful until additional > effort could be expended on other approaches. I imagine that instrumenting opens, closes, dups and the like with dtrace would be able to do the job: increment a count when a new fd pops up, decrement on close, and you may end up with a diagram of fd usage over time. Or track each operation dealing with file descriptors individually. Msrk
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8a32fa24128e9def077522b1ea0414e6>