Re: fam using lots of CPU



On Thu, 2004-05-27 at 09:50, Jean-Marc Valin wrote:
> Hi,
> 
> I'm having problems with fam on my machine (Fedora Core 2). When running
> one of my programs and redirecting stdout to a file, fam ends up eating
> all the CPU. During a normal run, my program takes 10 seconds of CPU
> while sneding 6.7 MB of data to stdout (which ends up in a file). In the
> meantime, fam ended up using 2 minutes(!!) of CPU: 12x more than the
> program it's monitoring. The file I'm writing is on a local filesystem
> and I have no filemanager open. Also, I've been able to see that if I
> remove the prints, fam no longer eats CPU.
> 
> Anyone can help? I can provide more info if necessary. Please add me in
> CC to the reply since I'm not on the list.
> 
> 	Jean-Marc

Hi!

It would be interesting if fam is monitoring the directory you are
working in. 

Check 

$ fuser -v /directory

or

$ lsof | grep /directory

under root.

I was able to reproduce your experience by executing

$ time bash -c "for ((a=1;a<100000;a++)); do echo \"test $a\"; done >
test.txt"

in a directory beeing watched/not being watched by fam (and nautilus).

with fam: 0:30.44elapsed 12%CPU (the rest goes to fam 45% and nautilus
40%)
without fam: 0:03.47elapsed 98%CPU

Your experience is backing my impression that file alteration monitoring
via events (kernel directory notification using dnotify) is less
efficient than people tend to expect...

What you could try:

to disable fam in xinetd 
or
recompile fam without the dnotify patch.

Norbert








[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]