LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1308|回复: 4

一个文件夹下,存放多少个文件或文件夹后会影响文件读取性能?

[复制链接]
发表于 2009-1-2 11:01:56 | 显示全部楼层 |阅读模式
目前用的是ext3文件系统,如果今后用ext4文件系统,一个文件夹下存放多少个文件,存放多少个文件夹比较合适?
 楼主| 发表于 2009-2-22 21:45:08 | 显示全部楼层
没人关心这个?
回复 支持 反对

使用道具 举报

发表于 2009-3-13 16:48:02 | 显示全部楼层
同问,了解的说下啊
回复 支持 反对

使用道具 举报

发表于 2009-3-14 09:35:29 | 显示全部楼层
这个我也不知道答案,从官方 wiki 得知 ext4 对比 ext3 的改进是质的飞跃

维基上还有这个说明,http://en.wikipedia.org/wiki/Ext4
Break 32,000 subdirectory limit

In ext3 the number of subdirectories that a directory can contain is limited to 32,000. This limit has been raised to 64,000 in ext4, and with the "dir_nlink" feature it can go beyond this (although it will stop increasing the link count on the parent). To allow for continued performance given the possibility of much larger directories, htree indexes (a specialized version of a B-tree) is turned on by default in ext4. This feature is implemented in Linux kernel 2.6.23. Htree is also available in ext3 when the dir_index feature is enabled.
子目录的数量都双倍提升了,文件数量相信不用担心

影响传取性能的还包括其他新项目,见官方说明

http://ext4.wiki.kernel.org/index.php/New_ext4_features

ext4 值得推荐,吾正用之 :cool:

http://www.linuxsir.cn/bbs/thread343284.html
回复 支持 反对

使用道具 举报

发表于 2009-3-20 21:33:55 | 显示全部楼层
Post by 林知枫;1932855
目前用的是ext3文件系统,如果今后用ext4文件系统,一个文件夹下存放多少个文件,存放多少个文件夹比较合适?


一般的文件系统都会对 dirent 里的文件名,以及 inode 的 inum 做缓存。从文件系统的角度,文件夹和文件基本是一样的。

你说的目录下面存放多少文件比较合适。答案可能要看你的应用。如果频繁地访问某一个文件,而不是老在列目录(诸如 find, du 之类的操作),那么上千的文件也应该没关系。否则目录的深度和广度都会影响性能。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表