在数据库中存储图像 - 是还是不是? [英] Storing Images in DB - Yea or Nay?

查看:26
本文介绍了在数据库中存储图像 - 是还是不是?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我使用的应用程序在数据库中大量存储图像.您对此有何看法?我更喜欢将位置存储在文件系统中,而不是直接将其存储在数据库中.

So I'm using an app that stores images heavily in the DB. What's your outlook on this? I'm more of a type to store the location in the filesystem, than store it directly in the DB.

您认为优点/缺点是什么?

What do you think are the pros/cons?

推荐答案

我负责一些管理大量 TB 图像的应用程序.我们发现最好在数据库中存储文件路径.

I'm in charge of some applications that manage many TB of images. We've found that storing file paths in the database to be best.

有几个问题:

  • 数据库存储通常比文件系统存储更昂贵
  • 您可以使用标准的现成产品超加速文件系统访问
    • 例如,许多 Web 服务器使用操作系统的 sendfile() 系统调用将文件直接从文件系统异步发送到网络接口.存储在数据库中的图像不会从这种优化中受益.
    • database storage is usually more expensive than file system storage
    • you can super-accelerate file system access with standard off the shelf products
      • for example, many web servers use the operating system's sendfile() system call to asynchronously send a file directly from the file system to the network interface. Images stored in a database don't benefit from this optimization.
      • 管理数据库元数据和文件系统数据之间的完整性更为复杂
      • 很难(在 Web 应用程序的上下文中)保证数据已刷新到文件系统上的磁盘

      这篇关于在数据库中存储图像 - 是还是不是?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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