4

Which DB is better for storing images in a photo-sharing application?

3 Answers3

2

We don't recommend storing images directly in Cassandra. Most companies (they're household names you'd know very well and likely using their services) store images/videos/media on an object store like AWS S3 and Google Cloud Store.

Only the metadata of the media are stored in Cassandra for very fast retrieval -- S3 URL/URI, user info, media info, etc.

The advantage of using Cassandra is that it can be deployed to a hybrid combination of public clouds so you're not tied to one vendor. Being able to distribute your Cassandra nodes across clouds means that you can get as close as possible to your users. Cheers!

Erick Ramirez
  • 13,964
  • 1
  • 18
  • 23
  • is there a reason why we shouldn't store images directly in Cassandra? – procrastinationmonkey Sep 02 '21 at 05:33
  • 1
    Because it isn't efficient to do so. Images can be stored as the CQL type `blob` which have a theoretical max size of 2GB but in practice recommended is up to 1MB because large blobs put the JVM heap under pressure and can cause high GC. Cheers! – Erick Ramirez Sep 02 '21 at 11:52
0

AWS S3 is an object storage service that works very well for unstructured data. It offers infinite store where the size of an object is restricted to 5TB. S3 is suitable for storing large objects.

DynamoDB is a NoSQL, low latency database which is suitable for semi-structured data. DynamoDB uses cases are usually where we want to store large number of small records and have a millisecond latency, DynamoDB record size limit is 400KB

For a photosharing application, you need Both S3 and DynamoDB. S3 acts as a storage, DynamoDB is your Database which lists all galleries, files, timestamps, captions, users etc

Jay
  • 305
  • 2
  • 9
0

You can store photos in Amazon S3, but photo's metadata in someother database.

Amazon S3 well suited for any objects for large size as well.

Kris
  • 67
  • 3