将图片存储为文件或数据库的Web应用程序? [英] Store pictures as files or in the database for a web app?

查看:239
本文介绍了将图片存储为文件或数据库的Web应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是很普通的,我知道有可能不是一个100%的回答。我建立一个ASP .NET Web解决方案,其中将包括大量的图片和流量的希望相当数量。我真的想实现的性能。

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

复制储存影像 - 是啊,还是不是,的如何存储图像文件系统,的存储少量的图像:BLOB或FS?,可能一些人。

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.


注释:感谢许多好的答案。我会去为一个基于文件的解决方案,即使我喜欢有一个100%的数据库驱动的解决方案的想法。它似乎有今天良好的解决方案,做我想做的与数据库等,但我有没有这样做有几个原因。

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.


  • 我将是一个托管解决方案,我有存储量巨大(10GB),但只有300MB数据库。这将花费很多关于在DB额外的存储空间。

  • 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.

我不是一个DB专家,以及并不在DB的设置控制。因为它看起来像一个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...


  1. 您将能够服务于图片为静态文件。

  2. 没有访问数据库或应用程序code将需要获取的图片。

  3. 图像可以从不同的服务器提供服务,以提高性能。

  4. 这将减少数据库的瓶颈。

  5. 数据库最终存储在文件系统上的数据。

  6. 图片可以很容易地在存储在文件系统上的缓存。

这篇关于将图片存储为文件或数据库的Web应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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