在文件系统中存储​​大量的文件 [英] Storing Large Number Of Files in File-System

查看:136
本文介绍了在文件系统中存储​​大量的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几百万的音频文件,生成基于GUID(<一href="http://en.wikipedia.org/wiki/Globally%5FUnique%5FIdentifier">http://en.wikipedia.org/wiki/Globally%5FUnique%5FIdentifier).我怎样才能将这些文件存储在文件系统,这样我可以有效地在同一个文件系统中添加更多的文件并能搜索特定文件的有效。此外,它应该是可扩展的未来。

I have millions of audio files, generated based on GUId (http://en.wikipedia.org/wiki/Globally%5FUnique%5FIdentifier). How can I store these files in the file-system so that I can efficiently add more files in the same file-system and can search for a particular file efficiently. Also it should be scalable in future.

文件基于GUID(唯一的文件名)命名。

Files are named based on GUId (unique file name).

例如:

[1] 63f4c070-0ab2-102d-ADCB-0015f22e2e5c

[1] 63f4c070-0ab2-102d-adcb-0015f22e2e5c

[2] ba7cd610-f268-102c-b5ac-0013d​​4a7a2d6

[2] ba7cd610-f268-102c-b5ac-0013d4a7a2d6

[3] d03cf036-0ab2-102d-ADCB-0015f22e2e5c

[3] d03cf036-0ab2-102d-adcb-0015f22e2e5c

[4] d3655a36-0ab3-102d-ADCB-0015f22e2e5c

[4] d3655a36-0ab3-102d-adcb-0015f22e2e5c

PL。给你的看法。

PS:我已经经历了&LT; <一href="http://stackoverflow.com/questions/446358/storing-a-large-number-of-images">http://stackoverflow.com/questions/446358/storing-a-large-number-of-images >。我所需要的特定的数据结构/算法/逻辑,以便它可以也将在未来的可扩展性

PS: I have already gone through < http://stackoverflow.com/questions/446358/storing-a-large-number-of-images >. I need the particular data-structure/algorithm/logic so that it can also be scalable in future.

EDIT1:文件是大约1-2百万的数量和文件系统是EXT3(CentOS的)

Files are around 1-2 millions in number and file system is ext3 (CentOS).

谢谢

纳文

推荐答案

这很容易 - 构建基于GUID的文件夹树重视的部分。

That's very easy - build a folder tree based on GUID values parts.

例如,使256个文件夹中的每个命名的第一个字节后只存储有文件,有一个GUID开始,此字节。如果这仍然是一个文件夹中的文件太多 - 为GUID的第二个字节做的每个文件夹中的一样。如果需要添加更多的水平。搜索文件将是非常快的。

For example, make 256 folders each named after the first byte and only store there files that have a GUID starting with this byte. If that's still too many files in one folder - do the same in each folder for the second byte of the GUID. Add more levels if needed. Search for a file will be very fast.

通过选择您使用的每个级别的字节数就可以有效地选择树形结构为您的方案。

By selecting the number of bytes you use for each level you can effectively choose the tree structure for your scenario.

这篇关于在文件系统中存储​​大量的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆