home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.sgi
- Path: sparky!uunet!elroy.jpl.nasa.gov!ames!sgi!rhyolite!vjs
- From: vjs@rhyolite.wpd.sgi.com (Vernon Schryver)
- Subject: Re: System Slowdown
- Message-ID: <pe7bup4@rhyolite.wpd.sgi.com>
- Organization: Silicon Graphics, Inc. Mountain View, CA
- References: <Bu22Jz.D3I@knot.ccs.queensu.ca>
- Date: Fri, 4 Sep 1992 14:36:44 GMT
- Lines: 41
-
- In article <Bu22Jz.D3I@knot.ccs.queensu.ca>, tarun@psyclops.psyc.queensu.ca (Tarun Kripalani) writes:
- > I am experiencing a slowdown in our Iris (310GTX) whenever
- > we have more than a certain number of files in a directory.
- > As soon as I am in a directory that has about 2000 files and
- > I do a mv, cp, ls etc. it takes ages to perform. Everything
- > I do then is slowed down including any other user's processes.
- > Why is this happening? What can I do to fix this problem?
-
-
- There is some tuning that can be done to help, but it is fundamentally
- wrong to put thousands of files in one directory.
-
- Consider it from the computer's point of view. In such a bloated
- directory, every time you tell the system to do anything with a file
- name, the system must consider all of the other file names. If you
- create a new name, the system must check that the name is not the same
- as any other name, and so must examine every one of the other names.
- If you open an existing name, the system must search for that name, and
- on average examine half of the other names. When you use `ls`, it must
- sort all of the names.
-
- A particularly bad requirement is that the system must in principle
- examine the disk for each and every name. In a directory with a few
- names, the system can buffer all of the necessary disk information in
- main memory and avoid disk operations on second or subsequent
- requests. If you have an eggregiously large file directory, the
- system's buffers will not be big enough. The system will fill the
- buffers from the disk with the first hundreds or thousands of names
- (and inodes if you use `ls -F`) as it starts working on your request.
- Then if necessary, it will read more information from the disk, into
- those same buffers. If you do a second operation, it will have to
- re-read everything from the disk from the beginning. On the other
- hand, if your directory is small enough, it would all fit in the
- buffers, and second commands would not pay the 1000X or 10000X time
- penalty of having to read the disk.
-
- The best solution is to use hierarchies. Spread your files into
- sub-directories.
-
-
- Vernon Schryver, vjs@sgi.com
-