Saving images on heroku server compared to Amazon S3: Pros versus?

I searched everywhere on the Internet to compare stored images in the Heroku PG-SQL SDK and save them on Amazon S3. Im currently trying to make a design decision. However, this is the first time I am writing a web application. So far this is what I know to make a decision:

  • Saving images to the database slows down application performance
  • Saving images to Db is expensive compared to the file system.
  • You cannot access the file system in Heroku
  • You can save images to Amazon S3 at a very low cost.
  • Images stored on Amazon S3 cannot be processed until saved if they do not go through the application on Heroku
  • Getting and saving images on Amazon S3 costs money for every call.
  • If the browser retrieves an object with an image, the browser makes 2 requests for the object, 1 for data from the hero, and the other for S3 for the image. This can be problematic as the browser can only execute certain> m.unt requests per unit of time.
  • Saving images in the database, if the images are small in size, does not significantly degrade performance.
  • Removing images from the database can lead to fragmentation

This is the fact that I know about the topic. Now the situation is standing, Im tends to save images in Heroku database. Since they are mainly thumbnails / small images and their size is less than 250 MB

I was wondering if anyone could tell me if these facts are erroneous or if there are other considerations that I need to make when making such a design decision.

Also, I would really appreciate it if someone could point me to some good online discussions on this topic. I could not find anything that was in this discussion.

+4
source share
1 answer

Save them to S3. Performance depends on storage in the database - if you store in the database, the request must go through your web application and then make a database request (or immediately click varnish, but this is true anyway). In addition, if you have many speakers, this means that users will only collect images one at a time (thin single-threaded, with the exception of a special configuration for long queries). With S3 (or any cloud storage solution), it is as simple as another HTTP request for a static resource - your application does not even need to know about it!

+6
source

Source: https://habr.com/ru/post/1414654/


All Articles