How many files can a windows server 2008 r2 directory safely hold?
Asked Answered
W

1

5

How many files can a windows server 2008 r2 directory safely hold?

I'm thinking in terms of a website that has image galleries. Say there is one directory that holds all the thumbnails and a different directory that holds the full size images. How many pairs of images can be safely stored?

Or, if there isn't a good cut-and-dry answer, should I just try it with 30,000 images?

Weichsel answered 22/10, 2010 at 20:33 Comment(0)
M
7

If your server is using NTFS for its volume file system, you aren't limited to any number of files per directory per se, but more in that you are limited to some number of files/directories per volume.

For NTFS, size limitations are:

NTFS Size Limits

Files per volume 4,294,967,295 (2^32 minus 1 file)

Of course, that says nothing about performance, and there are other considerations that can come into play. With 30000, you shouldn't worry. When you get into the millions, you might have to start restructuring.

edit to address scaling/performance

Technically speaking, the NTFS file system uses a global MFT that keeps track of all the files (directories are files and are mostly used for logical representation to the end user) so every time you modify the volume, that change is reflected in the MFT.

When you start having a single directory with large numbers of files, one of the recommended procedures is to disable automatic 8.3 name generation. From the technet article I linked above:

Every time you create a file with a long file name, NTFS creates a second file entry that has a similar 8.3 short file name. A file with an 8.3 short file name has a file name containing 1 to 8 characters and a file name extension containing 1 to 3 characters. The file name and file name extension are separated by a period.

So if you are constantly modifying a single directory with a large amount of files, the system has to generate a short name for it - this can lead to performance degradation if you are constantly modifying the contents of a single directory. Since you are storing images, it could be very likely a lot of the files have similar file names at the beginning, like imageblahblahblah.

For file look-up performance, even for large directories NTFS should be reasonably fast because of the underlying B-Tree implementation.

Also check out this thread: NTFS performance and large volumes of files and directories

Maines answered 22/10, 2010 at 20:45 Comment(2)
Yes, but is there a noticable downside, such as speed? With that many files will it take longer for a website to find the proper file and display it? Or modify content of the directory?Weichsel
@quakkels I edited some information concerning performance into my response.Maines

© 2022 - 2024 — McMap. All rights reserved.