最建议 Windows 文件夹 (NTFS) 中包含多少个文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5384187/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How many files is most advised to have in a Windows folder (NTFS)?
提问by Denis
we have a project that constitutes a large archive of image files... We try to split them into sub-folders within the main archive folder. Each sub-folder contains up to 2500 files in it.
我们有一个包含大量图像文件存档的项目...我们尝试将它们拆分为主存档文件夹中的子文件夹。每个子文件夹中最多包含 2500 个文件。
For example:
例如:
C:\Archive
C:\Archive\Animals\
C:\Archive\Animals##代码##1 - 2500 files...
C:\Archive\Animals##代码##2 - 2300 files..
C:\Archive\Politics\
C:\Archive\Politics##代码##1 - 2000 files...
C:\Archive\Politics##代码##2 - 2100 files...
Etc... What would be the best way of storing files in such way under Windows ? and why exactly, please ... ?
等等......在Windows下以这种方式存储文件的最佳方式是什么?为什么,请...?
- Later on, the files have their EXIF metadata extracted and indexed for keywords, to be added into a Lucene index... (this is done by a Windows service that lives on the server)
- 稍后,这些文件的 EXIF 元数据会被提取出来并为关键字建立索引,然后将其添加到 Lucene 索引中……(这是由驻留在服务器上的 Windows 服务完成的)
回答by Scott
We have an application where we try to make sure we don't store more than around 1000 files in a directory. Under Windows at least, we noticed extreme degradation in performance over this number. The folder can theoretically store up to 4,294,967,295 in Windows 7. Note that because the OS does a scan of the folder, doing lookups and lists very quickly degrades as you add many more files. Once we got to 100,000 files in a folder it was almost completely unusable.
我们有一个应用程序,我们尝试确保在一个目录中存储的文件不超过 1000 个。至少在 Windows 下,我们注意到性能在这个数字上急剧下降。该文件夹理论上可以在 Windows 7 中存储多达 4,294,967,295 个文件。请注意,由于操作系统会扫描文件夹,因此当您添加更多文件时,查找和列表的性能会很快降低。一旦我们在一个文件夹中找到 100,000 个文件,它几乎完全无法使用。
I'd recommend breaking down the animals even further, perhaps by first letter of name. Same with the other files. This will let you separate things out more so you won't have to worry about the directory performance. Best advice I can give is to perform some stress tests on your system to see where the performance starts to tail off once you have enough files in a directory. Just be aware you'll need several thousand files to test this out.
我建议进一步分解动物,也许是通过名字的第一个字母。与其他文件相同。这将使您将更多的东西分开,因此您不必担心目录性能。我能给出的最好建议是对您的系统执行一些压力测试,以查看一旦目录中有足够的文件,性能开始下降。请注意,您需要数千个文件来测试这一点。