Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing a lot of images S3 vs DynamoDB [closed]

Tags:

I am working on project that needs to store a lot of images per second. And I'm a little bit confused if I should store my images in S3 or in DynamoDB. My confusion is because it seems that S3 do not support batch requests and I have to be able to get all images in a batch,if necessary; On the other hand I'm not sure if it is a good idea store all these images in a table in dynamoDB. What would be the best approach?

like image 1000
PachinSV Avatar asked Oct 08 '12 03:10

PachinSV


People also ask

Is S3 good for storing images?

The more efficient and cost-effective option is to use AWS's S3 service for storing the image files. Using S3 is a very low-cost option. Effectively, all you are paying for is transferring files into an S3 bucket and serving those images to your users.

Is S3 faster than DynamoDB?

For relatively small items, especially those with a size of less than 4 KB, DynamoDB runs individual operations faster than Amazon S3. DynamoDB can scale on-demand, but S3 offers better scalability.

Can DynamoDB store images?

Long answer: DynamoDB limits individual records to 64 KB, so you probably can't use DynamoDB unless your images are tiny anyway.

Which is cheaper DynamoDB or S3?

Taking all of this into account and adding up our original AWS bill, we can easily say that the DynamoDB solution is cheaper by more than 10x than the S3 solution.


1 Answers

Short answer: Use S3.

Long answer: DynamoDB limits individual records to 64 KB, so you probably can't use DynamoDB unless your images are tiny anyway.

You mention wanting to read your images in a batch request, but DynamoDB batch requests return up to 100 records or 1 MB -- whichever is less -- so it's not like you can retrieve all your images at once anyway. You could dump everything from DynamoDB by reading a page at a time, which means lots of requests one after another. Not fast.

DynamoDB is lower latency than S3, and it supports configurable throughput. However, S3 supports as much concurrency as you want out of the box. Want to upload 1000 images at once? Go for it! It doesn't matter if each object takes 400 ms to write since you can transmit as many as you want concurrently. Similarly, you can dump everything from S3 by getting a list of everything in the bucket and then retrieving every object in parallel.

Other reasons to use S3:

  • HTTP compatibility, so you can point other people or applications straight to the bucket
  • Hugely lower storage costs
  • Pay per request, not for provisioned throughput (640 KB/s of write capacity in DynamoDB costs $460/month, versus a flat $0.01 per 1000 uploads in S3)

The only situation I can picture where DynamoDB might make sense for image storage is if your images are small, frequently changing, and you're very sensitive to read latency. Other than that, use S3.

like image 102
willglynn Avatar answered Sep 20 '22 19:09

willglynn