Downloading images - CDN, MongoDB or NFS?

I have an admin type system for a website with several web servers where users can customize pages and upload images so that they appear on the page (sort of like CMS). If you already have an instance of MongoDB with replica set settings, what is the preferred way to store these downloads so that a failure occurs and why?

  • CDN, e.g. Amazon S3 / CloudFront.
  • Save images to MongoDB? I am doing this now and am not using GridFS, because our images are all under 1 MB.
  • Use some type of NFS with some failover setup. If # 3, how do you configure this transition to another resource?

I use # 2 just fine now and have already used # 3 without recovering from a crash. If I use MongoDB as a data store for my website and for serving images, can these GET requests for images affect the performance of retrieving data without an image from the database?

+7
source share
3 answers

Could these GET requests for images affect the performance of retrieving data without an image from the database?

Well, more image requests = more HTTP connections to your web servers = more image requests from MongoDB = more network traffic.

So, yes, getting more image data from the database can theoretically affect receiving data without an image. All you have to do is request 1000 images per second for 1 MB of image, and you will begin to see a lot of network traffic between MongoDB servers and web servers.

Please note that this is not a limitation of MongoDB, it is a limitation of network bandwidth.

If you start getting a lot of traffic, then a CDN is definitely recommended. If you already have an HTTP page that displays the image, this should be pretty simple.

+8
source

Why not a CDN before MongoDB?

+5
source

Clustering Redhat or CentOS with a common file system can provide fault tolerance for NFS.

0
source

All Articles