Menu

#83 Listing directory with tons of files is slow

v1.0 (example)
open
nobody
None
5
2014-03-02
2014-01-28
No

A directory with 1000+ files takes sevaral minutes to open in gentoo.

Discussion

  • Emil Brink

    Emil Brink - 2014-02-01

    Hi! Thanks for reporting. Can you please provide some more detail?

    Like:

    • Was the directory on a local or network drive?
    • Was it on a hard disk or on SSD?
    • What were the type(s) of most of the files? I.e. "mostly JPEGs", "mostly text files", "empty files", or what?
    • Your operating system type and version?
    • Your CPU model and speed, and your amount of RAM?

    These are all things that can greatly affect what causes the slowdown and thus make it easier to hunt down. Thanks.

     
  • Michal Plichta

    Michal Plichta - 2014-02-04
    • local directory
    • HDD 5400 rpm
    • small txt file with logs avg. 300 B - 4 KB, there were ~5500 files
    • Linux 3.11.10-geek #3 SMP PREEMPT Tue Dec 31 16:27:57 CET 2013 x86_64
    • AMD E-450 APU with Radeon(tm) HD Graphics AuthenticAMD GNU/Linux
    • 8 GB of RAM

    If it helps, I can recompile gentoo with some debug options (my distro is gentoo) and send you logs. Just tell me.

    BTW. during listing of directory 'file' process took 100% of one of my CPU's core (for about 2 min), so 50% in total

     
  • Emil Brink

    Emil Brink - 2014-03-02
    • summary: listing directory with tons of files is slow --> Listing directory with tons of files is slow
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +1 @@
    -directory with 1000+ files open in minutes in gentoo...
    +A directory with 1000+ files takes sevaral minutes to open in gentoo.
    
     
  • Emil Brink

    Emil Brink - 2014-03-02

    Hi!

    It seems it's the identification of the file types for your files that is taking too long.

    I assume the files lack a simple (filename-based) type rule, i.e. they're not all named something that ends in ".txt"?

    The fact that gentoo has resorted to running the external "file" command to identify the files' types is very telling; you want to avoid that in general since it's much slower than the built-in rules.

     

Log in to post a comment.