3

We are using cassandra database for store website information, but we are not sure how to save images.

We can store them in cassandra, but we can also allocate a server for storing images.

Cassandra has good performance for big-data storage but if we store images in cassandra we must save them as bytes. For any retreival, first we must read image-bytes from cassandra and store it in a folder and then send it's address to the web page.

Do you have any ideas for this problem?

Omid Ebrahimi
  • 143
  • 1
  • 1
  • 6
  • What did you end up doing? did you store them on database or file system? – Arya Dec 04 '17 at 20:10
  • As far as I remember, we stored thumbnails in database and original photoes in file system. – Omid Ebrahimi Dec 05 '17 at 05:03
  • I'm considering storing them on Cassandra, but the concept of nosql is very new to me. It has a learning curve – Arya Dec 05 '17 at 05:41
  • Walmart did this in Cassandra at very large scale: https://medium.com/walmartglobaltech/building-object-store-storing-images-in-cassandra-walmart-scale-a6b9c02af593 – Dmitry Tokarev Sep 21 '20 at 05:09

2 Answers2

9

No.

Just No.

You don't store images in a database.

Images are files.

Do not store files in a database. (Source: My blog post, I wrote in 2012)

Databases are for storing data.

Filesystems are for storing files.

Store files in a filesystem.

Tom O'Connor
  • 27,440
  • 10
  • 72
  • 148
  • You need to mention that link is to *your* blog/website... – Chris S Jul 16 '13 at 14:41
  • 1
    I see your link ([Do not store files in a database.](http://tomoconnor.eu/blogish/not-storing-files-database/#.UeVXKI3vuW0))! this article is about sql databases but cassandra is a no-sql database! In this article was written: "I'm also primarily talking about RDBMS type databases, not NoSQL, which tend to have a mechanism for storing files a little bit more sanely than "old-fashioned" databases." – Omid Ebrahimi Jul 16 '13 at 15:05
  • 1
    SQL or NoSQL, my point stands, you'll still have to convert between database stream storage and a file ready to be served. – Tom O'Connor Jul 16 '13 at 15:16
  • How do you solve the replication problem? All files should be replicated with no single point of failure. So you still need some distributed filesystem or Key-Value store specialized for files. What do you suggest here? – Mr. Roland Oct 04 '16 at 12:21
  • 1
    A distributed file system, naturally. Ceph, gluster, plain old xfs and rsync, drdb, Amazon S3, there's so many to choose from. – Tom O'Connor Oct 15 '16 at 21:08
  • Walmart stored 100s of millions of images in Cassandra: https://medium.com/walmartglobaltech/building-object-store-storing-images-in-cassandra-walmart-scale-a6b9c02af593 – Dmitry Tokarev Sep 21 '20 at 05:09
  • OP isn't Walmart tho. – Tom O'Connor Dec 03 '20 at 01:11
1

Your question was a bit hard to understand, but in the end I think you mean to serve images, and are figuring out if you want to do either

  • save them in cassandra, and on retreival write them to a file, and send the link to the client.
  • save them on a separate server.

The first doesn't make too much sense to me: if you read them from cassandra, you can probably just stream them to the client without saving them first. But even in that case, I'd go for a file-system sollution: if you have no other demands then just to save the files and serve them you should use file-system.

Nanne
  • 602
  • 2
  • 8
  • 26
  • Our website has a large amount of data! maybe we need to store several billions images! if we store these images in one server with file-system i think this server maybe can't response all requests! but cassandra has a good strategy for read and write data when we have a large amount of data. And it can divide all data between several servers and manage their's with a high performane. But i'm not sure yet! I need more information! can every one guide me? – Omid Ebrahimi Jul 16 '13 at 21:26