在照片共享类型的网站.....最好将照片存储在数据库...或网站文件夹中.. [英] in photosharing type website .....it is best to store photos in database...or in website folder..

查看:133
本文介绍了在照片共享类型的网站.....最好将照片存储在数据库...或网站文件夹中..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在照片共享类型的网站.....最好将照片存储在数据库...或网站文件夹中...以获得良好的网站性能....我听说如果我们存储照片即二进制数据数据库它增加网站负载随着用户增加。这是真的,这是最好的方式(数据库或网站文件夹中的照片,只存储数据库中的路径)..请给出建议..

in photosharing type of website .....it is best to store photos in database...or in website folder..for good performance of website....i heard that if we store photos i.e binary data in database it increase site load as users increases .is this is true and which is best way for that (database or photos in folder of website by storing only path in database )..please give suggestions..

推荐答案

这里有一个链接很好的链接和方法:



http://stackoverflow.com/questions/3748/storing-images-in-db-yea-or-nay [ ^ ]



另见以下文章:



http://research.microsoft.com/apps/pubs/default.aspx?i d = 64525 [ ^ ]
here is a link with good links and approach:

http://stackoverflow.com/questions/3748/storing-images-in-db-yea-or-nay[^]

also look at the following article:

http://research.microsoft.com/apps/pubs/default.aspx?id=64525[^]


转到Web服务器中文件夹存储的文件系统。



原因和解释如下。 />


1. ASP。 Net将图像上传到数据库 [ ^ ]。

Go for Filesystems that is Folder storage in Web Server.

Reasons and explanations are as follows.

1. ASP.Net Upload image to Database[^].


如果您正在开发照片共享或相册的网站,那么您可以'将图像存储到数据库中,因为这将使您的数据库非常笨重,以存储其他配置文件和数据。

因此,您必须采用第一种方法将图像上传到文件夹。 />

If you are developing a web site of photo sharing or albums then you can’t store images into the database, coz this will make your database very bulky to store the other profiles and data.
So, you have to adopt the first method to upload the images to a folder.



2. 哪个更好:在/上存储/检索图像F rom SQL服务器或服务器上的目录 [ ^ ]。


2. Which is better : Storing/retrieving images on/from SQL server or in a directory on server[^].



如果图像的内容不断变化,应用程序逻辑需要在交付之前处理它们,这对于通过应用服务器提供(即你可以留在DB)。如果图像本质上本身是非常静态的 - 不经常更改并且需要多次传递,(设置一次读取/传递多次)场景,那么网络始终是首选方法。无论DB的性能如何,这都适用。


If content of the image is going to keep changing and application logic needs to process them before delivering it makes more sense to deliver via app server (i.e. you can keep in DB). Where as if images by nature itself is quite static - not changing often and needs to be delivered so many times, (set once read/deliver many times) scenario then, it the web is always a preferred method. this applies irrespective of performance of DB.



3. Re:在SQL数据库中存储图像与在单独的文件夹中存储图像并使用URL图像路径 [ ^ ]。


3. Re: Storing images in SQL database vs storing images in seperate folder and using URL image path[^].



从数据库中检索图像会产生相当大的开销使用文件系统。

数据库SAN上的磁盘存储通常比Web服务器场中使用的磁盘上的存储更昂贵。


Retrieving an image from a database incurs significant overhead compared to using the file system.
Disk storage on database SANs is typically more expensive than storage on disks used in Web server farms.



4. 我应该在哪里存储照片?文件系统或数据库 [ ^ ]。


4. Where should I store photos? File system or the database[^].



文件系统,当然,除非你的目标是关于thedailywtf的故事。最简单的方法是让照片按照您可以从文件本身派生的属性进行组织,例如SHA-1哈希。然后将哈希值存储在数据库中,附加到照片的主键和其他属性(上传者,上传日期等)。


Filesystem, of course, unless you''re aiming for a story on thedailywtf. The easiest way is to have the photos organized by a property you can derive from the file itself, such as its SHA-1 hash. Then just store the hash in the database, attached to the photo''s primary key and other attributes (who uploaded it, upload date, etc).



谢谢......


Thanks...


这篇关于在照片共享类型的网站.....最好将照片存储在数据库...或网站文件夹中..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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