资产管理:在 Web 服务器上组织用户生成的文件的更好方法是什么?

发布于 2024-10-01 05:35:10 字数 693 浏览 1 评论 0原文

我们正在构建一个系统,允许用户将多个图像和视频上传到我们的服务器。

与我合作的团队决定将属于用户的所有资产保存在使用用户的唯一标识符命名的文件夹中。该文件夹又将成为文件服务器上我们的主资产文件夹的子文件夹。

他们提出的文件结构如下:

[asset_root]/userid1/assets1  
[asset_root]/userid1/assets2  

[asset_root]/userid2/assets1  
[asset_root]/userid2/assets2  

etc.

我们预计在该系统的生命周期内将有数千或可能超过一百万的用户。

我一直认为在一个位置拥有许多子文件夹并不是一个好主意,并建议采用年/月/日的方法,如下所示:

[asset_root]/2010/11/04/userid1/assets1  
[asset_root]/2010/11/04/userid1/assets2  

[asset_root]/2010/11/04/userid2/assets1  
[asset_root]/2010/11/04/userid2/assets2  

etc.

有谁知道上述哪种方法更适合这么多资产?有没有更好的方法在服务器上组织图像/视频?

该系统将是带有 SAN 的 Windows IIS 7.5。

非常感谢。

We are in the process of building a system which allows users to upload multiple images and videos to our servers.

The team I'm working with have decided to save all the assets belonging to a user in a folder named using the user's unique identifier. This folder in turn will be a sub-folder of our main assets folder on the file server.

The file structure they have proposed is as follows:

[asset_root]/userid1/assets1  
[asset_root]/userid1/assets2  

[asset_root]/userid2/assets1  
[asset_root]/userid2/assets2  

etc.

We are expecting to have thousands or possibly a million+ users in the life time of this system.

I always thought that it wasn't a good idea to have many sub-folders in a single location and suggested a year/month/day approach as follows:

[asset_root]/2010/11/04/userid1/assets1  
[asset_root]/2010/11/04/userid1/assets2  

[asset_root]/2010/11/04/userid2/assets1  
[asset_root]/2010/11/04/userid2/assets2  

etc.

Does anyone know which of the above approaches would be better suited for this many assets? Is there a better method to organize images/videos on a server?

The system in question will be an Windows IIS 7.5 with a SAN.

Many thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

野却迷人 2024-10-08 05:35:10

一般来说,您是正确的,因为许多文件系统对一个文件夹中可能存在的文件和文件夹的数量施加了限制。如果你的用户数量达到了这个限制,你就有麻烦了。

一般来说,我会简单地为每个图像使用 uuid ,并具有一定的尺寸的分区。例如,ABCDEFGH 的哈希值最终将成为 [asset_root]/ABC/DEFGH。使用哈希可以让您更好地确定每个文件夹中最终的文件数量,并且使您不必担心,例如,不知道您需要的图像存储在哪个月份。

In general you are correct, in that many file systems impose a limit on the number of files and folders which may be in one folder. If you hit that limit with the number of users you have, your in trouble.

In general, I would simply use a uuid for each image, with some dimension of partitioning. e.g. A hash of ABCDEFGH would end up as [asset_root]/ABC/DEFGH. Using a hash gives you a greater degree of assurance about the number of files which will end up in each folder and prevents you from having to worry about, for example, not knowing which month an image you need was stored in.

寄意 2024-10-08 05:35:10

我猜你的文件系统是NTFS?如果是这样,则磁盘上的文件数限制为 4,294,967,295 个 - 文件夹中的文件数限制是相同的。如果您有数百万用户,那么您应该没问题,但您可能需要考虑每个用户只有一个文件夹,而不是如示例所示的多个文件夹。

I'm presuming your file system is NTFS? IF so, you've got a limit of 4,294,967,295 files on the disk - the limit of files in a folder is the same. If you have on the order of millions of users you should be fine, though you might want to consider having only one folder per user instead of several as your example indicates.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文