一个文件夹还是多个文件夹,用于存储数百家商店的800万张图像? [英] single folder or many folders for storing 8 million images of hundreds of stores?

查看:57
本文介绍了一个文件夹还是多个文件夹,用于存储数百家商店的800万张图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个价格比较站点,其中有数百家商店,每家商店都有数千张产品图片.

I am developing a price comparison site with hundreds of stores and thousands of product images for each store.

总共有800万张图片.

In total there are 8 million images.

每个图像都具有以下文件名格式:StoreID-productID.jpg

Each image has this file name format: StoreID-productID.jpg

每个图像大小小于10KB.平均7KB.

Each image size is less than 10KB. average 7KB.

该网站是使用php和mysql开发的.

The site is developed with php and mysql.

我有Linux专用服务器.

I have linux dedicated server.

我有很多磁盘空间.因此,这不是问题.

I have a lot of disk space. so, that is not an issue.

我的问题是:

  1. 我应该将所有商店的所有图像都保存在一个文件夹中吗?

因此,一个文件夹中将有800万张图像.

So, 8 million images will be in a single folder.

这会影响检索效率吗?

目前我正在使用这种方法,想知道这种方法是否有缺点.

At present I am using this method and would like to know if there are any disadvantages of this method.

  1. 我应该为每个商店保留一个文件夹,并将该商店的图像保留在该文件夹中吗?

点赞:

images/storeID1/
images/storeID2/
....

请提出建议.谢谢

推荐答案

取决于您使用的文件系统.(EXT3,NTFS,FAT等).

Depends on the file system you are using. (EXT3, NTFS, FAT, etc).

每个文件夹都有不同的文件夹大小限制和性能特征.

Each will have different folder size limits and performance characteristics.

对于800万个文件,最安全的方法是尽可能多地分离文件夹.如果遇到扩展问题,则可以选择将它们设置为不同的物理驱动器.

For 8 million files t will be safest to separate as many folders as you can. Then you have the option to make them different physical drives if you run into scaling issues.

如果您使用的是Linux,则可以很容易地在现有文件夹结构中挂载另一个驱动器.您也可以使用符号链接.

If you're on Linux, its easy to mount another drive right among your existing folder structure. You could alternatively use a symbolic link.

images/Store1/FILES...
images/Store2 ---> /mount/SDA01/Store2/ (symbolic link to a separate drive)

限制

有关不同文件系统限制的更多详细信息,请参见此SuperUser问题:请注意,这些是系统可以处理的绝对限制.这些限制上限的性能肯定会受到影响.

Note these are the absolute limits of what the system can handle. Performance at the upper bound of those limits will definitely suffer.

这篇关于一个文件夹还是多个文件夹,用于存储数百家商店的800万张图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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