bug-findutils
[Top][All Lists]
Advanced

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

Re: Why is `find -name '*.txt'` much slower than '*.txt' on glusterfs?


From: Bernhard Voelker
Subject: Re: Why is `find -name '*.txt'` much slower than '*.txt' on glusterfs?
Date: Sat, 27 Jan 2018 17:23:51 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

On 01/24/2018 09:17 PM, Peng Yu wrote:
$ time find -maxdepth 1 -name '*.tsv' > /dev/null

real    0m21.118s
user    0m0.446s
sys    0m0.577s
$ time find -name '*.tsv' > /dev/null

real    0m21.277s
user    0m0.454s
sys    0m0.636s
$ time ./main.sh  > /dev/null

real    0m2.695s
user    0m0.046s
sys    0m0.057s

Is your find binary built with D_TYPE support?

  $ find --version
  find (GNU findutils) 4.6.0
  Copyright (C) 2015 Free Software Foundation, Inc.
  ...
  Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) 
CBO(level=2)
____________________^^^^^^

Would you please try to reproduce this on a local file system, e.g. ext4?

Finally, use "strace -v find ..." so that we see whether the 'getdents'
system call returns D_TYPE information:

  $ strace -ve getdents  find -maxdepth 1 -name '*.tsv'
  getdents(4, [{d_ino=4276237, d_off=4278742733963192100, d_reclen=24, 
d_name=".", d_type=DT_DIR},
               {d_ino=4055085, d_off=8511941719133486354, d_reclen=24, 
d_name="..", d_type=DT_DIR},
               {d_ino=4276239, d_off=9223372036854775807, d_reclen=24, 
d_name="file", d_type=DT_REG}],
               32768) = 72
  getdents(4, [], 32768)                  = 0

In the end, it may turn out that either your 'find' binary is not compiled
with D_TYPE support, or that glusterfs doesn't provide this information
(and therefore find needs to invoke the additional newfstatat()s.

Have a nice day,
Berny




reply via email to

[Prev in Thread] Current Thread [Next in Thread]