tags:

views:

434

answers:

4

Our application will be serving a large number of small, thumbnail-size images (about 6-12KB in size) through HTTP. I've been asked to investigate whether using a NoSQL data store is a viable solution for data storage. Ideally, we would like our data store to be fault-toerant and distributed. Anyone in the StackOverflow community have any experiences they would like to share regarding storing blobs in NoSQL stores, and which one they used? Also, is NoSQL a good solution for our problem, or would we be better served storing the images in the file system and serving them directly from the web server (as an aside, CDN is currently not an option for us)? Thanks.

+3  A: 

Mongo DB should work well for you. I haven't used it for blobs yet, but here is a nice FLOSS Weekly podcast interview with Michael Dirolf from the Mongo DB team where he addresses this use case.

jonfhancock
Thanks, I'll check it out
Wayne See
+1  A: 

Whether or not to store images in a DB or the filesystem is sometime one of those "holy war" type of debates; each side feels their way of doing things is the one right way. In general:

To store in the DB:

  • Easier to manage back-up/replicate everything at once in once place.
  • Helps with your data consistency and integrity. You can set the BLOB field to disallow NULLs, but you're not going to be able to prevent an external file from being deleted. (Though this isn't applicable to NoSQL since there aren't the traditional constraints).

To store on the filesystem:

  • A filesystem is designed to serve files. Let it do it's job.
  • The DB is often your bottleneck in an application. Whatever load you can take off it, the better.
  • Easier to serve on a CDN (which you mentioned isn't applicable in your situation).

I tend to come down on the side of the filesystem because it scales much better. But depending on the size of your project, either choice will likely work fine. With NoSQL, the differences are even less apparent.

jamieb
The question is about storing blobs in a distributed key-value store. A filesystem isn't fault-tolerant or distributed so there's no comparison really.
Seun Osewa
Depending on the file system, it can be both fault tolerant and distributed - see things like MogileFS, Hadoop DFS, GlusterFS.
El Yobo
+1  A: 

Well CDN would be the obvious choice. Since that's out, I'd say your best bet for fault tolerance and load balancing would be your own private data center (whatever that means to you) behind 2 or more load balancers like an F5. This will be your easiest management system and you can get as much fault tolerance as your hardware budget allows. You won't need any new software expertise, just XCOPY.

For true fault tolerance you're going to need geographic dispersion or you're subject to anyone with a backhoe.

(Gravatars?)

No Refunds No Returns
CDN plus a NoSQL db as the origin is a great combination. I have seen this done a couple times with MongoDB (and its GridFS module) successfully.
dm
A: 

If you are in a Python environment, consider the y_serial module: http://yserial.sourceforge.net/

In under 10 minutes, you will be able to store and access your images (in fact, any arbitrary Python object including webpages) -- in compressed form; NoSQL.

code43