数据库blob vs磁盘存储的文件 [英] Database blobs vs Disk stored files

查看:259
本文介绍了数据库blob vs磁盘存储的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有这个要求说,应用程序必须让用户每月上传和下载约6000个文件(主要是pdf,doc,xls)。

So I have this requirement that says the app must let users upload and download about 6000 files per month (mostly pdf, doc, xls).

关于这个的最佳解决方案。问题是我将在我的数据库中使用BLOb还是使用简单的文件层次结构来编写/读取这些文件。

I was thinking about the optimal solution for this. Question is whether I'll use BLOb's in my database or a simple file hierarchy for writing/reading these bunch of files.

应用程序架构基于Java 1.6,Spring 3.1 and DOJO,Informix 10.X。

The app architecture is based on Java 1.6, Spring 3.1 and DOJO, Informix 10.X.

所以我这里只是根据你的经验给予建议。

So I'm here just to be advised based on your experience.

推荐答案

如果数据库中有其他数据与这些文件相关,则将文件存储到文件系统会使其更复杂:

If you have other data in database in relation to these files, storing files to file system makes it more complex:


  1. 备份应该单独进行。

  2. 必须单独实施事务(尽可能针对文件系统操作)。

  3. 数据库和文件系统结构之间的完整性检查

  4. 没有级联:由于移除用户而移除用户的照片。

  5. 首先,您必须查询文件的路径数据库,然后从文件系统中选择一个。

  1. Back-up should be done separately.
  2. Transactions have to be separately implemented (as far as even possible for file system operations).
  3. Integrity checks between database and file system structure do not come out of the box.
  4. No cascades: removing users pictures as consequence of removing user.
  5. First you have to query for path of file from database and then pick one from file system.

基于文件系统的解决方案有什么好处是,直接访问文件,例如将图像的一部分复制到其他地方。同时存储二进制数据当然可以大大改变数据库的大小。但是在任何情况下,两个解决方案都需要更多的磁盘存储空间。

What is good with file system based solution is that sometimes it is handy to be able to directly access files, for example copying part of the images somewhere else. Also storing binary data of course can dramatically change size of database. But in any case, more disk storage is needed somewhere with both solutions.

当然,所有这些都可以要求比目前可用的更多的DB资源。通常可以有显着的性能损失,特别是如果决定在本地文件系统和远程DB之间。在你的情况下(每月6000个文件)原始性能不会有问题,但延迟可以。

Of course all of this can ask more DB resources than currently available. There can be in general significant performance hit, especially if decision is between local file system and remote DB. In your case (6000 files monthly) raw performance will not be problem, but latency can be.

这篇关于数据库blob vs磁盘存储的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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