在Linux的单个文件夹中的20万个图像,性能问题与否? [英] 200,000 images in single folder in linux, performance issue or not?

查看:109
本文介绍了在Linux的单个文件夹中的20万个图像,性能问题与否?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在单个文件夹(linux服务器)中有 200,000 图像的php / mysql网站。我不认为,我永远不需要在文件浏览器中看到他们,而是在他们的个人网页上查看网站。他们只是显示在网站上的产品页面。 文件系统是ext3 。所以将它们保存在单个文件夹中是明智的吗?它可以减慢网站的性能吗?

解决方案

Ext3使用树来保存目录内容,所以它能够处理大量的单个目录中的文件比具有线性目录列表的文件系统更好。
在这里您可以阅读树的描述用来保留目录内容。



然而,200K文件仍然是一个巨大的数字。根据文件名的前n个字符将它们移动到子目录是合理的。这种方法可以让你只保存文件名而不保存目录名,当你需要访问文件时,你知道在哪里(在哪个子目录中)查找它。

I have a php/mysql website with over 200,000 images in single folder (linux server). I don't think, that I will never need to see them in file explorer, instead they will be viewed on website on their individual pages. They are just displayed in product page on website. File system is ext3. so is it wise to save them in single folder? can it slow down the site's performance?

解决方案

Ext3 uses tree to hold directory contents, so its capability to handle a large number of files in a single directory is better than that of those file systems with linear directory listings. Here you can read the description of the tree used to keep directory contents.

However, 200K files is still a huge number. It's reasonable to move them into subdirectories based on first n characters of file names. This approach lets you keep only file names and not directory names, and when you need to access the file, you know where (in which subdirectory) to look for it.

这篇关于在Linux的单个文件夹中的20万个图像,性能问题与否?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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