What is the best way for store images of website?

15,472

Solution 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.

Solution 2

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.

Share:
15,472

Related videos on Youtube

Omid Ebrahimi
Author by

Omid Ebrahimi

React JS, React Native, C# .Net, Entity Framework, Big Data

Updated on September 18, 2022

Comments

  • Omid Ebrahimi
    Omid Ebrahimi almost 2 years

    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?

    • kh h
      kh h over 6 years
      What did you end up doing? did you store them on database or file system?
    • Omid Ebrahimi
      Omid Ebrahimi over 6 years
      As far as I remember, we stored thumbnails in database and original photoes in file system.
    • kh h
      kh h over 6 years
      I'm considering storing them on Cassandra, but the concept of nosql is very new to me. It has a learning curve
    • Dmitry Tokarev
      Dmitry Tokarev almost 4 years
      Walmart did this in Cassandra at very large scale: medium.com/walmartglobaltech/…
  • Philip
    Philip almost 11 years
    You need to mention that link is to your blog/website...
  • Omid Ebrahimi
    Omid Ebrahimi almost 11 years
    I see your link (Do not store files in a database.)! 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."
  • Tom O'Connor
    Tom O'Connor almost 11 years
    SQL or NoSQL, my point stands, you'll still have to convert between database stream storage and a file ready to be served.
  • Omid Ebrahimi
    Omid Ebrahimi almost 11 years
    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?
  • Tom O'Connor
    Tom O'Connor over 7 years
    A distributed file system, naturally. Ceph, gluster, plain old xfs and rsync, drdb, Amazon S3, there's so many to choose from.
  • Dmitry Tokarev
    Dmitry Tokarev almost 4 years
    Walmart stored 100s of millions of images in Cassandra: medium.com/walmartglobaltech/…
  • Tom O'Connor
    Tom O'Connor over 3 years
    OP isn't Walmart tho.