Re: why is perl -e 'unlink(glob("*"))' so much faster than rm ?



ewaguespack@xxxxxxxxx wrote:
xhoster@xxxxxxxxx wrote:
ewaguespack@xxxxxxxxx wrote:
i had a situation that required that i remove several thousand zero
byte files, and i tried this first:

# find . -type f -exec rm -f {} \;

this was taking ages, so on a hunch I decided to try this to see it I
got any better results:

That fires up a separate rm process for each file. Using strace -f, it
looks like this involves 99 system calls per rm (not counting the ones
done in the parent process), only one of which is related to the actual
unlink.

....
i think part of the problem is that the server in question was
experiencing high iowait times....

when I ran the rm command on an idle server it was much faster.

When you have very large directories with multiple handles open to them
at the same time, things can degenerate spectacularly. Manipulating
directory entries has to be transactional, and I suspect the overhead of
making that so is very high.

I am still curious why it was so much faster.

I no longer know what "it" refers to, or what part of the answers you have
been give you don't understand/believe.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
.