How to scale hosting / image service?

I am creating a website where users can upload photos and also convert downloaded photos into thumbnails.

Plan ahead if the site becomes popular, how do I scale it so that images (both original and thumbnails) are stored and served from multiple servers? Maybe a cluster? Is there any open source software that will help me with this?

Thanks.

+4
source share
3 answers

Interest Ask.

I think the most robust and easily scaled solution would be to use something like MogileFS , which is a distributed file system based on HTTP.

Another approach, which might be easier to build, is to simply make sure you know how to scale image hosting if you need to. Possible approaches may be: - Use Amazon S3 - Implement the outline / splitting of images manually in your application, store images on different servers (with slower / larger storage), and then put a reverse proxy in front of it.

In my opinion, MogileFS will be a great solution to this problem. It should be trivial for scaling, but the initial implementation may take a little longer.

+1
source

Buy it, do not build. Akamai and Amazon CloudFront and their ilkommizeize it. Do not reinvent the wheel, this is a truly specialized function that can be easily and reliably outsourced much cheaper than the built-in one.

0
source

Well, one way to get close to this is to convert the image file to binary format and save the binary file to the database.

I used php to convert images to blob format and save these blobs in mysql database. When the files are in the database, you can use php scripts to convert blob back to mime type like jpeg or gif, and then on the web page.

So, your files are then centrally stored in a database, you can put scripts that convert drops into images on any number of servers.

I have never used open source software to use this storage method, but it is quite simple to create scripts.

-2
source

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


All Articles