将图片存储为文件或Web应用程序的数据库? [英] Store pictures as files or in the database for a web app?
问题描述
我的问题是相当通用的,我知道可能没有100%的答案。我正在构建一个ASP.NET网络解决方案,将包括大量的图片,希望有相当数量的流量。我真的想要实现性能。
我应该将图片保存在数据库还是文件系统?不管答案,我更感兴趣为什么选择一种特定的方式。
非常感谢,
Stefan
DUPLICATE :将图片存储在DB中 - 是或否?,如何在文件系统中存储图像,存储少量图像:blob或fs?以及其他一些。 p>
注释:感谢许多好的答案。我将去一个基于文件的解决方案,即使我喜欢有一个100%数据库驱动解决方案的想法。看来,今天有好的解决方案,做我想要的数据库等,但我有几个原因不这样做。
- p>我将在一个托管的解决方案,我有大量的存储(10gb),但只有300mb的数据库。
-
我不是数据库专家,也不能控制数据库的设置。基于数据库的解决方案可能需要自定义配置,因为它看起来像。
如果我们将移动到我们的网站自己的服务器我可能会考虑一个基于DB的解决方案。
谢谢,
Stefan
将图片存储在数据库中的文件系统和图片位置。
为什么?因为...
- 您将能够将图片作为静态文件。
- 无需任何数据库访问或应用程序代码即可获取图片。
- 图片可以从其他服务器提供,以提高性能。 / LI>
- 这将减少数据库的瓶颈。
- 该数据库最终存储在文件系统上的数据。
- 图片可以在文件系统上存储时轻松缓存。
My question is fairly generic and I know there might not be an 100% answer to it. I'm building an ASP .NET web solution that will include a lot of pictures and hopefully a fair amount of traffic. I do really want to achieve performance.
Should I save the pictures in the Database or on the File system? And regardless the answer I'm more interested in why choosing a specific way.
Many thanks, Stefan
DUPLICATE: Storing Images in DB - Yea or Nay?, How to store images in your filesystem, Storing a small number of images: blob or fs? and probably some others.
COMMENT: Thanks for many good answers. I will go for a file based solution even if I like the idea of having a 100% database driven solution. It seems that there are today good solutions to do what I want with databases etc but I have a few reasons for not doing it.
I will be on a hosted solution, I have huge amount of storage(10gb) but only 300mb for the database. It will cost a lot for extra storage in the DB.
I'm not an DB expert and as well not in control of settings of the DB. A DB based solution might need custom configuration as it looks like.
If we will move to run the site on our own server I might consider a DB based solution. thanks, Stefan
Store the pictures on the file system and picture locations in the database.
Why? Because...
- You will be able to serve the pictures as static files.
- No database access or application code will be required to fetch the pictures.
- The images could be served from a different server to improve performance.
- It will reduce database bottleneck.
- The database ultimately stores its data on the file system.
- Images can be easily cached when stored on the file system.
这篇关于将图片存储为文件或Web应用程序的数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!