On 2018-01-19 20:26, Peng Yu wrote:
Hi,
There are ~7000 .txt files in a directory on glusterfs. Here are the
run time of the following two commands. Does anybody know why the find
command is much slower than *.txt. Is there a way to change the api
that `find` uses to search files so that it can be more friendly to
glusterfs?
A wild guess: find is calling stat on every directory entry that it
reads?
What do you see if you run these commands under "strace"?
On GNU/Linux, programs that search through directories can avoid calling
stat in many cases by taking advantage of the "d_type" field in
"struct dirent". Maybe this doesn't work on glusterfs?
The *.txt syntax (that specific case of it) doesn't have to stat any
inodes because it just cares about the names whether they are
directories
or other objects.